JAD
2007-06-05 19:20:40
Well, with all the people I help over msn, I've found one common problem they've all had. "Where do I start?" Well, just take a look at this script, and I will explain everything before
NOTE: Before reading this, you should have already read one or more of the stickied beginner tuts on learning scar, and probably the first chapter of my tut Things the beginner tuts don't teach you. Then, if you get all that, you should get ready.
Here's the script:
See that? You should already know of just about everything in that already! And it's so simple. If you don't already know, here's what this script should do:
It should repeat clicking the rock and waiting random 1-2 seconds then clicking the rock again until your inventory is full.
Then, once the inventory is full it should drop everything in your inventory except your pick
Now lets me first explain my logic behind the Equipped thing. What that is, is in the dropping procedure, if the pick is equipped, (the user would set Equipped to true) the script will drop everything in your inventory.
If the pick is not equipped, (the user would set Equipped to false) it will drop everything except whats in the first inventory slot (hopefully where the user put there pick :) You should tell them in comments to do that at the beginning of the script).
So in the mining procedure, we look for the color the user put as TheRockColor with a tolerance of 3 on the main screen.
If it finds it, we move the mouse to the color and 2 random pixels up down left and right. Then, if the text 'ine' (AKA, shorter word of Mine) is up, it will save the position of the mouse to x,y and click there.
The reason for GetMousePos is because you don't want to move the mouse to the rock, check the up text then click somewhere else; you want it to click the same spot it moved there to after checking the up text for less detectability/more reliability.
We have it wait 1-2 seconds after clicking the rock, then it does it again. It repeats until the inventory is full.
You could put in the constants WaitTime or something so the user can set how long to wait, then do something like Wait(WaitTime + random(500)); so the user can set it according to there pick/mining level.
Then in the main loop we have it setup srl, activate the client (box down scar), it waits around half a second while boxing down scar just in case you lag a bit or something, and after that it just repeats mining until the inventory is full and then dropping until the user stops the script.
Although this is a very basic script, it still is the way a LOT of scripts work these days, maybe just a little more advanced with more fail safes for more reliability, but this should get the job done for a little while.
So it's not a very good over night script, but after you add anti randoms/anti ban/multi player/fail safes, it could work for a decent amount of time.
To learn about those things, check out my tut (links in sig) Learning the things to become a SRL member, and it should teach you all that :)
Thanks for reading my very short tut, hope that helps you know where to get started with your first script!
NOTE: Before reading this, you should have already read one or more of the stickied beginner tuts on learning scar, and probably the first chapter of my tut Things the beginner tuts don't teach you. Then, if you get all that, you should get ready.
Here's the script:
program PowerMiner;
{.include SRL/SRL.scar}
const
TheRockColor = 12345; //put the rock color here.
Equiped = True; //Is the pick axe equipped?
procedure MineRocks;
begin
repeat
if(FindColorTolerance(x,y,TheRockColor,MSX1,MSY1,MSX2,MSY2,3))then
begin
MMouse(x,y,2,2);
if(IsUpText('ine'))then
begin
Writeln('Found the rock! Clicking now');
GetMousePos(x,y);
Mouse(x,y,0,0,true);
end;
end;
wait(1000+random(1000));
until(InvFull);
end;
procedure Drop;
begin
GameTab(4);
if(Equiped)then
DropAll;
if(not(Equiped))then
DropTo(2,28);
end;
begin
SetupSRL;
ActivateClient;
wait(500+random(500));
repeat
MineRocks;
Drop;
until(False);
end.
See that? You should already know of just about everything in that already! And it's so simple. If you don't already know, here's what this script should do:
It should repeat clicking the rock and waiting random 1-2 seconds then clicking the rock again until your inventory is full.
Then, once the inventory is full it should drop everything in your inventory except your pick
Now lets me first explain my logic behind the Equipped thing. What that is, is in the dropping procedure, if the pick is equipped, (the user would set Equipped to true) the script will drop everything in your inventory.
If the pick is not equipped, (the user would set Equipped to false) it will drop everything except whats in the first inventory slot (hopefully where the user put there pick :) You should tell them in comments to do that at the beginning of the script).
So in the mining procedure, we look for the color the user put as TheRockColor with a tolerance of 3 on the main screen.
If it finds it, we move the mouse to the color and 2 random pixels up down left and right. Then, if the text 'ine' (AKA, shorter word of Mine) is up, it will save the position of the mouse to x,y and click there.
The reason for GetMousePos is because you don't want to move the mouse to the rock, check the up text then click somewhere else; you want it to click the same spot it moved there to after checking the up text for less detectability/more reliability.
We have it wait 1-2 seconds after clicking the rock, then it does it again. It repeats until the inventory is full.
You could put in the constants WaitTime or something so the user can set how long to wait, then do something like Wait(WaitTime + random(500)); so the user can set it according to there pick/mining level.
Then in the main loop we have it setup srl, activate the client (box down scar), it waits around half a second while boxing down scar just in case you lag a bit or something, and after that it just repeats mining until the inventory is full and then dropping until the user stops the script.
Although this is a very basic script, it still is the way a LOT of scripts work these days, maybe just a little more advanced with more fail safes for more reliability, but this should get the job done for a little while.
So it's not a very good over night script, but after you add anti randoms/anti ban/multi player/fail safes, it could work for a decent amount of time.
To learn about those things, check out my tut (links in sig) Learning the things to become a SRL member, and it should teach you all that :)
Thanks for reading my very short tut, hope that helps you know where to get started with your first script!