SRL Archive - OSR Intermediate Scripting Tutorials

PLM's how to make a simple power miner tut useing srl!


poolikemax

2008-01-23 15:26:25

PLM's simple power miner tut!


today im going to show you how to make a simple power miner with SRL, anti randoms and antiban. PLEASE REP++ ME IF YOU LIKE IT

well start off with scar open and the first step is to include SRL
program powerminer;

{.include SRL/SRL.scar}

begin
end.



now let declair vairables VAR and we want to declair "X, Y" as varables and the two colors of the rock were going to mine but were going to declair the colors as a const
so here goes
program powerminer;

{.include SRL/SRL.scar}

const
rockcolor1= 472123;//set the color of the rock
rockcolor2= 567243;//set color of rock (these aren't the real colors)

var x,y: integer;

begin
end.

Step 1:
makeing our first procedure. our first procedure is going to be a SRL one:
declair players(you should know what it means as its in almost every script)

Procedure DeclarePlayers; // this procedure is used to logg players in
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0; // CurrentPlayer = Array Index

Players[0].Name :='username';//USERNAME
Players[0].Pass :='pass';//PASS
Players[0].Nick :='ser';//3 LETTERS OF YOUR USERNAME NOT THE FIRST ONE
Players[0].Active:=True;//PLAYER IN USE OR NOT


end;

now we want to put it in the main loop but we also want to setupSRL so we have to write these commands in the main loop:
SetupSRL; -so the script knows that we are useing SRL
DeclarePlayers; -used to tell the script the name of the player to loggin
LoginPlayer; -Simple loginplayer
so lets do that
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;

end.

Step 2
adding anti randoms
this is one of the most important things your script needs to have a good working script this is the procedure i use:

Procedure Randoms;
Begin
FindTalk; //finds talkin randoms
FindNormalRandoms; //finds normal randoms
SolveChatRandom; //sloves chat randoms
FindLamp('Woodcutting'); //solves lamp and then choses a skill to update
SolvePinball; //solves pinball random
DwarfItem; //dropes dawalf items
If(FindFight)Then //runs away from fight
Begin
MakeCompass('N');
RunTo('E', True);
Wait(7000 +Random(3000));
RunTo('W', True);
End;
End;



Step 3
adding a antiban
we need this to stop the user getting there account baned. the antiban makes it look like its a real person playing. So here goes
we need a few different antiban procedures you will see what i mean.
before we make the procedure we need to declare randomm as a varable so your varables should now look like this:

var x,y,randomm: integer;

now the anti ban:

procedure antiban;
begin
randomm := Random(4)
case randomm of


0: begin

Wait(3591+(random(287)));
RandomRClick;
Wait(3591+(random(287)));
HighestAngle;
RandomlyChosenSkill;
Randoms
end;

1: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;

2: begin
Wait(3294+(random(873)));

Randoms;
HoverSkill('Woodcutting' ,false);

Wait(3294+(random(873)));

end;

3: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;
end;
end;

Step 4
now we have done antiban and anti randoms we can now do the part of the script that makes the player mine a rock. for this we use a fuction called findobject. what it dose is it looks for the given color(the colors we gave as const) and moves the mouse there and checks up the top to see if its the object were looking for!

Procedure minerock;
begin

if not LoggedIn then
Exit;

repeat
if FindObjCustom(x, y, ['Min', 'ine'], [rockcolor1, rockcolor2], 7) then
begin

Mouse(x,y,0,0,false);
Wait(500+(random(150)));

ChooseOption('ine')
randoms
antiban;
writeln('found rock');

end else
writeln('couldnt find rock');
randoms;
antiban;
antiban;
antiban;

until( InvFull )
end;

that loop will keep mineing till the inventery is full

Step 5
dropping the ore

we need to drop the ore so we need to drop everything from iventory spot no2 - spot 28 so here goes

procedure drop;
begin
antiban;
DropToPosition(2,28);;
antiban;
end;

Step 6
adding every thing to the main loop and finnishing things off

so we need to add the following procedure to the main loop:
minerock;
drop;
also we need to make it repeat but we only want to repeat the mine rock and drop procedures. So heres what your main loop should look like

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
repeat
minerock;
drop;
until (IsFKeyDown(3));


end.

