SRL Archive - OSR Help

Scripting help RS07


Oreo Joe

2013-03-31 12:52:53

So I've been trying to write my first script, I think I've finished it but I'm getting a lot of errors can anyone help?

SeanStar

2013-04-02 02:13:50


Program YanilleIronFarmer;
{$DEFINE SMART} //We only need to define smart while using SRL-OSR
{$I SRL-OSR/SRL.Simba}
{$I SPS/sps-osr.simba}
var
ToBank: TPointArray; //Your path global variable

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
End;
procedure AntiBan;
begin
if (not LoggedIn) then //Capitalisation for cleaner code..
LoginPlayer;
if LoggedIn then
begin
case random(50) of
0: HoverSkill(skill_Mining, False);
2: RandomRClick;
3: HoverOnlineFriend;
4: CompassMovement(30, 80, true);
5: Boredhuman;
6: HoverMovingObject;
end;
end;
end;
procedure MineIron;
var x, y: Integer;
begin
repeat
if(FindObjCustom(x, y, ['Mine', 'Iron'], [1844541], 5)) then
begin
MMouse(x, y, 3, 3);
wait(randomrange(50, 80));
//if(pos('ake', GetUpText) = 0) then - Lolwat? We're not looking for "Take" uptext.
ClickMouse2(mouse_left);
wait(randomrange(300,1500));
end; //Forgot a semi-colon, did we?
until (InvFull)
end;


procedure WalkToBank;
begin
//if (InvFull) then - Let's move this up to our Mining procedure.
//begin
//SPS_Setup(RUNESCAPE_SURFACE,['5_10']); - This is not RUNESCAPE_SURFACE07, it still uses RUNESCAPE_SURFACE even though the folder name is runescape_surface07, and didn't you already run this?
ToBank := [Point(324, 130), Point(318, 179), Point(310, 210), Point(285, 261), Point(270, 323)]; //You forgot to define this as a global variable at the top there
SPS_WalkPath(ToBank);
//end;
end;
{begin
SetupSRL; - This entire block here only needs to be run once!
DeclarePlayers;
LoginPlayer;
wait(2000);
MakeCompass(5);
SPS_AnyAngle := True;
SPS_Setup(runescape_surface, ['5_10']); - Only want to run this once.
MyLoc:=sps_getMyPos; - This isn't neccesary, only as a debug
writeln('SPS returns '+inttostr(myloc.x)+','+inttostr(myloc.y));
WalkTobank;
end. }
procedure BankIron; //Let's add some tabs for cleaner code.
begin
WriteLn('Looking for bank.');
if FindBank('ynb') then
begin
WriteLn('We have found the bank.');
if OpenBank('ynb', False, True) then
begin
WriteLn('Proceeding to bank Iron');
DepositAll;
CloseBank;
WriteLn('Banking completed.');
end;
end;
end;
begin
DeclarePlayers; //Capitalisation for cleaner code..
SetupSRL;
LoginPlayer; //Forgot your semi-colon again.
Wait(2000); //Moved some code from WalkToBank procedure.
MakeCompass('N'); // ..
SPS_AnyAngle := True; // ..
SPS_Setup(RUNESCAPE_SURFACE, ['5_10']); //The only time you need to run this!
repeat
MineIron;
WalkToBank;
BankIron;
until not LoggedIn
end.

So many things wrong with this script, I don't even know where to begin. You'll need a procedure to walk back to the iron rocks, and you'll need to add in a wait in the mining procedure so it doesn't just click rock after rock never giving enough actual time to mining it.

Something like

OreCount := InvCount
MarkTime(T)
repeat
wait(500+random(500));
until (InvCount > OreCount) or (TimeFromMark(T) > 15000)

Remember to define the variables.