SRL Archive - Who Are You ? Who ? Who ?

learning to script.


tvjj

2012-04-05 22:40:30

hey every one i just started to learn how to script, im following yohojo's tut's currently learning the very very basics, and just finished the spank the monkey script, so far i have learned about atleast moving the mouse lol… here is my script you have probably all seen and re-written this one lol.

program SpankTheMonkey;

var
x, y:integer;

begin
MoveMouse (542, 208);
HoldMouse (542, 208, 1);
MoveMouse (16, 204);
ReleaseMouse (x, y, 1);
end.

also i dont know how to put it into its scripting window, let me know how to do that one if you can lol…

eska

2012-04-05 22:45:37

NEVER use MoveMouse unless you are either trying to get banned, or if you are simulating mouse keys (a bit more advanced stuff, lets forget about it for now)

Use the function Mouse. Mouse is used to move and click the mouse with a degree of uncertainty.

Mouse(x, y, 5, 5, True);
This move the mouse to x, y with a degree of uncertainty of 5 pixel and click the left mouse button.

If you want to only move the mouse and not click, use MMouse.

MMouse(x, y, 5, 5);
This is pretty much the same as Mouse, only it does not click any button.

If you want to click the mouse exacly where it currently is without moving it at all, use ClickMouse2 (NOT ClickMouse)

ClickMouse2(True); // This does a left click.
ClickMouse2(False); // This does a right click.

You need to put those thing to get this type of windows:
[SIMBA]



Hope I helped. Welcome to SRL.

Archaic

2012-04-06 01:56:54

Making your first attempts and seeing your work in action for the first time is an awesome feeling isn't it?:)

Before you move on to scripting in the world of runescape I'd suggest you make your way through the rest of Yoho's tutorials as they are awesome at helping visualize and understand the logic behind making a script. Then take a trip to the tutorials section and you'll be well on your way!

tvjj

2012-04-06 02:28:25

awesome thanks for the tips that is some very valuable info :D

i have moved on a bit on the tut after a short break to wash dishes, i got to the part in save the goldfish, while watching the vid i tried to go ahead of him a bit to see if i got it right i am slowly getting the hang of it, here is my progress so far


program SaveTheGoldfish;

Procedure StartGame;
begin
MoveMouse (238, 342);
ClickMouse (238, 342, 1);
Wait(2000);
MoveMouse (389, 328);
ClickMouse (389, 328, 1);
Wait (2000);
MoveMouse (333, 158);
ClickMouse (333, 158, 1);
Wait (2000)

end;
Procedure SaveGoldfish;
var
x, y:integer;
begin
if FindColorSpiralTolerance(x, y, 172287, 15, 29, 267, 231, 20) or
FindColorSpiralTolerance(x, y, 100607, 15, 29, 267, 231, 20) or
FindColorSpiralTolerance(x, y, 1003517, 15, 29, 267, 231, 20) or
FindColorSpiralTolerance(x, y, 737021, 15, 29, 267, 231, 20) Then
Begin
MoveMouse (x, y);
HoldMouse (x, y, 1);
MoveMouse (377, 89);
ReleaseMouse (377, 89, 1);
end;
end;
Begin
StartGame;
repeat
SaveGoldfish;
Until(false);
end.

i mostly understand this and noticed before yojoho fixed it that you would need the the move mouse command in:

MoveMouse (238, 342);
ClickMouse (238, 342, 1);
Wait(2000);
any other simple flash games that can be scripted that any one knows of?

P1nky

2012-04-06 04:03:07

Great to see you attempting to learn, keep it up and do not give up!

Good Luck!

tvjj

2012-04-06 22:30:34

hey guys, so im back at it still working on yohojos tuts, i am doing my first power chopper and am at the part to test if it finds a tree so far i have got

Error: Out Of Range at line 30
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]
for errors, there was a few misc errors i was able to google, this one i couldnt find a direct answer b/c i think you would need to see the script. here is what i got so far, any help is greatly appriciated :D

//TVJJ'S First PowerChopper//

program PowerChopper;
//{$include srl/srl/misc/smart.simba}
{$I SRL/SRL.simba}
{$I srl/srl/misc/debug.simba}
{$I sps/sps.simba}
{$Include SRL/SRL/skill/fighting.simba}

Const
SRLStats_Username = ''; //Your SRL stats Username.
SRLStats_Password = ''; //Your SRL stats Password.
BreakEvery = '3'; //How many minutes to break after.
BreakFor = '1'; //How long to break for.
Version = '1.0a'; // No need to touch.
NumbOfPlayers = 1; //How many players are you using
StartPlayer = 0; // Player to start autoing with (0 means first char)

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];


With Players[i] do
Begin
Name := ''; //Player Usernam
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
End;
end;// declare players


Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;



Function CheckAndClick(UpText, Option:String; x,y:integer; RClick:Boolean) :Boolean;
Begin
MMouse(x, y, 5, 5);
if WaitUpText (UpText, 1500+Random(500)) Then
Begin
Result:=True;
GetMousePos(x, y);
If RClick Then
Begin
Mouse(x, y, 0, 0, False);
Result:= WaitOption (Option, 2000);
If Result Then FFlag (0);
End else
Begin
Mouse(x, y, 0, 0, True);
Wait (100+Random(50));
FFlag(0);
End;
End;
End;

Procedure Antiban;
Begin
Case Random(192) Of
0: HoverSkill('Woodcut', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;


Procedure FailSafe (Reason:String);
Begin
Players [CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
//ProgressReport;
TerminateScript;
End;


Function ChopDown: Boolean;
Var
X, Y: Integer;
begin
//Ex. FindObjCustom(x, y, ('att', 'ack'), [123456, 345678], 5);//
If FindObjCustom(X, Y, ['Chop', 'Down', 'p d'], [1383966, 2832959, 1911338, 1450787], 30) Then
WriteLn('Hooray, we found a tree')
End;


begin
SetupSRL;
DeclarePlayers;
//Repeat
Chopdown;
//Until(false);
End.

just let me know i will be trying to find an answer as i wait :D

Edit: Probably shouldnt put script up with pass and username lol

tvjj

2012-04-06 22:45:11

looks like the issue is
Error: Out Of Range at line 30

which would mean the issue resides in


procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];


With Players[i] do
Begin
Name := ''; //Player Username
Pass := ''; //Player Password
Active := True;
Integers[1] := 4; //copper etc
Integers[2] := 4; //Seconds to try mining another rock
End;
end;// declare players

BobboHobbo

2012-04-07 03:05:15

Simple fix.

With Players[0] do instead of With Players do