SRL Archive - First Scripts

First 07scape Script. Need Guidance.


Robot91292

2013-03-01 03:44:24

So I'm trying to write a simple script to steal from the nature rune chest. I know its a very nooby script but its meant to be baby sat mostly. Just want it to make it so you don't have to focus so much.

I need help with finding a way know when the chest is open, right now I'm using the gold lock when its there its closed when its gone its open. This seems to only work half the time and is not stable.

Here is what I have so far. Any help is very much appreciated!

program ChestThief;
{.include srl/srl.simba}

Procedure ChestClosed;
Var
x,y:integer;
Begin
SetupSRL;
Repeat wait(100) Until
FindColorTolerance(x,y,6908273,195,146,279,179,3)//Finds trim color of chest to right click
If FindColorTolerance(x,y,6908273,195,146,279,179,3) Then
begin;
SetupSRL;
Repeat
Wait(RandomRange(100, 1200));
Mouse(x,y,2,2,False); //right clicks to bring up disarm option
Wait(200)
Mouse(x-10,y+43,2,2,True); //clicks disarm option
Until
not FindColorTolerance(x,y,1083273,195,146,279,179,55) //repeats clicking disarm option until chest opens
end;
end;

Procedure IsChestOpen;
Var
x,y:integer;
Begin
SetupSRL;
Repeat wait(100) Until
not FindColorTolerance(x,y,1083273,195,146,279,179,55) //finds color of lock on chest
If not FindColorTolerance(x,y,1083273,195,146,279,179,55) Then //when lock is not found it knows its open
SetupSRL;
WriteLn('Chest is open')
wait(RandomRange(12000, 14000)); //random time before spam clicking disarm
end;


Begin
IsChestOpen;
ChestClosed;
End.

Runehack123

2013-03-01 04:13:17

Perhaps better colour finding does the trick. Bitmap, DTM, TPA are viable options here although I'd recommend looking at some TPA tutorials e.g. LowDown of WizzyPlugin in the TuT section.
The SRL docs also help a lot in explaining WizzyPlugin TPA functions. :)
Best luck,

tealc

2013-03-01 04:20:00

AutoColorAid uses tpas and is helpful when your having problems picking colors.
http://villavu.com/forum/showthread.php?t=26944

Itankbots

2013-03-01 07:48:31

Dont call SetupSRL; every line, you call it once when the script is setting up, and thats it. dont call it more then once, that will cause alot of problems.

Also look into uses TPA's for the color finding instead, alot more accurate.

This is more of what it should look like, Im really tired so didnt try to run it, probably some errors (need to fix the amount of repeats/begins/ends.) but this is the basic look it should have. Try looking at the SRL includes, specificly the one labeled "timing" It will have different wait funcitons that will work alot better then repeat Wait(100) untill color.


Procedure ChestClosed;
Var
x,y:integer;
Begin
Repeat wait(100) Until
FindColorTolerance(x,y,6908273,195,146,279,179,3)//Finds trim color of chest to right click
If FindColorTolerance(x,y,6908273,195,146,279,179,3) Then
begin
Repeat
Wait(RandomRange(100, 1200));
Mouse(x,y,2,2,False); //right clicks to bring up disarm option
Wait(200)
Mouse(x-10,y+43,2,2,True); //clicks disarm option
Until
not FindColorTolerance(x,y,1083273,195,146,279,179,55) //repeats clicking disarm option until chest opens
end;
end;

Procedure IsChestOpen;
Var
x,y:integer;
Begin
Repeat wait(100) Until
not FindColorTolerance(x,y,1083273,195,146,279,179,55) //finds color of lock on chest
If not FindColorTolerance(x,y,1083273,195,146,279,179,55) Then //when lock is not found it knows its open
WriteLn('Chest is open')
wait(RandomRange(12000, 14000)); //random time before spam clicking disarm
end;


Begin
SetupSRL
Repeat
IsChestOpen;
ChestClosed;
until(false);
End.

Robot91292

2013-03-02 22:53:18

Thank you for the time you took to review the script I will look into TPA tutorials to figure how to go about it! Thanks so much for the replies it is very much appreciated!