PDA

View Full Version : dstone's Powerminer



dstone09
07-07-2007, 09:03 AM
I have never made a serious script before just small things so I decided to make a Powerminer. I have been working for about 4 1/2 - 5 hrs to get this far on this script that includes a lot of reading on the forums. Any criticism or suggestions is welcomed, for the script I want to add anti-randoms, anti-ban, multi-character support. I also need to find a way for the miner to mine all the rocks not just the ones in the upper left. If you have any advice/links or anything thing that can help it would be very much appreciated.


//ScriptName = First Powerminer
//Author = dstone09
//Description = Mines ore then drops it.
//Version = 0.1
//Date = Fri. July 06, 2007.
//Comments = Thanks to WhiteShadow, The_Rs_Monkey and WhoCares357 for the Tutorials!

program FirstPowerminer;
{.include SRL\SRL.scar}

var
Loads: Integer;
r: integer;

const
EquipedPick = True; //Is your pick axe equiped?
OreColor = 4681883; //Put the ore color here!
NumberofLoads = 1; // The number of loads you want to do.
WaitTime = 2000; //Time to wait before next click +Random 1000.

procedure MineOre;
begin
repeat
if(FindColorTolerance(x,y,OreColor,MSX1,MSY1,MSX2, MSY2,4))then
begin
MMouse(x,y,4,4);
if(IsUpText('ine'))then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,true);
end;
end;
wait(WaitTime+random(1000));
until(InvFull);
end;

procedure DropOre;
begin
KeyDown(27);
Wait(Random(100));
KeyUp(27);
if(EquipedPick)then
DropAll;
if(not(EquipedPick))then
DropTo(2,28);
end;

procedure Report;
begin
Writeln('////////////////////////////////////////////////');
Writeln('Dropped '+ IntToStr(Loads) + ' Loads of Ore');
Writeln('\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\');
end;

procedure Sig;
begin
ClearDebug;
writeln(' __ __');
writeln('.--| |.-----.| |_.-----.-----.-----.-----.');
writeln('| _ ||__ --|| _| _ | | -__|__ --|');
writeln('|_____||_____||____|_____|__|__|_____|___ __|');
writeln(' ______ _______ __');
writeln('| __ \.-----.--.--.--.-----.----.| | |__|.-----.-----.----.');
writeln('| __/| _ | | | | -__| _|| | || | -__| _|');
writeln('|___| |_____|________|_____|__| |__|_|__|__||__|__|_____|__|');
end;

begin
ActivateClient;
Wait(700+Random(1000))
Sig;
HighestAngle;
repeat
MineOre;
DropOre;
Loads:=Loads+1;
r:=r+1;
until(r=NumberofLoads);
Report;
end.

ZephyrsFury
07-07-2007, 12:06 PM
It seems like a pretty good first script even though I haven't tested it out yet.

A problem is that you forgot to 'SetupSRL'. Also, what is the point of having both 'r' and 'Loads'. Don't both variables do the same thing?

To make the script mine the rocks closest to you, you could make x and y the main screen centre and then replace FindColorTolerance with FindColorSpiralTolerance so the script searches for the colour from the middle out instead of from the top left corner to the bottom right.

stuckman
07-07-2007, 01:26 PM
perhaps use findobj instead of findcolor
you need to add some failsafes into your procedure so if there are no rocks it doesn't just keep looping
here's my mining procedure if you want to take a look at it
it won't compile on your computer as it has lots of custom functions but is a good script example
procedure Mine;
begin
repeat
AntiRandoms;
if(Players[CurrentPlayer].Active = False)then
Exit;
P:=0
repeat
P:=P+1
wait(250+random(100));
until(FindObj(x,y,'ine',rockcolour,9))or(FindObj(x ,y,'ine',rockcolour1,9))or(FindObj(x,y,'ine',rockc olour2,9))or(P=50)
if(P=50)then
begin
writeln('No Rocks');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Loc := 'No Rocks';
Exit;
end;
if(not(P=50))then
begin
MMouse(x,y,2,2);
wait(100+random(50));
if(random(7)=0)then
begin
Mouse(x,y,5,5,False);
wait(25);
ClickOption('ine',1);
end
else
Mouse(x,y,5,5,True)
wait(1150+random(450));
Q:=0
repeat
Q:=Q+1
wait(100+random(100));
until(InChat('cur'))or(InChat('man'))or(Q=20)
wait(500+random(500));
end;
Q:=0
if(random(8)=0)then
begin
antirandoms;
nobans;
end;
antirandoms;
until(InvFull)
i:= i + 1;
l:= l + 1;
DropOres;
end;

dstone09
07-07-2007, 04:40 PM
It seems like a pretty good first script even though I haven't tested it out yet.

A problem is that you forgot to 'SetupSRL'. Also, what is the point of having both 'r' and 'Loads'. Don't both variables do the same thing?

To make the script mine the rocks closest to you, you could make x and y the main screen centre and then replace FindColorTolerance with FindColorSpiralTolerance so the script searches for the colour from the middle out instead of from the top left corner to the bottom right.

Thanks for the feedback and the r and loads thing kinda happened at 2 in the morning so I need to fix that.

yanix
07-13-2007, 10:14 PM
great job keep it up

niemann_22
07-14-2007, 05:08 PM
i tryed it and i always get this

Include file C:\WINDOWS\system32\includes\SRL\SRL.scar does not exist.
Failed when compiling
Line 24: [Error] (24:23): Unknown identifier 'x' in script C:\WINDOWS\system32\Scripts\dstone09sPowerminer.sc ar