now you should have made a working powerminer now all you need is to add your own sig and instructions. oh finnished script should look somthing like this:

program powerminer;

{.include SRL/SRL.scar}

const
rockcolor1= 472123;//set the color of the rock
rockcolor2= 567243;//set color of rock (these aren't the real colors)

var x,y,randomm: integer;


Procedure DeclarePlayers; // this procedure is used to logg players in
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0; // CurrentPlayer = Array Index

Players[0].Name :='username';//USERNAME
Players[0].Pass :='pass';//PASS
Players[0].Nick :='ser';//3 LETTERS OF YOUR USERNAME NOT THE FIRST ONE
Players[0].Active:=True;//PLAYER IN USE OR NOT


end;

Procedure Randoms;
Begin
FindTalk; //finds talkin randoms
FindNormalRandoms; //finds normal randoms
SolveChatRandom; //sloves chat randoms
FindLamp('Woodcutting'); //solves lamp and then choses a skill to update
SolvePinball; //solves pinball random
DwarfItem; //dropes dawalf items
If(FindFight)Then //runs away from fight
Begin
MakeCompass('N');
RunTo('E', True);
Wait(7000 +Random(3000));
RunTo('W', True);
End;
End;


procedure antiban;
begin
randomm := Random(4)
case randomm of


0: begin

Wait(3591+(random(287)));
RandomRClick;
Wait(3591+(random(287)));
HighestAngle;
Randoms;
end;

1: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;

2: begin
Wait(3294+(random(873)));
Randoms;
HoverSkill('Woodcutting' ,false);
Wait(3294+(random(873)));
end;

3: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;
end;
end;



Procedure minerock;
begin

if not LoggedIn then
Exit;

repeat
if FindObjCustom(x, y, ['Min', 'ine'], [rockcolor1, rockcolor2], 7) then
begin

MoveMouseSmoothEx(x,y, 20,40,45,25,20);
FTWait(1);
clickmouse(x,y,false);
Wait(500+(random(150)));

ChooseOption('ine')
randoms
antiban;
writeln('found rock');

end else
writeln('couldnt find rock');
randoms;
antiban;
antiban;
antiban;

until( InvFull )
end;
procedure drop;
begin
antiban;
DropToPosition(2,28);;
antiban;
end;


begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
repeat
minerock;
drop;
until(IsFKeyDown(3));



I hope you liked my tut and i wish you happy scripting

Im sorry for the poor spelling im crap at spelling lol

i 69 ur nan

2008-01-23 16:10:44

Holy shit this tut is gr8 rep++ i learnt loads! ty poolikemax

benny999

2008-01-25 22:10:58

thank you so much im gonna use this if it's ok as a base and add walk back auto colour pick and buying or withdrawing pick's that would be good but first i have to learn it all

poolikemax

2008-01-27 03:50:54

yer its fine glad you liked

MasterKill

2008-01-27 03:53:16

um you should ad standaards. couse else they'll never learn it.

JuKKa

2008-01-27 04:20:22

those standards are whicked……………..bad….. But else the tut is good i guess.

poolikemax

2008-01-27 04:21:05

ok i will update it soon i have learnt alot since i published this tut

Heavenzeyez1

2008-01-27 04:23:39

This is very simple..but you should explain to them some commands..beginners won't understand it 100%. :) But it's still something. :)
Eerik.

cj_404

2008-01-28 20:33:31

Thank you, thank you, thank you!!! Rep++ for this, I've wanted to script like this for weeks and didn't know how till now. Thank you!

poolikemax

2008-01-29 02:30:10

ok cheers will update wen finnish my flaxpicker

the smith400

2008-01-30 06:36:48

was this because of my advise?

IM LOVIN IT! bua-bua-buaaa-buuuaaa-buaaaaaaaa

really awesome tut, poolikemax you rock my world

Sir R. M8gic1an

2008-01-30 09:19:33

Your randoms procedure could really be shortened to FindNormalRandoms, it already does all those things ;)

~RM

Barda4

2008-02-01 13:10:01

I understand a bit of the coding, and this is a good tutorial but i have one problem. Is there way to make the auto miner mine only iron, and if so then where?

poolikemax

2008-02-02 16:27:31

just pick the color of the iron rock and fill it in at the const pm if u need explaned more

