SRL Archive - OSR Help

Okay, now I'm really lost


Daedolon

2010-12-06 21:27:05

Here's the rundown:

I was working on improving my firecrafter script, in which I've managed to add in a function that allows you to run the script, log in withouth starting at the bank and it will begin working. Right now I have it set so if you are to log into the fire alter, with no rune essence, it will go back to the bank and get some.

Now here is where the problem sets in. I put in 'writreln' commands to track the progress of where the script is currently working/ which function it is at, so if for example you are just exiting the FireAltar it will write in the debug box "now heading back to bank". As soon as I added in this new function (I call it "checklist" to see where your location is), it does everything perfectly fine right up to getting in the Al Kharid bank, but then suddenly I see in the Debug box "now heading back to bank" followed by random clicking on the screen.

Down at the bottom of the script, in the main loop I put an if statement for the "checklist" so once it's done, it will return false and not loop. Afterword, I should be seeing in the debug box: "beginning main loop." But it doesn't show up.

I tried see where it was going wrong but I couldn't figure it out. Please help.



program FireCrafter;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

procedure DeclarePlayers;
begin
NumberOfPlayers(1); // How many players? 1 account = "1', 5 accounts = "5"...
CurrentPlayer := 0; // Start at player "zero" (aka player 1)

Players[0].Name := '';//Your RuneScape UserName
Players[0].Pass := '';//Your RuneScape PassWord
Players[0].Nick := 'asd'; //3-4 letters from name
Players[0].Active:= True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Players[0].Pin := '';
end;

Const
FireAltar = 2456;
PortalID = 2469;
PlayerPositionX = 2584;
PlayerPositionY = 4840;
Craftingalter = 2482;
FireTalisman = 1442;
RuneEssence = 1436;
FireRuneINV = 554;

Var
LoadsBanked, scriptRunning, TotalExperience, FireRunesCrafted : Integer;


Function WalkFromBankToAltar : boolean;
Var WalkingPath : TTileArray;
Begin
If Not LoggedIn then exit;
R_findRandoms;
//If(R_CountItemId(1436) <1) then Exit;
case random(4) of
0: Walkingpath := [Tile(3270, 3164), Tile(3276, 3173), Tile(3283, 3183),
Tile(3284, 3195), Tile(3288, 3199), Tile(3288, 3206),
Tile(3295, 3208), Tile(3301, 3217), Tile(3303, 3228),
Tile(3306, 3236), Tile(3306, 3248), Tile(3312, 3253)];
1: walkingpath := [Tile(3277, 3168), Tile(3284, 3180), Tile(3295, 3190),
Tile(3302, 3202), Tile(3303, 3217), Tile(3307, 3232),
Tile(3310, 3246), Tile(3313, 3254)];
2: walkingpath := [Tile(3275, 3168), Tile(3282, 3182), Tile(3291, 3194),
Tile(3299, 3207), Tile(3298, 3221), Tile(3303, 3236),
Tile(3310, 3248), Tile(3313, 3253)];
3: walkingpath := [Tile(3276, 3165), Tile(3282, 3179), Tile(3285, 3195),
Tile(3292, 3208), Tile(3297, 3220), Tile(3306, 3232),
Tile(3310, 3245), Tile(3313, 3253)];
4: walkingpath := [Tile(3275, 3166), Tile(3281, 3180), Tile(3293, 3184),
Tile(3301, 3194), Tile(3305, 3209), Tile(3304, 3224),
Tile(3304, 3239), Tile(3310, 3247), Tile(3313, 3253)];
end;
Result := WalkPath (walkingpath);
end;

