SRL Archive - First Scripts

First Mining Script (Broke)


Geebly

2007-10-22 18:32:36

Program Autominer

Var x,y : Integer

Procedure minerocks;
Begin
Findcolor(x,y,54323,5,5,515,340)
Mouse(x,y,1,1,true)
Wait(5000)
End;

Begin
Repeat
minerocks;
a:=a+1
Until(a=27)
End.


This is the error I get;

Failed when compiling
Line 3: [Error] (3:1): Semicolon (';') expected in script C:\Program Files\SCAR 3.12\Scripts\MINING.scar


Im very new but want to learn aswell.

rogeruk

2007-10-22 18:39:59

Program Autominer;
{.include SRL/SRL.scar}

Var x,y,a : Integer;

Procedure minerocks;
Begin
Findcolor(x,y,54323,5,5,515,340)
Mouse(x,y,1,1,true)
Wait(5000)
End;

Begin
SetupSRL;
Repeat
minerocks;
a:=a+1
Until(a=27)
End.

You missed out the ; in program and integer;.
Also you forgot to assign a as a integer variable.

Geebly

2007-10-22 19:49:11

Hah it works now.

Thank you very much.

Geebly

2007-10-22 20:43:45

Ok so ive added onto the script alot, making it useaable on the Coal and Iron mines to the east of Ardougne. Im trying to make it walk back and bank the ores. So far theres no problem with that.

Program Autominer;
{.include SRL/SRL.scar}

Var x,y,a : Integer;

const
ARDArrow = 3172580;
FoodStall = 8231612;
FurStall = 1311368;
Bank = 6345714;
Banker = 610652;
BowlofOrange = 1337335;


Procedure minerocks;
Begin
SetupSRL;
Findcolor(x,y,2569300,5,5,515,340)
Mouse(x,y,1,1,true)
Wait(5000)
end;

Procedure WalkToArrow;
begin
if(FindColor(x,y,ARDARROW,0,0,100,100)) then
begin
MoveMouseSmoothEx(x,y +random(0),20,40,45,25,20);
Wait(100+random(10));
ClickMouse(x,y,true);
Wait(13000)
end;

Procedure WalkToFood;
[COLOR="Red"][B]*[/B][/COLOR]begin
if(FindColor(x,y,FoodStall,0,0,100,100)) then
begin
MoveMouseSmoothEx(x,y +random(0),20,40,45,25,20);
Wait(100+random(10));
ClickMouse(x,y,true);
Wait(7000)
end;

Procedure Bank;
begin
if(FindColor(x,y,Bank,0,0,100,100)) then
begin
MoveMouseSmoothEx(x,y +random(0),20,40,45,25,20);
Wait(100+random(10));
ClickMouse(x,y,true);
Wait(22000)
end;

Procedure ClickBanker;
begin
if(FindColor(x,y,Bank,0,0,100,100)) then
begin
MoveMouseSmoothEx(x,y +random(0),20,40,45,25,20);
Wait(100+random(10));
ClickMouse(x,y,true);
Wait(22000)
end;

Procedure TalktoBanker;
begin
MoveMouse(300,450);
Wait(2000);
ClickMouse(300,450,true);
end.

Procedure TalkMoreToBanker;
begin
MoveMouse(298,392);
Wait(3000);
ClickMouse(298,392,true);
end.

Procedure DepositCoal;
begin
MoveMouse(578,228);
Wait(2000);
ClickMouse(578,228,false);
end.

Procedure DepositALLCoal;
begin
MoveMouse(578,228);
Wait(2000);
ClickMouse(578,228,true);
end.

Procedure WalkToBowl;
begin
if(FindColor(x,y,BowlOfOrange,0,0,100,100)) then
begin
MoveMouseSmoothEx(x,y +random(0),20,40,45,25,20);
Wait(100+random(10));
ClickMouse(x,y,true);
Wait(22000)
end;

Procedure EastWalk;
begin
MoveMouse(712,81);
Wait(7000);
ClickMouse(712,81,true);
end.

Procedure NorthWalk;
begin
MoveMouse(680,19);
Wait(9000);
ClickMouse(680,19,true);
end.

Procedure NorthWalk2;
begin
MoveMouse(679,22);
Wait(11000);
ClickMouse(679,22,true);
end.

Procedure ToLeftMine;
begin
MoveMouse(625,43);
Wait(11000);
ClickMouse(625,43,true);
end.


But I keep getting this error when I try to run it.


Line 34: [Error] (14715:1): Identifier expected in script

* = Line 34

w0g

2007-10-23 07:29:22

Program Autominer;
{.include SRL/SRL.scar}

var
x,y: Integer;

const
ARDArrow = 3172580;
FoodStall = 8231612;
FurStall = 1311368;
Bank = 6345714;
Banker = 610652;
BowlofOrange = 1337335;


Procedure minerocks;
Begin
Findcolor(x, y, 2569300, 5, 5, 515, 340);
Mouse(x, y, 1, 1, true);
Wait(5000);
end;

Procedure WalkToArrow;
begin
if FindColor(x, y, ARDARROW, 0, 0, 100, 100) then
begin
MoveMouseSmoothEx(x, y +random(0), 20, 40, 45, 25, 20);
Wait(100+random(10));
ClickMouse(x, y, true);
Wait(13000);
end;
end;

Procedure WalkToFood;
begin
if FindColor(x, y, FoodStall, 0, 0, 100, 100) then
begin
MoveMouseSmoothEx(x, y +random(0), 20, 40, 45, 25, 20);
Wait(100+random(10));
ClickMouse(x, y, true);
Wait(7000);
end;
end;