malotthouse

2008-02-07 20:51:16

Nice tut… shouldn't you have an end. in your main loop?

TheChineseMan

2008-02-07 21:36:49

hey nice tut but i tried to run on scar 3.14 but it wont work what version of scar and REV to use on?

poolikemax

2008-02-08 06:52:45

scar 3.12 dont no y it wont work on scar 3,14 also rev 4.10

Doggie

2008-02-08 06:54:57

hi there seems to be an error.
unknonw identifier 'NickNameBMP' in script:confused:

poolikemax

2008-02-08 10:11:19

ok to get rid of that message you have to deleat the line under delear players:
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
then should work!

srl person

2008-02-08 15:49:52

thanks this script rox
helped me alot :)

Jmbyrom1

2008-02-17 05:59:41

I had the same problem with the "NickNameBMP" bit but now it says the "RunBack" bit is unknown as well plz help:confused:

Griff

2008-02-19 20:15:13

great tut man I think I finally might be getting the hang of this scripting buisiness :D

bubbagump

2008-02-21 04:15:31

I knew a little already, but this only cleared things up some…time to scare down a few more to teach my bad self.

kaslim

2008-02-21 07:55:44

Nice tutorial pretty short and to the point. But what does this do?
FindObjCustom(x, y, ['Min', 'ine'], [rockcolor1, rockcolor2], 7)

poolikemax

2008-02-23 12:06:38

it moves the mouse to a given color and checks if at the top it says the given word "mi,ne"

ryanbaron

2008-03-01 00:51:40

From: Jmbyrom1
I had the same problem with the "NickNameBMP" bit but now it says the "RunBack" bit is unknown as well plz help:confused:


I have this problem too.. plz tell us how to fix.

Torrent of Flame

2008-03-02 16:39:25

People posting "Great Tut" are just upping their count because "RunBack" doesnt work anymore, and you dont need "SolvePinball" or anything because its all under FindNormalRandoms now.

poolikemax

2008-03-02 23:23:09

im updateing kk and just del the line that says
NickNameBMP

851man

2008-03-04 19:46:34

whenever i try this script, or any other auto miner, it says this:

Failed when compiling
Line 1: [Error] (1:1): Unable to register function function FindGapsTPA(TPA : TPointArray; MinPixels: Integer): T2DPointArray; in script

what does this mean? (im new)

Codester93

2008-03-08 22:33:22

i used this tut to make a script and got my mining up 12 lvls not much but good! thanx, i never really looked into the tut section, but there is alot of quality tuts in here

zipzone

2008-03-09 01:27:54

well I did everything you said in the same order you said and it logs me in and then just stops and nothing happens so can someone tell me what I might of done wrong or what I need to do

zipzone

2008-03-09 01:34:18

Heres the script I made through this:

program powerminer;

{.include SRL/SRL.scar}

const
rockcolor1= 1120794;//set the color of the rock

var x,y: integer;

Procedure DeclarePlayers; // this procedure is used to logg players in
begin
HowManyPlayers :=1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=0; // CurrentPlayer = Array Index

Players[0].Name :='';//USERNAME
Players[0].Pass :='';//PASS
Players[0].Nick :='lor';//3 LETTERS OF YOUR USERNAME NOT THE FIRST ONE
Players[0].Active:=True;//PLAYER IN USE OR NOT


end;

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;

end.

Procedure Randoms;
Begin
FindTalk; //finds talkin randoms
FindNormalRandoms; //finds normal randoms
SolveChatRandom; //sloves chat randoms
FindLamp('Prayer'); //solves lamp and then choses a skill to update
SolvePinball; //solves pinball random
DwarfItem; //dropes dawalf items
If(FindFight)Then //runs away from fight
Begin
MakeCompass('N');
RunTo('E', True);
Wait(7000 +Random(3000));
RunTo('W', True);
End;
End;

var x,y,randomm: integer;

procedure antiban;
begin
randomm := Random(4)
case randomm of


0: begin

Wait(3591+(random(287)));
RandomRClick;
Wait(3591+(random(287)));
HighestAngle;
RandomlyChosenSkill;
Randoms
end;

1: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;

2: begin
Wait(3294+(random(873)));

Randoms;
HoverSkill('Mining' ,false);

Wait(3294+(random(873)));