Function FindAndEnterAltar : boolean;
Var AltarObject: TRSObject;
FirealtarTP: TPoint;
t: Integer;
Mytile: Ttile;
Begin
If Not LoggedIn then exit;
R_findRandoms;
Result := false;
R_ClickItemID(FireTalisman, true, 'use');
AltarObject := GetObjectByID(FireAltar, OBJECT_TYPE_INTERACTABLE, 15);
Wait(250+random(250));
FirealtarTp := TileToMs(Altarobject.Tile, 0);
Mouse(FirealtarTP.x, FireAltarTp.y, 3, 3, true);
MarkTime(t);
Repeat
R_findRandoms;
Wait(50);
Mytile := GetMypos;
if(mytile.Y > 4000) then break;
until (timefrommark(t)>8000)
If (timefrommark(t)>8000) then writeln('Crap, we'+#39+'re lost') Else writeln('We have safely made it to the alter =)');
Result := true;

end;

Function FindAltarCraftRunes : boolean;
Var AltarObject: TRSObject;
FirealtarTP: TPoint;
t: Integer;
Begin
If Not LoggedIn then exit;
R_findRandoms;
result := false;
WalkPath([Tile(PlayerPositionX, PlayerPositionY)]);
AltarObject := GetObjectByID(CraftingAlter, OBJECT_TYPE_INTERACTABLE, 15);
Wait(250+random(250));
FirealtarTp := TileToMs(altarObject.tile, 0);
Mouse(FirealtarTP.x, FirealtarTp.y, 3, 3, true);
MarkTime(t);
Repeat
R_findRandoms;
Wait(1000+random(1000));
if(R_CountItemID(FireRuneINV)>0) then break;
until (timefrommark(t)>8000)
If(timefrommark(t)>8000) then writeln('Crap, we''re lost');
If(R_CountItemID(FireRuneINV) >0) then result := true;
wait(1000+random(1000));
End;

Function Leavealtar : boolean;
Var PortalObject: TRSObject;
PortalTp: TPoint;
t: Integer;
MyTile: TTile;
Begin
If Not LoggedIn then exit;
result := false;
R_findRandoms;
Walkpath([Tile(2577, 4845)]);
portalObject := GetObjectById(PortalID, OBJECT_TYPE_INTERACTABLE, 15);
Wait(500+random(500));
PortalTP := TileToMS(PortalObject.Tile, 0);
Mouse(PortalTP.X, PortalTP.y, 3, 3, True);
MarkTime(t);
Wait(500+random(500));
Repeat
R_findRandoms;
Wait(50);
Mytile := GetMypos;
if(Mytile.Y < 4000) then break;
Until (timefrommark(t)>8000)
Wait(50);
If(timefrommark(t)>8000) then writeln('Crap, we'+#39+'re lost')
Else
begin
writeln('We have made it out of the altar without any problems =)');
result := true;
end;
Wait(4000+random(2000));
end;

Function WalkBackToBank : boolean;
Var Walkbackpath: TTileArray;
Begin
If Not LoggedIn then exit;
R_findRandoms;
wait (2000+random(2000));
result := false;
Writeln('Now Walking back to bank');
Walkbackpath := [Point(3312, 3252), Tile(3305, 3244), Tile(3296, 3233),
Tile(3297, 3225), Tile(3296, 3217), Tile(3290, 3209),
Tile(3286, 3200), Tile(3282, 3194), Tile(3283, 3187),
Tile(3281, 3181), Tile(3277, 3173), Tile(3274, 3164),
Tile(3270, 3164)];

Result := WalkPath (walkbackpath);
Wait(1500+random(1500));
end;

Function BankRunes : boolean;
Begin
If Not LoggedIn then exit;
R_findRandoms;
result := false;
R_OpenBankBooth('akb');
Wait(300+random(300));
R_DepositAllButID(Firetalisman);
Wait(1000+random(1000));
Mouse(53, 108,3,3, false);
Wait(500+random(500));
Result := R_ChooseOptionMulti (['All', 'but']);
Wait(250+random(250));
Inc(LoadsBanked);
end;

Procedure ProgressReport;
Var
scriptRunningTime : String;
Begin
scriptRunningTime := MsToTime ((TimeFromMark(scriptRunning)), 4);
Writeln('=================================================================');
Writeln('|| Number of loads done: ' +IntToStr(LoadsBanked) +' || Time running: ' +scriptRunningTime + '||');
Writeln('=================================================================');
End;

function FireAltarLogin : boolean;
begin
If TileOnMM(tile(2584,4840)) then
begin
If R_CountItemID(runeEssence) <1 then
begin
LeaveAltar;
WalkBackToBank;
BankRunes;
Progressreport;
end else
FindAltarCraftRunes;
LeaveAltar;
WalkBackToBank;
BankRunes;
Progressreport;
end;
end;

Procedure MainLoop;
var checklist : boolean;

Begin
Checklist := true;
If CheckList then
begin
Writeln('started script');
FireAltarLogin;
Checklist := false;
end;
writeln('beginning main loop');
MarkTime (scriptRunning);
Repeat
If WalkFromBankToaltar then
Begin
Writeln ('Walked from bank to altar');
If FindAndEnteraltar then
Begin
Writeln ('Entered altar');
If FindaltarCraftRunes then
Begin
Writeln ('Crafted runes');
If(Random(2) = 2) then setrun(true);
If leavealtar then
Begin
Writeln ('Left altar');
If WalkBackToBank then
Begin
Writeln ('Walked back to bank');
If BankRunes then
Begin
Writeln ('Banked load');
ProgressReport;
End else Writeln ('Had trouble banking runes');
End else Writeln ('Had trouble walking back to bank');
End else Writeln ('Had trouble leaving altar');
End else Writeln ('Had trouble crafting runes');
End else Writeln ('Had trouble finding/entering altar');
End else
begin
NextPlayer (false);
end;
Until(AllPlayersInactive)
end;

procedure DefineVariables;
begin
Smart_Members := TRUE;
Smart_Server := 121;
Smart_Signed := TRUE;
Smart_SuperDetail := False;
LoadsBanked := 0;
TotalExperience := 0;
scriptRunning := 0;
FireRunesCrafted := 0;
end;

begin
DefineVariables;
SetupSRL;
SetupReflectionEx(true);
DeclarePlayers;
LogInPlayer;
MakeCompass ('n');
SetAngle (true);
SetRun (true);
MainLoop;
end.

Daedolon

2010-12-07 21:58:52

The problem has been solved. Mod's/ Admin's feel free to close this if you want.