SRL Archive - OSR Help

Scripting help.


the henhead

2013-01-30 21:00:21

I'm making my second script for the server Soulsplit, I compile it, but once it's compiled it doesn't do anything. I press run then it runes and stops. I want it to use charms on the obelisk continually.
Program CharmBot;
{$i srl/srl.simba}

function YellowClick: Boolean;
begin
Result := DidClick(false, 1000);
end;

Procedure UseCharm;
var x, y: integer;
begin
if FindObj(x, y, 'Obe', 3684416, 10) then
MMouse(x, y, 575, 228);
ClickMouse(x, y, mouse_Left);
wait(100+random(1000));
MMouse(x, y, 277, 148);
ClickMouse(x, y, mouse_Left);
repeat;
until YellowClick;
end;


begin
setupSRL;
MouseSpeed:=100;
end.

Compiled successfully in 499 ms.
SRL Compiled in 0 msec
Successfully executed.

Sjoe

2013-01-30 21:04:23

U forgot to add Usecharm in your mainloop mate ;)

the henhead

2013-01-30 21:06:01

Sorry to bother but can you help with that, im new lol

NKN

2013-01-30 21:07:00

begin
setupSRL;
MouseSpeed:=100;
end.
To
begin
setupSRL;
MouseSpeed:=100;
UseCharm;
end.

Sjoe

2013-01-30 21:08:45


begin
setupSRL;
MouseSpeed:=100;
UseCharm; // Add this
end.

U should use another function than FindObj though, cause Uptext don't work on private servers. They are different.
Just try with colors or smthing.

the henhead

2013-01-30 21:11:44

lol thanks, such an obvious mistake, great help both of you

Sjoe

2013-01-30 21:14:54

From: the henhead
lol thanks, such an obvious mistake, great help both of you


EDIT:
Little tip:


You want it to skip the whole sequence when it does NOT find FindObj(x, y, 'Obe', 3684416, 10). So we need to put a begin and end.

if FindObj(x, y, 'Obe', 3684416, 10) then
begin // add another begin and end
MMouse(x, y, 575, 228);
ClickMouse(x, y, mouse_Left);
wait(100+random(1000));
MMouse(x, y, 277, 148);
ClickMouse(x, y, mouse_Left);
repeat;
until YellowClick;
end;
end;

The way you did it:

if FindObj(x, y, 'Obe', 3684416, 10) then
MMouse(x, y, 575, 228); // only affects this line when Findobject is NOT found.


ClickMouse(x, y, mouse_Left); // starting from this line, it will ALWAYS happen.
wait(100+random(1000));
MMouse(x, y, 277, 148);
ClickMouse(x, y, mouse_Left);
repeat;
until YellowClick;
end;

Do you see the difference?

the henhead

2013-01-30 21:22:42

Deleted that here's the new script
 Program CharmBot;
{$i srl/srl.simba}

function YellowClick: Boolean;
begin
Result := DidClick(false, 1000);
end;

Procedure UseCharm;
var x, y: integer;
begin
MMouse(x, y, 571, 229);
ClickMouse(x, y, mouse_Left);
wait(100+random(1000));
MMouse(x, y, 289, 164);
ClickMouse(x, y, mouse_Left);
repeat;
until YellowClick;
end;


begin
setupSRL;
MouseSpeed:=100;
UseCharm;
end.

There is problems, it doesn't continually click, and it clicks the wrong coordinates. I have a virtualbox set up on my other monitor right now, that may affect the coordinates being off. But it doesn't repeat the clicking.

(0,-19). Swapping the values for now.
Warning! You passed a wrong ys to a finder function: -19. That is below 0, thus out of bounds. Setting the value to 0 for now.
Successfully executed.
that's the debug.

EDIT:
function YellowClick: Boolean;
begin
Result := DidClick(false, 1000);
end;

repeat;
until YellowClick;
Could that be the reason it doesn't keep repeating, because that's not supported for RSPS?