SRL Archive - First Scripts

iCode's Very 1st Script!


icode

2013-08-08 09:37:07

I have just started scripting and I decided to script a few private server bots just to start getting used to scripting and these are the few I just created:


My RSPS Magic Log Cutter-
*This script just cuts magic logs atm, I am trying to figure out how to implement banking and/or dropping logs, as well as fixing the timing so it doesn't just keep clicking the tree (which on some rsps's stops you from chopping the tree)
program RSPSCutter;
{$i srl/srl.simba}

const
LOGS = 100;

Procedure ClickTree;
var
X,Y:Integer;
begin
repeat
if FindColorTolerance(X, Y, 14678264, 1, 5, 760, 480, 1) or
FindColorTolerance(X, Y, 12187896, 1, 5, 760, 480, 1)then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(10000+random(5000));
end;
until (LOGS > 100);
end;
Begin
SetupSRL;
MouseSpeed := 15;
ClickTree;
end.

My Login Code:
*This script will login to a few different rsps's and you can change the click coords to customize for any server login screen. I can then put this as a procedure at the beginning of any of my scripts as a login feature hopefully. :)
**Credits to hoodz for base :)
program iCodeLogin;

{$I srl/srl.simba}

var
X,Y:Integer;

const

USERNAME = 'Username';
PASSWORD = 'password';

function IsLoggedIn: boolean;
begin
if findcolortolerance(x, y, 1448008, 494, 451, 611, 522, 15) then
begin
result := true
end
else
begin
result := false
end;
end;

procedure LoggingIn;
begin
Wait(200);
movemouse(659, 313);
writeln('entering username');
Wait(200);
clickmouse(x, y, mouse_left);
count := 0;
repeat
Inc(count);
PressKey(VK_Back);
until count > 25;
Wait(250);
sendkeys(USERNAME, 0, 0);
Wait(1000);
writeln('entering password');
movemouse(650, 269);
Wait(200);
clickmouse(x, y, Mouse_left);
Wait(200);
count := 0;
repeat
PressKey(VK_Back);
Inc(count);
until count > 25
sendkeys(PASSWORD, 50, 25);
writeln('logging in');
Wait(1000);
movemouse(576, 396);
Wait(1000);
ClickMouse(x, y, mouse_left);
Wait(8000);
writeln('logged in!')
end;

xtrapsp

2013-08-08 09:40:13

Congrats on your first script.

Have a read of these :)

http://villavu.com/forum/showthread.php?t=60288
http://docs.villavu.com/srl-5/object.html

icode

2013-08-08 09:44:06

From: xtrapsp
Congrats on your first script.

Have a read of these :)



Thank you! That first link will help me to clean up my scripts and make them readable. :)

Hoodz

2013-08-08 12:20:38

Uh i wrote IsLoggedIn and LoggingIn ?

icode

2013-08-08 12:27:27

From: hoodz
Uh i wrote IsLoggedIn and LoggingIn ?


I gave you credit.

Hoodz

2013-08-08 12:29:39

From: icode
I gave you credit.


Alright :)

icode

2013-08-08 12:33:00

From: hoodz
Alright :)


Yup, also would you know how to make my woodcutter drop logs and then repeat? so it cuts and powerchops? I can't seem to get it to work right. :/

Another thing is it clicks the tree again after a little bit and it stops me from chopping.

Hoodz

2013-08-08 12:48:13

From: icode
Yup, also would you know how to make my woodcutter drop logs and then repeat? so it cuts and powerchops? I can't seem to get it to work right. :/

Another thing is it clicks the tree again after a little bit and it stops me from chopping.


Pixelshift: how many pixels change in a certain box. (If your character makes an animation it should turn into a higher number)

For dropping logs you should use dtm. If it finds the dtm of your log then it should drop it (move mouse to it, rightclick, a little sleep, than it moves the mouse a little bit down (to drop) than it clicks.
(You dont use this on real rs since you click always on the same coordinate!)

If it doesnt find the dtm then exit the procedure