SRL Archive - OSR Help

Need basic help


Jhangir

2011-12-21 00:55:36

program PowerChopper;
{$define SMART}
{$i SRL/SRL.scar}
{$i SRL/SRL/Misc/stats.simba}



Const


SRLStats_Username = '';
SRLStats_Password = '';


BreakIn = 135;
BreakFor = 15;
Version = 1.0;
NumbOfPlayers = 1;
StartPlayer = 0;

Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
BoxRewards := ['XP','xp','lamp'];
LampSkill := 'Runecrafting';
Active := True;
end;
end;

Procedure StatsGuise(wat:String);
begin
Status(wat);
Disguise(wat);
end;



Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;

Function FindFrog:Boolean;
Var
x, y: Integer;
Begin

If FindObjCustom(x, y, ['Take', 'Swamp', 'toad'], [1991226, 1991226], 5) Then
WriteLn('Found Frog');

End;




begin
Repeat
FindFrog;
Until(false);

end.



Im trying to make my script say found frog in the text box when finding a swamp toad. The script compiles and runs but doesent move the mouse or anything. Also it says [Hint] (58:12): Variable 'Result' never used at line 57

Hero

2011-12-21 01:19:30

The reason why it isn't even giving you errors or reacting with the game is because in your main loop you are supposed to put

SetupSRL;
as the first line.

So you want something like this

begin
SetupSRL;//Setups up srl.scar(the file you defined at the top)
ActivateClient;//Another key line. Sets the targeted window on top if you aren't using SMART
Repeat
FindFrog;
Until(True);//Might want to set it to true to prevent a loop that will attempt to fight you to quit. Basically means it will loop it until it finds the frog.

end.

Give that a try and see if you get any motion.

As the the 'Result' issue. When ever you use a function: Boolean; it has to return a result. So that being said you can try.


Function FindFrog:Boolean;
Var
x, y: Integer;

Begin

If FindObjCustom(x, y, ['Take', 'Swamp', 'toad'], [1991226, 1991226], 5) Then
WriteLn('Found frog');
Result := True;

If not FindObjCustom(x, y, ['Take', 'Swamp', 'toad'], [1991226, 1991226], 5) Then
WriteLn('No frogs here.');
Result := false;

end;


I might be 100% wrong or 100% right. The second part might not be proper or right but it is something to go on until someone else chimes in. Good luck.

sahibjs

2011-12-21 01:25:20

If you want it to say something in the bottom I believe you use WriteLn.

The rest I'm not so sure about ;o