Procedure Banking;
begin
if FindColor(x, y, Bank, 0, 0, 100, 100) then
begin
MoveMouseSmoothEx(x, y +random(0), 20, 40, 45, 25, 20);
Wait(100+random(10));
ClickMouse(x, y, true);
Wait(22000);
end;
end;

Procedure ClickBanker;
begin
if FindColor(x, y, Bank, 0, 0, 100, 100) then
begin
MoveMouseSmoothEx(x, y +random(0), 20, 40, 45, 25, 20);
Wait(100+random(10));
ClickMouse(x, y, true);
Wait(22000);
end;
end;

Procedure TalktoBanker;
begin
MoveMouse(300, 450);
Wait(2000);
ClickMouse(300, 450, true);
end;

Procedure TalkMoreToBanker;
begin
MoveMouse(298, 392);
Wait(3000);
ClickMouse(298, 392, true);
end;

Procedure DepositCoal;
begin
MoveMouse(578, 228);
Wait(2000);
ClickMouse(578, 228, false);
end;

Procedure DepositALLCoal;
begin
MoveMouse(578, 228);
Wait(2000);
ClickMouse(578, 228,true);
end;

Procedure WalkToBowl;
begin
if FindColor(x, y, BowlOfOrange, 0, 0, 100, 100) then
begin
MoveMouseSmoothEx(x, y +random(0), 20, 40, 45, 25, 20);
Wait(100+random(10));
ClickMouse(x, y, true);
Wait(22000)
end;
end;

Procedure EastWalk;
begin
MoveMouse(712, 81);
Wait(7000);
ClickMouse(712, 81, true);
end;

Procedure NorthWalk;
begin
MoveMouse(680, 19);
Wait(9000);
ClickMouse(680, 19, true);
end;

Procedure NorthWalk2;
begin
MoveMouse(679, 22);
Wait(11000);
ClickMouse(679, 22, true);
end;

Procedure ToLeftMine;
begin
MoveMouse(625, 43);
Wait(11000);
ClickMouse(625, 43, true);
end;

begin
SetupSRL;
repeat
minerocks;
WalkToArrow;
WalkToFood;
Banking;
ClickBanker;
TalkToBanker;
TalkMoreToBanker;
DepositCoal;
DepositALLCoal;
WalkToBowl;
EastWalk;
NorthWalk;
NorthWalk2;
ToLeftMine;
until (false);
end.

There were many errors in that script, which I fixed. Also, the script compiles successfully, but I don't know if the script works.

rogeruk

2007-10-23 10:54:21

Ive correctly fixed your script..

Program Autominer;
{.include SRL/SRL.scar}

Var
x,y : Integer;

const
ARDArrow = 3172580;
FoodStall = 8231612;
FurStall = 1311368;
Bank = 6345714;
Banker = 610652;
BowlofOrange = 1337335;


Procedure minerocks;
Begin
SetupSRL;
Findcolor(x,y,2569300,5,5,515,340)
Mouse(x,y,1,1,true)
Wait(5000)
end;

Procedure WalkToArrow;
begin
if(FindColor(x,y,ARDARROW,0,0,100,100)) then
begin
Mouse(x,y,4,4,true);
Wait(13000)
end;
end;

Procedure WalkToFood;
begin
if(FindColor(x,y,FoodStall,0,0,100,100)) then
begin
Mouse(x,y,3,3,true);
Wait(7000)
end;
end;

Procedure Banking;
begin
if(FindColor(x,y,Bank,0,0,100,100)) then
begin
Mouse(x,y,3,3,true);
Wait(22000)
end;
end;

Procedure ClickBanker;
begin
if(FindColor(x,y,Bank,0,0,100,100)) then
begin
Mouse(x,y,3,3,true);
Wait(22000)
end;
end;

Procedure TalktoBanker;
begin
MoveMouse(300,450);
Wait(2000);
ClickMouse(300,450,true);
end;

Procedure TalkMoreToBanker;
begin
MoveMouse(298,392);
Wait(3000);
ClickMouse(298,392,true);
end;

Procedure DepositCoal;
begin
MoveMouse(578,228);
Wait(2000);
ClickMouse(578,228,false);
end;

Procedure DepositALLCoal;
begin
MoveMouse(578,228);
Wait(2000);
ClickMouse(578,228,true);
end;

Procedure WalkToBowl;
begin
if(FindColor(x,y,BowlOfOrange,0,0,100,100)) then
begin
Mouse(x,y,3,3,true);
Wait(22000)
end;
end;

Procedure EastWalk;
begin
MoveMouse(712,81);
Wait(7000);
ClickMouse(712,81,true);
end;

Procedure NorthWalk;
begin
MoveMouse(680,19);
Wait(9000);
ClickMouse(680,19,true);
end;

Procedure NorthWalk2;
begin
MoveMouse(679,22);
Wait(11000);
ClickMouse(679,22,true);
end;

Procedure ToLeftMine;
begin
MoveMouse(625,43);
Wait(11000);
ClickMouse(625,43,true);
end;

begin
SetupSRL;
repeat
minerocks;
WalkToArrow;
WalkToFood;
Banking;
ClickBanker;
TalkToBanker;
TalkMoreToBanker;
DepositCoal;
DepositALLCoal;
WalkToBowl;
EastWalk;
NorthWalk;
NorthWalk2;
ToLeftMine;
until(false);
end.

Problem is i doubt it will work, and it isnt made properly. Although a good attempt at your first script.

You can't click in the same co-ords to walk back and for, simply because the minimap rotates randomly, also finding certain colors isnt a good idea cause colors change ingame.

I can honestly say, you need to stop with this script and make it properly with the Mouse and MMouse functions.

You need to look at more tutorials to do with SRL and SCAR.
Check out the Tutorial Island