Log in

View Full Version : Can't follow YoHoJo's tutorial #2 Part 2/2



Mufasa
05-30-2012, 01:47 PM
I've been following YoHoJo's Tutorials (http://www.youtube.com/playlist?list=PLAA8F9AF6A13ABD90&feature=plcp) on Youtube and ran into a problem =/

Not sure if it's just me being dumb and blind but I genuinely can't see anything wrong with it up to this point, it even compiles successfully.

I think I've followed the guide accurately, re-watched it a few times, paused it numerous times. Yet, for some reason I't wont run:fiery:

Sometimes the mouse doesn't move at all and other times it hovers over the inventory bag. I've changed the colour at least 20 times, the box size, the MinCount.

So it should look like this right? I believe I got them all;


Program ChopNDrop;

//{$DEFINE SMART}
{$i SRL/SRL.simba}


Const
SRLStats_Username = ''; // You can enter your SRL Stats Username here
SRLStats_Password = ''; // Enter your SRL Stats Password here
BreakEvery = '600'; // How Many Minutes To Break After
BreakFor = '5'; // How Long to Break For
NumbOfPlayers = 1; // How Many Players (Normally 1)
StartPlayer = 0; // 0 means First Character
Version = '1.0'; // Script Version


Procedure DeclarePlayers;
Var
i:integer;
Begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[0].BoxRewards := [''];

with Players [0] do
Begin
Name := ''; //Player Username.
Pass := ''; //Player Password.
Nick := ''; //Player Nickname (3-4 letters of username, not the first)
Active := True;
End;
End;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;

Function CheckAndClick(UpText, Option:String; X, Y:Integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
If WaitUptext(UpText, 5000) Then
Begin
Result:=True;
GetMousePos(x, y);
End else
Writeln('Uptext Wasnt found, Check the Function CheckAndClick');
If RClick Then
Begin
Mouse(X, Y, 0, 0, False);
Result:= WaitOption('tta', 3000)
End else
Writeln('Couldnt right click, Check the Function CheckAndClick');
Begin
Mouse(x, y, 0, 0, True);
Wait (100 + Random(50));
FFlag(0);
End;
End;

Procedure AntiBan;
Begin
If Not LoggedIn Then Exit;
Case Random(250) Of
0: PickUpMouse;
1: Wait(1200 + Random(1000));
2: Begin StatsGuise('Antiban') GameTab(tab_Stats) HoverSkill('Woodcutting', False) GameTab(28) End; //What skill to check?
3: Begin StatsGuise('Antiban') SleepAndMoveMouse(4000 + Random(1000)); End;
4: Begin StatsGuise('Antiban') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
5: Begin StatsGuise('Antiban') RandomAngle(1); End;
6: Begin StatsGuise('Antiban') GameTab(tab_Stats) HoverSkill('random', False); GameTab(28) End;
7: Begin
RandomMovement;
SetAngle(SRL_ANGLE_HIGH);
End;
End;
End;

Procedure FailSafe(Reason:String);
Begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
TerminateScript;
End;


Function ChopDown: Boolean;
Var
x, y, PlusOne, TreeCounter: Integer;
Begin
PlusOne:= InvCount +1;
x:=MSCX;
y:=MSCY;
If FindObjTPA(x, y, 3491408, 5, 1, 15, 60, 600, ['Tree', 'down T', 'ree']) Then
Begin
StatsGuise('Hooray, we found a Tree');
GetMousePos(x, y);


Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption('Chop', 200 + Random(100));
End;
End;
End else
Writeln('ObjTpa wasnt found, Check the Function Chopdown');

Repeat
MarkTime(TreeCounter);
Antiban;
Wait(1000);
If InvCount=Plusone Then
Writeln('We got one');
Until (InvCount=PlusOne) Or (TimeFromMark(TreeCounter) > 4000)
End;


Begin
SetupSRL;
DeclarePlayers;
Repeat
ChopDown;
Until(InvFull);
if (InvFull) then
Writeln('Inventory Full, Ending Script');
StatsGuise('Inventory Full, Ending Script');
End.






Also; To YoHoJo, Thank You for the tutorials ^-^ You're one cool frood:spot:.

http://img214.imageshack.us/img214/8554/ddddddddddddddu.jpg

Abu
05-30-2012, 04:07 PM
Add a fialsafe to all your functions.

All the places you have a done a if .. then .. begin, instead of using a normal end, do end else followed by a Writeln to write 'couldn't find so and so'.

So like this:


If FindObjTPA(x, y, 2505548, 20, 1, 15, 60, 600, ['Tree', 'down T', 'ree']) Then
Begin
StatsGuise('Hooray, we found a Tree');
GetMousePos(x, y);


Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
WaitOption('Chop', 200 + Random(100));
End;
End else
Writeln('Couldn''t find ObjTPA, need better colours!'); //******** here *********\\

Mufasa
05-30-2012, 05:16 PM
It is working now somewhat. Those fail safes are useful, apparently it couldn't find anything.

It's still being a bit strange though, it'll cut down 1-3 trees then tell me it couldn't find any. Even when there's more on screen.:duh:

Wonder if I add a camera rotation as soon as it cant find any, if it'll fix it. I assume that's doable?



*Everyones Reply* :google::google:!!!

Okay sheesh >.>

http://img214.imageshack.us/img214/8554/ddddddddddddddu.jpg

Abu
05-30-2012, 07:31 PM
Wonder if I add a camera rotation as soon as it cant find any, if it'll fix it. I assume that's doable?




Yup, like in my above post, you can add a begin before the Writeln and then add MakeCompass('WhatDirection');

YoHoJo
05-30-2012, 07:38 PM
If FindObjTPA(x, y, 3491408, 5, 1, 15, 60, 600, ['Tree', 'down T', 'ree']) Then

Color: 3491408
Tolerance: 5

When using CTS 1 (the 1 after the 5) you need quite a bit of tolerance to find similar colors. CTS2 and 3 need less tolerance. Not sure how much I used in video, but a tolerance of like 30+ seems better.

Also, your 'box' is 15X60= 900pixels
And your MinCount is 600 pixels.

So that means at least 2/3 of your search box needs to be the tree color for it to be found.
With such a low tolerance and high mincount I think the 'requirements' you're setting aren't being met.

So higher tolerance, and maybe a lower mincount, or lower mincount AND smaller search box.