SRL Archive - First Scripts

Money Collector


Press Play

2008-03-29 03:12:43

This is my first ever script, i just started sripting today-its fun!!

I know there is heaps of stuff wrong with it.. lyk antibanner and stuff lyk that.its very basic. can ppl see wat i should do to make it better.. THANX :)

program MoneyCollector;

var
x,y: Integer;

const
MoneyColour =1544883; //coin colour

procedure FindCoins;
begin
if(FindColor(x,y,MoneyColour,0,0,515,335)) then
begin
Writeln('Found Coins... Yay!');
MoveMouseSmoothEx(x,y+random(0),20,40,45,25,20);
ClickMouse(x,y,true);
Wait(5000+random(1000));
end;
end;

begin
repeat
ClearDebug;
FindCoins;
until(false);
end.

Da 0wner

2008-03-29 03:19:01

Suggustion

Include srl commands as they are not detectable and don't use any of these


SendKeys
MoveMouse
ClickMouse

And for the mouse put {.include srl/srl.scar} at top and put mouse(x, y, 3, 4, true); for where you want to click. if you need help feel free to post here.

So a fixed version =


program MoneyCollector;
{.include srl/srl.scar}

var
x,y: Integer;

const
MoneyColour =1544883; //coin colour

procedure FindCoins;
begin
if(FindColor(x,y,MoneyColour,0,0,515,335)) then
begin
Writeln('Found Coins... Yay!');
mouse(x, y, 3, 3, true);
Wait(5000+random(1000));
end;
end;

begin
ClearDebug;
FindCoins;
end.

Dumpin

2008-03-29 03:53:36

program MoneyCollector;
{.include srl/srl.scar}

var
x,y: Integer;

const
MoneyColour =1544883; //coin colour

procedure FindCoins;
begin
if(FindColor(x,y,MoneyColour,0,0,515,335)) then
begin
Writeln('Found Coins... Yay!');
Mmouse(x, y, 2, 2);
ChooseOption('ic'); // right mouse, picks it up
Flag; // waits untill they flax on the minimap is gone.
end;
end;

begin
ClearDebug;
FindCoins;
end.


just to make it a little nicer and faster

bloodargon

2008-03-29 10:42:29

program MoneyCollector;
{.include srl/srl.scar}

var
x,y: Integer;

const
MoneyColour =1544883; //coin colour

procedure FindCoins;
begin
if(FindColor(x,y,MoneyColour,0,0,515,335)) then
begin
Writeln('Found Coins... Yay!');
Mmouse(x, y, 2, 2,false); //Needs false indicator for right click?
ChooseOption('ic'); // right mouse, picks it up
Flag; // waits untill the flag on the minimap is gone.
Wait(10000+random(5000));
end;
end;

begin
ClearDebug;
repeat
FindCoins;
Until(false) //Anyone know how to make infinite loop? I know how to do using variables that never change, but, Im sure there is a better way.
end.

Now it loops, checking every 15 seconds for more coins to pickup!

mixster

2008-03-29 11:01:20

Dumpin - Yours doesn't work as you use MMouse which only moves it, so won't right click making ChooseOption useless.
Bloodargon - Yours will get an invalid number of variables error as you use MMouse and then put false at the end. You guys should check more carefully ;)
Anyway, on how to improve it, like others said, you should use SRL functions intsead of MoveMouse/Smooth and ClickMouse.
MMouse(x, y, RandX, RandY: Integer); - Will move the mouse to position x,y, with each added a random value between -RandX/Y and + RandX/Y. E.g. if you put MMouse(10,10,5,5), then it could move the mouse to any position inbetween 5,5 and 15,15.
Mouse(x, y, RandX, RandY: Integer; LeftClick: Boolean); - Will move the mosue (using MMouse) then click. It will left click if the LeftClick boolean is True while right click if it's False.
Also, instead of using FindColor, you may want to use FindColorTolerance, which means it will also find colours slightly different to the colour you specify depending on what you use the tolerance as. 5-15 is normally used, though as it's yellow andnot much else in RS is yellow, you could probably get away with a higher tolerance. To specify the tolerance, just add another integer variable onto the end of FindColor (so after the last variable inside the parenthesis) and change FindColor to FindColorTolerance.

