SRL Archive - First Scripts

First script help


bloopa1

2012-06-13 16:31:48

This is my first attempt at a script and i am having some trouble so i would really apreciate help. It pickpockets just fine right now, the eating part doesnt seem to work please help!

program BlooopasGaurdThief;
//{$DEFINE SMART}
{$i srl/srl.simba}
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
Exit;
FindNormalRandoms;
case Random(30) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
13:
begin
HoverSkill('Thieving', False);
wait(2000+Random(400));
end;
17:
PickUpMouse;
23:
begin
MakeCompass('N');
wait(100+random(133));
end;
end;
end;
procedure Stealing;
var x, y: integer;
begin
repeat
FindNormalRandoms;
Antiban;
if FindObj(x, y, 'uard', 13161169, 20) then
begin
Mouse(x,y,5,5,false);
ChooseOption('ickpocket');
wait(1000+random(500));
WriteLn('Found guard!');
end;
Until(false)
end;
Procedure Eat;
var
x, y: Integer;
Begin
Repeat
FindNormalRandoms;
Antiban;
if (HPPercent<50) then
FindObj(x, y, 'rout', 7830154, 35);
Begin
Mouse(x,y,5,5,false);
ChooseOption('at');
wait(200+random(100));
end;
Until(HPPercent>70)
End;
begin
SetUpSRL;
//ActivateClient;
//DeclarePlayers;
//LoginPlayer;
Stealing;
Eat;
end.


Thank you for ur time!!

putonajonny

2012-06-13 16:39:46

If you put
 at the start of the script and 
at the end it sets it out better for people to read :)


I've changed your eating procedure a bit, make sure you look at the comments
Procedure Eat;
var
i, : Integer;
Begin
Repeat
FindNormalRandoms;
Antiban;
if (HPPercent<50) then
for i := 1 to 28 do //This goes through all of the inventory slots one at a time
begin
if(ExistsItem(i))then //For each slot it checks if there is an item there
begin
MMouseItem(i); //if there is then it moves the mouse to it
if(WaitUptext('rout', 100+Random(500)))then //if then checks if the uptext matches
begin
ClickMouse2(mouse_Left); //if it does then it clicks
Wait(1000+Random(1000)); //Then waits while it eats
end;
if(HPPercent > 70)then //if the HPPercent is greater than 70 then it exits the procedure
exit;
end;
end;
Until(HPPercent>70)
end;

bloopa1

2012-06-13 16:44:46

From: putonajonny
If you put
 at the start of the script and 
at the end it sets it out better for people to read :)


thank you i had no idea how to do that!! :)

putonajonny

2012-06-13 16:46:40

From: bloopa1
thank you i had no idea how to do that!! :)


See my edit :)

bloopa1

2012-06-13 16:50:57

From: putonajonny
See my edit :)


thank u very much! Now could i add a type of failsafe of

if InvEmpty then
exit;
would that end it when the player runs out of food?

putonajonny

2012-06-13 16:54:46

From: bloopa1
thank u very much! Now could i add a type of failsafe of

if InvEmpty then
exit;
would that end it when the player runs out of food?


That would exit the procedure, if you put:
if(InvEmpty and (HPPercent < 50))then
TerminateScript;

It would end the script, you could also add:
if(InvEmpty and (HPPercent < 50))then
begin
ExitToLobby;
TerminateScript;
end;

bloopa1

2012-06-13 17:16:00

From: putonajonny
That would exit the procedure, if you put:
if(InvEmpty and (HPPercent < 50))then
TerminateScript;

It would end the script, you could also add:
if(InvEmpty and (HPPercent < 50))then
begin
ExitToLobby;
TerminateScript;
end;


Thank u very much for all the help!! Just so i can know what was keeping mine from working properly, it was obviously greatly worse then ur fix but i just want to know so i can learn! :)

putonajonny

2012-06-13 17:20:20

FindObj searches the MainScreen of runescape for items, you could have used FindObjEx