end;

3: begin
Wait(3694+(random(791)));
GameTab(random(13)+1);
Randoms;
Wait(3694+(random(791)));
GameTab(4);
end;
end;
end;

Procedure minerock;
begin

if not LoggedIn then
Exit;

repeat
if FindObjCustom(x, y, ['Min', 'ine'], [rockcolor1, rockcolor2], 7) then
begin

Mouse(x,y,0,0,false);
Wait(500+(random(150)));

ChooseOption('ine')
randoms
antiban;
writeln('found rock');

end else
writeln('couldnt find rock');
randoms;
antiban;
antiban;
antiban;

until( InvFull )
end;

procedure drop;
begin
antiban;
DropToPosition(2,28);;
antiban;
end;

begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
repeat
minerock;
drop;
until (IsFKeyDown(3));


end.

Doesnt say any errors, successfully executed but its not mining any of the rocks or moving or anything after it logs in. Is there something else I have to do to get the player to move from rock to rock or something? Someone help me please.

Et0h

2008-03-09 07:49:57

This tut is great. Helped a lot understanding basic scripts.

Blaze

2008-03-16 14:02:11

Whats the difference between FindObjCustom and FindObj exactly?

Pwnt by Pwnt

2008-03-18 01:07:38

good tut for beginners, which I seem to be now that S.M.A.R.T. is out… could you explain how to make S.M.A.R.T. scripts work and how to make a script with S.M.A.R.T. ? thanks :]

Dgby714

2008-03-20 20:29:47

Great Tut

Gold

2008-03-23 15:12:56

Im Gonna Make A script with this Guys make sure to give him cred when u use this holy work Props+++++


A few Problems i Just Tried Compiling the script you gave at end and got these errors

Line 55: [Error] (12634:1): Unknown identifier 'HighestAngle' in script
Line 117: [Error] (12696:1): Unknown identifier 'DropToPosition' in script

kil8er

2008-04-16 12:37:56

From: 851man
whenever i try this script, or any other auto miner, it says this:

Failed when compiling
Line 1: [Error] (1:1): Unable to register function function FindGapsTPA(TPA : TPointArray; MinPixels: Integer): T2DPointArray; in script

what does this mean? (im new)


I know this error when i used Scar 3.12
Now I'm using Scar 3.15 and it don't gives the error

Sorry for my English i'm from the netherlands

Torrent of Flame

2008-04-16 15:37:19

http://www.villavu.com/forum/showthread.php?t=27850

Use this one. Its the updated one.

jacka scar MASTER

2008-04-23 20:20:41

thanks for the script tut helped me heaps and now i am only part noob to scar
u rock

spartan6934

2008-04-24 00:08:36

thanks. been looking for one of these

1-DUB

2008-04-24 00:25:36

nice tut, i loved it.. man srl has come a long way since i last used it…

hooligan-2oo8

2008-05-09 09:12:48

Thanks going to have to try and use this

Griff

2008-05-09 18:37:30

Great tut its perfect for me cause I'm just getting past the beginner stage, but I still don't understand much of the intermediate stuff. Hopefully this will help me out

Zlakata

2008-05-15 12:09:15

Great tut but i get Line 55: [Error] (12709:1): Unknown identifier 'HighestAngle' in script as an error :\\

But nice tut

dver

2008-05-22 07:22:52

From: Zlakata
Great tut but i get Line 55: [Error] (12709:1): Unknown identifier 'HighestAngle' in script as an error :\\

But nice tut


Use SetAngle(True); instead

insanomano

2008-06-29 15:24:40

ok, that was great, work on standards, show progress report, show how to make it multiplayer, you can shorten some of those procs and stuff like antirandoms and antiban but other than that great tutorial. :D

MetalancA

2008-06-30 22:33:38

I keep getting


"Line 52: [Error] (12694:1): Unknown identifier 'RandomlyChosenSkill' in script"
and
"Line 116: [Error] (12759:1): Unknown identifier 'DropToPosition' in script"

Though I downloaded the latest SRL o.0

Can anyone tell me whats wrong?

fuxnix

2008-09-24 13:01:27

nice tutorial it its gonna confusing but worth reading it ill to make scripts someday

poolikemax

2008-11-16 12:44:36

cool thnks 4 feed bak