Press Play

2008-04-02 02:13:52

THANKYOU GUYS SOO MUCH!!! you helped me heaps!:D :D
..oh…one more thing…how can i tally up how many time it finds some coins??

iroki_

2008-04-02 09:13:12

program MoneyCollector;
{.include srl/srl.scar}

var
x,y,coins: Integer;

const
MoneyColour =1544883; //coin colour

procedure FindCoins;
begin
if(FindColor(x,y,MoneyColour,0,0,515,335)) then
begin
Writeln('Found Coins... Yay!');
coins := coins + 1;
Mmouse(x, y, 2, 2,false); //Needs false indicator for right click?
ChooseOption('ic'); // right mouse, picks it up
Flag; // waits untill the flag on the minimap is gone.
Wait(10000+random(5000));
end;
end;

begin
SetUpSRL;
ClearDebug;
repeat
FindCoins;
Until (false); //Anyone know how to make infinite loop? I know how to do using variables that never change, but, Im sure there is a better way.
WriteLn('Money taken ' + IntToStr(coins) + ' time[s]');
end.

Press Play

2008-04-04 01:44:36

thanx iroki for that lil update=]

sry mixster i didnt quite understand how to use the Mouse(x, y, RandX, RandY: Integer; LeftClick: Boolean);
when i put it in, it came up with an error..if someone could put them in my script for me i would very much appreciate it so i can understand it easier.:D

this is now my updated script:
any more suggestions or mistakes??

program MoneyCollector;
{.include srl/srl.scar}

var
x,y,coins,CoinFound: Integer;

const
MoneyColour =1479090; //coin colour

procedure FindCoins;
begin
if(FindColorTolerance(x,y,MoneyColour, msx1, msy1, msx2, msy2, 5)) then
begin
Writeln('Found Coins... Yay!');
coins := coins + 1;
Mouse(x, y, 3, 3, false);
ChooseOption('ake');
Flag;
Wait(5000+random(1000));
CoinFound:=1;
end else
CoinFound:=0;
end;

KoKouKo

2008-04-04 01:50:01


Mouse(x, y, 3, 3, false);
if(ChooseOption('ake'))then
coins := coins + 1;

Press Play

2008-04-04 02:47:36

oh yess!! thanx kokouko
good idea to add up the coins AFTER it get them =] =]

now…update 2:

program MoneyCollector;
{.include srl/srl.scar}

var
x,y,coins,CoinFound: Integer;

const
MoneyColour =1479090; //coin colour
InventoryMoney =1545912; //colour of coin from inventory

procedure FindCoins;
begin
if(FindColorTolerance(x,y,MoneyColour, msx1, msy1, msx2, msy2, 5)) then
begin
Mouse(x, y, 3, 3, false);
if(ChooseOption('ake')) then
begin
coins := coins + 1;
CoinFound:=1;
end;
Flag;
Wait(5000+random(1000));
end else
CoinFound:=0;
end;

procedure StayLoggedIn;
begin
if(FindColorTolerance(x,y,MoneyColour,mix1, miy1, mix2, miy2,5)) then
begin
Mouse(x,y,3,3, true);
Mouse(x,y,3,3, true);
end;
end;

begin
SetUpSRL;
ClearDebug;
repeat
FindCoins;
StayLoggedIn;
if(CoinFound=1) then
begin
Writeln('We took money ' + IntToStr(coins) + ' time[s]!');
end;
until(false);
end.

TRY IT OUT >> SEE HOW IT GOES =]

Iron Man

2008-04-04 03:03:15

Use


FFlag(0);
Its the same as Flag; but failsafe, and you can also change 0 to the amount of pixels you want to reach before doing something else.

To find your exact amount of coins you could do this:

coins := CoinAmount('inv');

For your Stay Logged In thing, you could mark time and make it do it every so often with a random amount added like this:

procedure StayLoggedIn;
begin
if(FindColorTolerance(x, y, InventoryMoney, mix1, miy1, mix2, miy2, 5)) then
if (TimeFromMark(MarkedTime) > 30000 + Random(10000)) then
begin
Mouse(x, y, 3, 3, true);
Mouse(x, y, 3, 3, true);
MarkTime(MarkedTime);
end;
end;

And making your loop this:

begin
SetUpSRL;
ClearDebug;
MarkTime(MarkedTime);
repeat
FindCoins;
StayLoggedIn;
if(CoinFound=1) then
begin
Writeln('We took money ' + IntToStr(coins) + ' time[s]!');
end;
until(false);
end.

And you missed some standards, fixed most of your standards here:

program MoneyCollector;
{.include srl/srl.scar}

var
x, y, coins, CoinFound, MarkedTime: Integer;

const
MoneyColour = 1479090; //coin colour
InventoryMoney = 1545912; //colour of coin from inventory

procedure FindCoins;
begin
if(FindColorTolerance(x,y,MoneyColour, msx1, msy1, msx2, msy2, 5)) then
begin
Mouse(x, y, 3, 3, false);
if(ChooseOption('ake')) then
begin
coins := coins + 1;
CoinFound:=1;
end;
FFlag(0);
Wait(5000+random(1000));
end else
CoinFound:=0;
end;

procedure StayLoggedIn;
begin
if(FindColorTolerance(x, y, InventoryMoney, mix1, miy1, mix2, miy2, 5)) then
if (TimeFromMark(MarkedTime) > 30000 + Random(10000)) then
begin
Mouse(x, y, 3, 3, true);
Mouse(x, y, 3, 3, true);
MarkTime(MarkedTime);
end;
end;

begin
SetUpSRL;
ClearDebug;
MarkTime(MarkedTime);
repeat
FindCoins;
StayLoggedIn;
if(CoinFound=1) then
begin
Writeln('We took money ' + IntToStr(coins) + ' time[s]!');
end;
until(false);
end.

For a update maybe you could make it log in? (Using DeclarePlayers and SRL's logging in).

Press Play

2008-04-04 03:57:04

I have 2 problems…
-when i run it, it compiles properly but when i pick up a coin it says PROBLEM: inv interface not open
We have 0 coin!

-what does if (TimeFromMark(MarkedTime) > 30000 + Random(10000)) then and MarkTime(MarkedTime); do?? Overall what does the MarkedTime thing do?

Iron Man

2008-04-04 16:29:59

MarkTime starts counting a time. TimeFromMark will see what that time is on the MarkedTime, and if it is greater or > than a certain time for in this instance 30000 milliseconds plus a random 10000 milliseconds. So it will wait until somewhere between 30 and 40 seconds.

MarkedTime is just a integer, you can change it if you want.

For your 1st problem, make sure you were on your inventory tab. If you want the script to do that for you do this:

GameTab(4);

P1nky

2008-04-04 17:12:16

add antiban :)

liquidpaper

2008-04-19 19:31:47

your going to have to collect a lot of coins for this to be of much use

benjaa

2008-04-30 04:08:17

t….h….i…..s………w……o….u….l….d………..b…….e……………s……o…………..s……l….o…..w…….

but good work on contributing to the site :)
make sure you listen to all the suggestions from other users

munk_bl4de

2008-05-01 18:48:53

lol, poor ppl can use this :), other than that good script for ur first, im still trying to learn how to make one myself

gimillii1592

2008-05-01 23:01:31

add some anti randoms, failsafes, and SMART, and you got yourself a pretty good script!

smoke2k

2008-05-02 21:15:02

yes post up is right mabye add tha

smoke2k

2008-05-02 21:15:02

yes post up is right mabye add tha

gandulfin

2008-05-04 15:49:19

i dont know this theme but is nice !!!:confused:

gandulfin

2008-05-04 15:50:20

make a click in my signature and help em to become a member =)=)

Nava2

2008-05-04 16:12:56

From: gandulfin
make a click in my signature and help em to become a member =)=)


Spam, and against rules. Ban?

On topic; decent script, make some failsafes, and also just test it. Read the srl manual to find useful functions etc.

Nava2