SRL Archive - First Scripts

KeepAlive Nov 03,2008


ron1337

2008-11-03 18:07:31

My very first script.
I wrote this to keep my account from being logged out while doing boring things like cutting wood, fishing, fighting giants…lol

It moves the mouse randomly at a random time.

program KeepAlive;
//Date: November 03, 2008
//Author: ron1337
//Credits: XxKanexX Super Basics Tutorial
// WhoCares357 Unmatched Beginner's Guide to Scripting Scar
Var
intWait, intRandom: Integer;
a, b, x, y, x1, y1, x2, y2, i, LoopCount: Integer;
mouseSpeed, ctrlSpacing, ctrlVariance: Integer;

begin
i := 0;
//How many time to iterate the loop
LoopCount := 5000; //<--USER CAN EDIT
//How long to pause between mouse movement (1000 = 1 second)
intWait := 10000; //<--USER CAN EDIT
//How much tolerance to randomize the pause time
intRandom := 5000; //<--USER CAN EDIT
//Controls speed of mouse (40-60 is best)
mouseSpeed := 50 //<--USER CAN EDIT
//Controls the distance between control points along the spline (20-50 is best)
ctrlSpacing := 35 //<--USER CAN EDIT
//Controls the randomness in each control point, smaller values = more straightness, larger values = more curvyness (50-80 is best)
ctrlVariance := 25 //<--USER CAN EDIT

//***************************************
//BEGIN SCRIPT CODING
//DO NOT EDIT BELOW THIS POINT
//***************************************
Writeln('');
Writeln('** Begin KeepAlive Script by ron1337 **');
Writeln('');
//get initial mouse position "base point"
Getmousepos(a, b);
Getmousepos(x, y);
//Start the loop
Repeat
i := i+1;
//wait ~30 seconds (randomized)
Wait((intWait + random(intRandom)) - random(intRandom));
//get current mouse position
Getmousepos(x1, y1);
//compare to previous mouse position
If (x = x1)and(y = y1) then
Begin
//Mouse has not moved since last loop
//Move mouse forward
x2 := x1 + 50 + random(100) - random(100);
y2 := y1 + 50 + random(100) - random(100);
MoveMouseSplineEx(x2,y2, 5, 5, (mouseSpeed + random(5)), (ctrlSpacing + random(5)), (ctrlVariance + random(5)));;
//Move mouse back toward base point
x2 := a + random(50) - random(50);
y2 := b + random(50) - random(50);
MoveMouseSplineEx(x2,y2, 5, 5, (mouseSpeed + random(5)), (ctrlSpacing + random(5)), (ctrlVariance + random(5)));
//Set mouse point
Getmousepos(x, y);
Writeln(' -KeepAlive was activated, mouse has been moved');
End else
Begin
//Mouse was manually move, reset base point
Writeln(' -Mouse was manually moved');
Getmousepos(a, b);
Getmousepos(x, y);
End;
Until(i = LoopCount);

end.

ron1337

2008-11-03 18:12:27

ermmm…

What does it say "drunkenoldman"???

Harry

2008-11-03 18:29:42

Drunkenoldman is who made the
 tags. Just ignore it.
And this is very simple and could be made safer by using SRL.

And not to accuse you or anything... but I think I have seen this code before ;)

E: Add {.include SRL/SRL.scar}, SetupSRL; in main loop, and replace the splines with MMouse.

ron1337

2008-11-03 18:31:51

Is there a procedure besides MMouse that will give me more control over the behavior of the mouse. I like the ability to control the speed and deflection.

This is 100% original, just wrote it this morning.

ron1337

2008-11-03 22:46:46

I've tried to include thesrl.scar you suggested, and added the mmouse procedure.
Now I get the following error when compiling:
Line 781: [Error] (1831:32): Invalid number of parameters in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/GameTab.scar


Any thoughts?

It seems to work fine how it was originally, what makes it detectable in the original version?

triax

2008-11-04 12:43:58

Make sure you have this included at the beginning of your script:
{.Include SRL\SRL.Scar}
If you still get the error try to reinstall SRL.

ron1337

2008-11-04 12:50:01

triax,

Thanks for the advice.
It failed on my home PC last night, but seems to work fine on my work PC this morning.
I'll try re-installing SRL on the home PC.

Are there more advanced procedures like MMouse that allow me to control more options. This procedure seems to move the mouse faster than I normally would. :confused:

triax

2008-11-04 13:02:14

Also include this in your script:
SetupSRL;

kevin_cook2oo7

2008-11-05 00:14:19

well, i have no use for it. but i still tried it out.

its nice. :stirthepot:

ron1337

2008-11-05 08:22:38

I've found it works really nice when you don't want to sit and watch your main fish all day.
It basically sits in the background, and only activates if you aren't using the mouse for ~30 seconds.

Sure is nice not having to log back in because you forgot to move the mouse.

Bad Processor

2008-11-24 14:18:12

Hey i know why your MMouse isnt working.
you use it like this:
MMouse(*1, *2, *3, *4);
*1: X coord
*2: Y Coord
*3: A small number indicating a random offset (X).
*4: A small number indicating a random offset (Y).
Edit: This won't work. im going mad, ignore me :S

– BadProcessor