SRL Archive - First Scripts

Daedolon's FireCrafter [SIMBA]


Daedolon

2010-12-01 20:41:32

I would like to point out for the record that I've never done one bit if coding in my entire life, so this was quite a struggle to get this working; I don't think I've ever been so frustrated in my life doing such a project:mad:. Roughly 2 weeks of work went into creating this script, most of which derived from the help of the tutorial section (my God I would have been doomed from the start without those tutorials). So without any further delay, I present my firecrafter:


Instructions:
1) You must be in the al Kharid bank
2) Put all your rune essence in the first bank slot
3) Put the fire talisman in first inventory slot
4) Have rune essence in your inventory
5) Rune the script



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 := ''; //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;
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)];
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
ClearDebug;
scriptRunningTime := MsToTime ((TimeFromMark(scriptRunning)), 4);
Writeln('=================================================================');
Writeln('|| Number of loads done: ' +IntToStr(LoadsBanked) +' || Time running: ' +scriptRunningTime + '||');
Writeln('=================================================================');
End;

Procedure MainLoop;
Begin
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.


Progress report:
=================================================================
|| Number of loads done: 51 || Time running: 02.13.18||
=================================================================


Current bugs I am aware of:
- Sometimes it does not find the bank booth.

I do plan to add in a more descriptive progress report, and most importantly a function that will incorporate the fire tiara, making it more user friendly.

I'm also well aware there are no "fail safes" in the script, and this is one thing I could never get right no matter how hard I tried. It seemed everytime I added in a fail safe, my script would mess up somewhere in the procedure and log out, or just not work altogether. So please, some help/ explination would be welcomed with GREAT appreciation. Thank you. :)

KingKong

2010-12-01 22:12:45

You could add support for tiaras, instead of just a talisman, since tiaras are the best.
Here is the code for checking if tiara is equipped:

IsEquippedID(5537);

Returns true if equipped.

Daedolon

2010-12-02 23:05:50

Thank you:), I will be sure to add that in right away.

Coh3n

2010-12-03 03:50:55

Maybe throw in some sample reports you've gotten while testing. ;)

Daedolon

2010-12-03 08:36:57

Yes sir. :)

kaszpirowsky

2011-02-13 09:32:19

Wow, still working. It rox.
=================================================================
|| Number of loads done: 6 || Time running: 00.14.11||
=================================================================


Thank you dude :D

Sir R. M8gic1an

2011-02-13 09:33:48

Great! Will look through code later - u can hold me to that - and here I was thinking SRL Army would need some runes.

e: code seems clear and simple :) Well structured too.

~RM

ji894121

2011-12-21 00:30:05

Exception in Script: Plugin(LibReflection32) has not been found
doesn't work for me

Nsight

2011-12-22 13:40:21

From: ji894121
Exception in Script: Plugin(LibReflection32) has not been found
doesn't work for me


Reflection no longer works, thus this script does not work bc it's reflection based. That's why you're getting the error.

Dr. Fuji

2011-12-22 19:50:39

Support fire runes have risen too high and great exp.

Olly

2011-12-22 20:10:04

12-02-2010 Why would you gravedig such an old thread :/

Elmeri233

2011-12-23 06:15:17

Does this script work in Al-kharid, altho MSI is having problems with color recognizion is AK?

DarkCoder

2011-12-23 06:41:42

From: Elmeri233
Does this script work in Al-kharid, altho MSI is having problems with color recognizion is AK?


If you read the post only a few posts above yours you would have found your answer :duh:

The thread was "Last edited by Daedolon; 12-05-2010", it is not a colour script either so is at the moment not going to work and most likely won't for quite a while…