SRL Archive - First Scripts

My 1st Script


7Jam

2008-12-04 20:23:10

Its a very very simple powerminer.

Gotta start somewhere..

program Jams1stScript;
{.include SRL/SRL.scar}


var
x,y: Integer;

const
Ore = 9868962; //Color Of Ore You Want To Mine

procedure FindAndClickOre;
begin
repeat
if(Findcolor(x,y,Ore,0,0,700,700))then
begin
wait(750+random(250));
MoveMouseSpline(x,y,x+1,y+1);
wait(15+random(5));
ClickMouseSpline(x,y,1,1,true);
end;
Until(InvFull);
end;

procedure Drop;
begin
DropAll;
end;

begin
SetupSRL;
repeat
FindAndClickOre;
Drop
until(false)
end.

Sandstorm

2008-12-04 20:27:24

As you know, it's quite simple. I'll post some suggestions in a bit. Also, feel free to pm me if you want some help :).

D1zl3

2008-12-04 20:42:21

Im actually impressed with this as a first script. One thing you could do would be this:
const
Ore = 9868962; //Color Of Ore You Want To Mine
PickWeilded = True; //True = yes, False = no

procedure Drop;
var
x, y: integer;

begin
if (PickWeilded) then // if pick weilded then...
for x := 1 to 28 do // drop slots 1 to 28
DropItem(x); // drops the x which you set to slots 1 through 28
if (PickWeilded = false) then // if pick not weilded then...
for y := 2 to 28 do // wont drop first item in inventory
DropItem(y); // drops the y which you set to slots 2 through 28
end;

Sandstorm

2008-12-04 20:51:43

Or, instead of making it use an un-needed if/then, you can just do this:

procedure Drop;
var
x : integer;
begin
if (PickWeilded) then // if pick weilded then...
for x := 1 to 28 do // drop slots 1 to 28
DropItem(x) // drops the x which you set to slots 1 through 28
Else //If PickWielded does not = true, do:
for x := 2 to 28 do // wont drop first item in inventory
DropItem(x); // drops the y which you set to slots 2 through 28
end;

You also only need one variable; it will only trigger one of those, so using two just wastes the tiny bit of memory needed to store it imo.

Also, one thing I noticed. You included SRL, but you used Click/MoveMouseSpline - this is not recommended! Because your using SRL, use the MMouse and Mouse functions, they're undetectable, and they have random modifiers so that they don't always click in the same spot.

marpis

2008-12-07 16:32:44

Isn't there some function like FindRock? not sure… anyways,
const
Color1 = 0;
Color2 = 0;
Color3 = 0;

FindObjCustom(x, y, ['ock'],[Color1, Color2, Color3], 5);

Could be better than FindColor. Now your script might click where ever the color is found, FindObj only moves the mouse where the color or colors are found AND IsUpText (in this case 'ock' which means 'Rock') is correct.

Mouse(x, y, 0, 0, false);
This one right-clicks (x, y)

ChooseOption('ine');
This one chooses option "Mine" after right-clicking the rock.

Im very impressed if that's your first script ^^

benjaa

2008-12-07 18:30:57

i got some suggestions for you:


{.include SRL/SRL/Skill/Mining.scar}

A very helpful procedure from this include is FindPick. It creates a local variable called "Wielded", and also attempts to find the pick axe head if it broke off.

This means, you can update Drop;


procedure Drop;
var
i : integer;
begin
if(Wielded)then //this only works after calling findpick
begin
DropAll;
end else
begin
for i:=2 to 28 do
DropItem(i);
end;
end;

Also, you need this;
SetupSRL;
ActivateClient;

I have more suggestions for you, but i doubt you're interested anymore

Baked0420

2008-12-07 19:05:02

also in your main loop you have drop when it should be drop;

you forgot the semi-colon so you're going to get a indetifier expected error or some error.

Santa R. Claus

2008-12-07 21:56:34

thats a cool first script

elobire

2008-12-13 10:13:37

this is a simple script but a good one for your first try but u need to use mouse instead of clickmouse and use a colour finder with tolerance as well you will find it easyer to find a colour that way and it gives you less chance to get banned.
how did u get the
dropALL;
comand to work i can never get it working?

FreakyMonkey

2008-12-14 01:22:42

You know, every time I see a new post from someone who is trying to learn, I always laugh. A lot of beginners read old tutorials from tutorial island that teach VERY old basics. Like WhoCares357's tutorial. Anyway, I'll say a few of my opinions, regardless if they have been posted before:

1. Standards. I'm REALLY nitpicky about certain things and this is it. This is how you would clean that up.

program Jams1stScript;
{.include SRL/SRL.scar}


var
x,y: Integer;

const
Ore = 9868962; //Color Of Ore You Want To Mine

procedure FindAndClickOre;
begin
repeat
if(Findcolor(x,y,Ore,0,0,700,700))then //might want to limit your coordential search
begin
wait(750+random(250));
MoveMouseSpline(x,y,x+1,y+1);//should use spline. Use Mouse(x,y,1,1) or w/e
wait(15+random(5));
ClickMouseSpline(x,y,1,1,true); //same advice as above
end;
until(InvFull);
end;

procedure Drop;
begin
DropAll;
end;

begin
SetupSRL;
repeat
FindAndClickOre;
Drop
until(false)
end.

2. Don't use MoveMouseSpline. It's BEYOND old….its…its….ancient and gay. Use Mouse(x,y,1,1) —-The (1,1) part depicts the pixels of wavering when the mouse moves.

MoveMouseSpline(x,y,x+1,y+1);// NOOOOOOO

MMouse(x,y,1,1);// YESSSSSSSSSSSS

3. This is a very basic script but you've gathered all the basic ideals. That's good. YOu NEED to have failsafes in case what you wanted to happen didn't work.

For Example:

if not Mouse(x,y,1,1)then
Logout;

Very basic Failsafe but it's used quite a bit.

4. You really don't need A WHOLE PROCEDURE for one action…

procedure Drop;
begin
DropAll; // DONT DO THIS
end;

Just add

DropAll;

Whenever you need it.

5. Make sure you add a failsafe in the main loop

begin
SetupSRL;
repeat
FindAndClickOre;
Drop //btw forgot to put a semi colon?
until(false) // not good.
end.

Instead of this

until(false)

Do this

until(not loggedin); //or something along those lines

6. You might wanna add more different colors to your const to give an accurate reading of the rocks to mine.

const
Ore = 9868962; //Color Of Ore You Want To Mine

Since that's just ONE color that could be easily distorted.

const
Ore = 9868962;
Ore2= //blah
Ore3= //blah

just makes finding rocks more accurate


Anyway those were my opinions. Good luck. If you need any more help. PM me and i'll give you my instant messenger so I can work more closely with you. :f: