PDA

View Full Version : Updated Guide to Making a PowerMiner



Torrent of Flame
03-23-2008, 08:36 PM
Original my PLM found here: http://www.villavu.com/forum/showthread.php?t=24726


If you liked my tutorial please Rep++ or Rank The Thread. If you actually read it, please comment!


Credits to PLM for providing the outline to this tutorial.

This needed updating as there was alot of errors on that Tutorial, and I feel it is time to get a new one out there for people to use to stop people asking about obsolete items of errors they recieve.

Anyway....

Welcome to Torrent's Updated Power Miner Guide!

This Tutorial will cover:
- AntiBan
- AntiRandoms
- Mining
- FailSafes
- Constants
- Variables
- Loops
- Declare Players


To Start we should name the the program that we are going to use, calling it something significant to the program you are going to make:

program MyFirstPowerMiner;

Then you HAVE to include this part, as it controls everything that we need to use in this script (FindObjCustom, etc.)

{.include SRL/SRL.scar}

The we include our constants. Constants are basically what they say they are, something that is ALWAYS the same, like RockColours, TreeColours, SMART Worlds, etc.

const
RockColour1= 111111;
RockColour2= 222222;

These Rock Colours would be picked from the Rock You wish to mine, so Iron and Rune would be different, The example colours are obviousley false for any type of rock [Prove me wrong on that one ;) ]

Then we have to declare our variables, not variables again explain themselves, something that is a variable, can constantly change. The variables in this case are the x and the y, the co-ordinates on the game screen. It is an "integer" as they are co-ordinates, which are numerical. Tries will be explained later.

var x, y, Tries: integer;

Then we have our first procedure. I will explain the procedure after we see the overview.

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0

Players[0].Name := 'Username';
Players[0].Pass := 'Password';
Players[0].Nick := 'erna';
Players[0].Active := True;

end;

Procedure DeclarePlayers tells us the name of the procedure that we are using. Begin starts the procedure [Every "Begin" has an "End", Every "Repeat" has an "Until" and Every "If" has a "Then" - Follow this and it should stop "Idenfitifer Expected ;)]. How Many Players means how many players we are going to use, and Current player tells us which player to start with. Username, Password are pretty basic, but the Nickname HAS to be 3-4 letters of non-capital or without a space of your Username, like mine is. The Active = True tells us if the player is to be run in the script or not.


Now we have our next procedure, our AntiRandoms:

Procedure AntiRandoms;
begin
If(FindFight)then
RunAway('N', True,1,15000);
FindNormalRandoms;
FindLamp('Mining');
end;

And our AntiBan:

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False);
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
6: DoEmote(400 +Random(90));
end;
end;

Im Not going to explain AntiBan or AntiRandoms, but you can find a tutorial on them found here: http://www.villavu.com/forum/showthread.php?t=27515

Now onto our actual mining procedure. This part will be merged with an explanation of Fail Safes:

procedure RockMining;
begin
if not LoggedIn then
Exit;
if (not (FindObjCustom(x, y, ['Mi', 'ne'], [RockColour1, RockColour2], 7))) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 20)then
begin
Logout;
Exit;
end else
if FindObjCustom(x, y, ['Min', 'ine'], [RockColour1, RockColour2], 7) then
repeat
case (Random(2)) of
1: Mouse(x, y, 4, 4,false);
ChooseOption('ine');
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
end;

From the Start:

procedure RockMining;
begin
if not LoggedIn then
Exit;


We name our procedure, and then it begins. We have our first Fail Safe. If our character is not logged in, the script will exit.

if (not (FindObjCustom(x, y, ['Mi', 'ne'], [RockColour1, RockColour2], 7))) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 20)then
begin
Logout;
Exit;
end else

Well first, if it doesnt find the Object that says "Mine" when hovered over, including a Tolerance of 7, so it can search 7 pixels either side, it will wait 0.2 seconds, add 1 to the number of tries, and try again. If it Tries 20 times with no success, it will logout your character, to stop you standing there like an idiot, and then exit the script, and Ends ELSE - IE, otherwise..

if FindObjCustom(x, y, ['Min', 'ine'], [RockColour1, RockColour2], 7) then
repeat
case (Random(2)) of
1: Mouse(x, y, 4, 4,false);
ChooseOption('ine');
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
end;

If it actually finds the Rock to mine, it will repeat a random of these 2, it will hover over the rock and Choose "Mine" or it will automatically click on the rock, to make it more human like. It then ends the case, and the repeat goes with the until, like I said earlier, so it will repeat mining until it has a full inventory, then ends the procedure.

Onto our final procedure before the loop, the dropping of the mined material:

Procedure DropRocks;
begin
if FindObjCustom(x, y, ['Ore'], [RockColour1, RockColour2], 7) then
DropTo(2,28);
end;

So, it begins, and if it finds the Object "Ore" with the colours you have picked (The Ore colour is generally the same as the rock colour) then it will drop ores from inventory position 2, to inventory position 28.

Now for our Loop.

We begin by setting up SRL, then repeating the Mine Procedure & Drop procedure:

begin
SetupSRL;
repeat
RockMining;
DropRocks;
AntiBan;
until (False)
end.

So it begins, sets up SRL, repeats Rock Mining, Drop Rocks and AntiBanning, until it is stopped manually.


NOTE: If someone could do the Drop procedure - Greatly appreciated.


Thanks :spongebob:

Richard
03-23-2008, 09:33 PM
Wow! This is a very good and detialed tut.

I repped you btw :p

PS: erma isnt 4 letters of username :)

Cazax
03-23-2008, 09:53 PM
Nice one ;) keep posting tuts.

Torrent of Flame
03-23-2008, 10:26 PM
Thanks guys :D

Just an example Dude ;) Ill edit it now

faster789
03-23-2008, 10:55 PM
repped! love this tut!

P1nky
03-24-2008, 12:15 AM
NEWBIE SCRIPTERS! use this! really helpful detail!!!!

good job bro

hessels92
03-24-2008, 12:21 AM
yea nice work mate. very good :D

Codester93
03-24-2008, 12:30 AM
Nice tut, i looked at your anti ban/random one. Both are excellent. Keep of the good work. :)

thanx
Codester93

Torrent of Flame
03-24-2008, 10:15 AM
Thanks Guys :D

Richard
03-24-2008, 12:10 PM
I think that this should get stickied, a helpful and very detailed tut

Torrent of Flame
03-24-2008, 12:14 PM
:D Would be nice =]

Gabe
03-24-2008, 02:18 PM
Thanks! My first ever script that actually works. :P +repped!

Torrent of Flame
03-24-2008, 02:39 PM
No problem dude :D

Pwnt by Pwnt
03-26-2008, 09:04 PM
making a drop procedure atm, I'll post it soon :) great tuts btw (even tho I just changed em a little and didn't read a thing ;))

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

var x, y, Tries: integer;

const
RockColour1= 111111;
RockColour2= 222222;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0

Players[0].Name := 'Username';
Players[0].Pass := 'Password';
Players[0].Nick := 'erna';
Players[0].Active := True;
end;

Procedure AntiRandoms;
begin
If(FindFight)then
RunAway('N', True,1,15000);
FindNormalRandoms;
FindLamp('Mining');
end;

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False);
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
6: DoEmote(400 +Random(90));
end;
end;

procedure RockMining;
begin
if not LoggedIn then
Exit;
if (not (FindObjCustom(x, y, ['Mi', 'ne'], [RockColour1, RockColour2], 7))) then
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 20)then
begin
Logout;
Exit;
end else
if FindObjCustom(x, y, ['Min', 'ine'], [RockColour1, RockColour2], 7) then
repeat
case (Random(2)) of
0: begin
Mouse(x, y, 4, 4,false);
ChooseOption('ine');
end;
1: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
end;

Procedure DropRocks;
begin
if FindObjCustom(x, y, ['Ore'], [RockColour1, RockColour2], 7) then
DropAll;
end;

begin
SetupSRL;
repeat
RockMining;
DropRocks;
AntiBan;
until (False)
end.

oops, just noticed you already had a drop proc... this compiles now :)

when you did..


case (Random(2)) of
1: Mouse(x, y, 4, 4,false);
ChooseOption('ine');
2: Mouse(x, y, 4, 4, True);
end;

it should be..

case (Random(2)) of
0: begin
Mouse(x, y, 4, 4,false);
ChooseOption('ine');
end;
1: Mouse(x, y, 4, 4, True);
end;

because the first case is like another proc so you need a begin and an end; and the case's should be 0 and 1, not 1 and 2

Torrent of Flame
03-29-2008, 11:10 AM
Thanks for the fix Pwnt

Scaper
04-04-2008, 02:48 AM
wow very nuce tut man keep up the good qwork

rep++ fro u :)

time4u12
04-04-2008, 04:08 AM
nice tut, it looks sweet

blobmaster31
04-04-2008, 06:15 AM
awesome tut. I tried and it mined heaps of iron.

EvilChicken!
04-04-2008, 02:08 PM
Now we have our next procedure, our AntiRandoms:

Procedure AntiRandoms;
begin
If(FindFight)then
RunAway('N', True,1,15000);
FindNormalRandoms;
FindLamp('Mining');
end;

Kinda wrong. FindNormalRandoms finds lamp. And even better, SRL's deafult lampskill is mining! No need for findlamp at all! If you want findlamp to be a different skill, insert this in the 'setup' part of the mainloop in the script. (The part of the mainloop that only is ran once.

LampSkill := 'LampSkill'; // Eg. LampSkill := 'Fishing';

And by the way, your mining procedure can be improved.
Add more failsafes, getmousepos and fix that case. remove randomness from mouseclicks, because you're using FindObj.

DeSnob
04-05-2008, 05:09 PM
does this power miner thing also apply to making an ess miner? like does most of the rules to making a power miner apply to making a ess miner?

sorry if this confused you but i wanna know how to make an ess miner so bad :)

KoKouKo
04-05-2008, 05:13 PM
All the same rules apply except that the colour of Essence is close to the color of the walls and surroundings you might want to look at what Wizzup? did in his miner.

Torrent of Flame
04-16-2008, 07:31 PM
Meh..

Bumpage

Frederick
04-21-2008, 01:04 PM
Very nice tutorial - and is helping me alot with creating my auto fisher.

Torrent of Flame
04-21-2008, 03:35 PM
WTF? Autofisher.

Its an POWER MINER. WTH MAN?

sunny
04-22-2008, 10:30 AM
this is a great [TUT], how do i add a progress report?

how do i fix this?
Line 77: [Error] (12731:1): Unknown identifier 'DropTo' in script C:\Program Files\SCAR 3.15\Scripts\SunnysFirstPowerMiner.scar

jarred1
04-22-2008, 10:55 AM
Good tut. Though it is the first I've read, explains a lot of the strange coding in SCAR. Thanks +Repped.

thebob142
04-22-2008, 11:16 PM
torrent i'm trying my hand at scripting again and i keep getting add comma etc.. i do what it says but got stuck on one that kept saying and comma then i did and syntax error please help

Nava2
04-23-2008, 12:20 PM
Here is my dropping procedure, I modelled it off of one of Hy's. PLEASE CREDIT IF USED!

{************************************************* ******************************
procedure DropInv(f,l: integer);
By: Nava2-Modelled after DropeItem by Hy71194.
Description: Drops items in slots f-l.
************************************************** *****************************}

procedure DropInv(f,l: integer);
var i: integer;
TMSpeed: integer;
begin
if (not (LoggedIn)) then
begin
writeln('ended at dropInv');
exit;
end;
TMSpeed:= MouseSpeed;
MouseSpeed:= 20+random(7);
GameTab(4);
if ExistsItem(i) then
for i:= f to l do
DropItem(i);
Writeln('Emptied Out Iron!')
MouseSpeed:=TMSpeed;
end;

Nava2

Jimmy5410
05-13-2008, 03:50 AM
Thanks for the guide, works great! =)

I.P Smasher
05-14-2008, 02:28 AM
Line 61: [Error] (12704:20): colon (':') expected in script ????

I.P Smasher
05-14-2008, 02:42 AM
ok nvm about that semiclolon post i fixed but for some reason my logging in messes up, i did the declare players but it just goes but before it even hits the existing user button it just sits in one spot above it and just keeps click randomely????? i did everything properly????

Zlakata
05-15-2008, 12:55 PM
Very good tut, good for begginers like me, it mined a invy of iron for me :)

Kalle
05-15-2008, 04:08 PM
I think I'm going to try this tutorial out

MetalancA
07-01-2008, 03:47 AM
I keep getting

"Unknown identifier 'Tries' in script"

Yet I have the latest version of SRL and scar..

Can anyone help me on this?

TheMaestro
07-03-2008, 01:41 AM
Great tut! Now I just need to figure out how to make my powerminer drop after it mines 2 iron. That way I drop when the other rock is refreshing and don't waste anytime dropping a full load. Continuous mining.

carlover
07-03-2008, 03:58 AM
Question? when you setup the SRL why dont u make it repeat the antirandoms also?

bell1313
07-03-2008, 06:27 AM
This is great. Just the kinda thing i was looking for!

bell1313
07-03-2008, 06:32 AM
Great tut! Now I just need to figure out how to make my powerminer drop after it mines 2 iron. That way I drop when the other rock is refreshing and don't waste anytime dropping a full load. Continuous mining.

it says in the thread the dropping part. like (2,28) just change it to (2,4) should work.

EDIT: Sorry for double post!!! :(

hahicx
07-03-2008, 07:50 PM
Thanks for this guide. It's really helpful.

On my way to making my first script...

0wn 4 skill
07-04-2008, 01:38 AM
This really is an excellent guide. It would be interesting if u made something a little more advance... :D but this is very good for begginners.

I Jake I
07-04-2008, 01:38 PM
Nice tutorial. Didn't work for me though :(

nobody u kno
07-12-2008, 12:19 AM
Line 61: [Error] (12704:20): colon (':') expected in script ????

How do you fix that error??

spire8989
07-13-2008, 09:42 AM
How do you fix that error??

Well considering it says it's expecting a colon, maybe you should put a colon on that line.

siraren3
07-23-2008, 03:20 AM
THank you vary much this will help me understand mining so i can do essence miner or a granite miner tyvm .

siraren3
07-23-2008, 03:23 AM
How do you fix that error??

yeah just add a ; were its need for me it never goes to the exaxt spot just the right line or line above or under it wired system scar is but vary usefull and I dont think anyone should be told this when asking a Q :google: becouse it should say serach it nub that way nonone needs to use google lol

Ghostman
07-26-2008, 02:00 PM
Nice guide- very helpful

Wolygon
07-28-2008, 03:42 AM
thank you for this very good tut im only posting cuz he posted...lol its very good and i liked it =]

Minkino
09-29-2008, 01:33 AM
I get this error when compiling:
Line 45: [Error] (16405:4): Unknown identifier 'AlmostLogout' in script

Daniel
09-29-2008, 01:35 AM
I get this error when compiling:
Line 45: [Error] (16405:4): Unknown identifier 'AlmostLogout' in script

AlmostLogout was an Anti-Ban procedure which was removed from SRL ;)

jcoops
10-17-2009, 11:40 PM
{.include SRL/SRL.scar} do i have to download something it says it doesnt exist

123ran1
03-27-2012, 09:56 PM
[Error] (23:6): Unknown identifier 'FindFight' at line 22
Compiling failed.

help did findfight get removed or what?

Imanoobbot
03-28-2012, 12:01 PM
NOTE: If someone could do the Drop procedure - Greatly appreciated.


Thanks :spongebob:



Okey here is my IronPowerMiner in its version 0.1. Should be very helpful for this tutorial to make it more detailed :)

http://pastebin.com/index/SPepPSfw


Here are some threads to get how it was created. Just read it and its like step for step to a Powerminer. Dropping the ores good. Including an autocolor function and others.

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

Imanoobbot
03-28-2012, 06:54 PM
procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False); // Put Mining in there....
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
6: DoEmote(400 +Random(90));
end;
end;



WTF? Autofisher.

Its an POWER MINER. WTH MAN?

If you change the Dtms and Colors it would be a Powerfisher ;) makes no real difference

-Imanoobbot