Log in

View Full Version : Help with variable



rj
10-27-2012, 05:10 PM
My bot climbs up a ladder then down a ladder for agility xp.. each time it does i want the variable "xp" to incrwase by 3000

my script looks like this:
program autoagile;
var
X,Y: Integer;
xp: = 0
procedure climb;
begin
//climb
FindColorTolerance(X,Y,3038590,808,188,844,244,4)
Wait(150 + Random(40));
movemouse(x, y);
Wait(220 + Random(50));
ClickMouse(x, y, Mouse_Right);
wait(100);
FindColorTolerance(X,Y,16776960,800,188,844,244,4)
wait(200);
movemouse(x, y);
wait(200);
ClickMouse(x, y, Mouse_left);
wait(2400)
FindColorTolerance(X,Y,3038590,808,188,844,244,4)
Wait(150 + Random(90));
movemouse(x, y);
Wait(220 + Random(50));
ClickMouse(x, y, Mouse_Right);
wait(300);
FindColorTolerance(X,Y,16776960,800,188,844,244,4)
wait(200);
movemouse(x, y);
wait(200);
ClickMouse(x, y, Mouse_left);
wait(2400)
xp += 3000
Writeln("Gained xp:" + xp);

end;
begin
repeat
climb;
until False;
end.

litoris
10-27-2012, 05:20 PM
xp should also be an integer, declare it the way you did x and y.
Use
IncEx(xp, 3000);
Writeln('Gained xp: ' + Tostr(xp));
after the wait(2400) there instead of what you got.

rj
10-27-2012, 05:24 PM
xp should also be an integer, declare it the way you did x and y.
Use
IncEx(xp, 3000);
Writeln('Gained xp: ' + Tostr(xp));
after the wait(2400) there instead of what you got.
added that and it just prints "gained xp:3000" over and over again
code looks like this:
program autoagile;
var
X,Y: Integer;
xp: Integer;
procedure climb;
begin
xp:=0;
//climb
FindColorTolerance(X,Y,3038590,808,188,844,244,4)
Wait(150 + Random(40));
movemouse(x, y);
Wait(220 + Random(50));
ClickMouse(x, y, Mouse_Right);
wait(100);
FindColorTolerance(X,Y,16776960,787,185,861,238,4)
wait(200);
movemouse(x, y);
wait(200);
ClickMouse(x, y, Mouse_left);
wait(2400)
FindColorTolerance(X,Y,3038590,808,188,844,244,4)
Wait(150 + Random(90));
movemouse(x, y);
Wait(220 + Random(50));
ClickMouse(x, y, Mouse_Right);
wait(300);
FindColorTolerance(X,Y,16776960,787,185,861,238,4)
wait(200);
movemouse(x, y);
wait(200);
ClickMouse(x, y, Mouse_left);
wait(2400)
IncEx(xp, 3000);
Writeln('Gained xp: ' + Tostr(xp));

end;
begin
repeat
climb;
until False;
end.

litoris
10-27-2012, 05:35 PM
Well that's because you set xp to 0 at the beginning of every loop. Set it once in the mainloop, before the "repeat".
Also, this script is pretty crappy for RS, because you just click on coordinates, but I don't know about private servers.