SRL Archive - First Scripts

My Iron Power Miner


006786

2009-01-28 20:43:56

Hey, it's my first script.


Comment, suggestions, etc.


{By:  006786
Thanks to CamoKyle for his Antiban/random procedures.
Enjoy, as this is my first script!}


Program Powerminer;
{.include srl/srl.scar}
Var x,y,LoadsDone : Integer;

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

Players[0].Name := 'blankity';
Players[0].Pass := 'blankity';
Players[0].Nick := 'blank';
Players[0].Active := True;
{
Players[1].Name := 'blankity';
Players[1].Pass := 'blankity';
Players[1].Nick := 'blank';
Players[1].Active := True;

Players[2].Name := 'blankity';
Players[2].Pass := 'blankity';
Players[2].Nick := 'blank';
Players[2].Active := True;}
end;

procedure IfFight;
var Fight: integer;
begin
If (FindFight) Then
begin
RunAway('N', False, 1, 1000 + Random(500));
Inc(Fight);
end;
end;

procedure AntiRandoms;
begin
LampSkill := 'Mining';
FindNormalRandoms;
IfFight;
if FindDead then
NextPlayer(false);
end;

procedure AntiBan;
begin
case random(7) of
0 : MMouse(0, 0, 700, 500);
1 : Hoverskill('Mining', false);
2 : BoredHuman;
3 : RandomMovement;
4 : GameTab(RandomRange(1,8));
5 : PickupMouse;
end;
end;

procedure GetRidOf;
begin
if InvFull then
begin
DropAll;
Inc(LoadsDone);
WriteLN('/\/\/\Loads Done: ' + InttoStr(LoadsDone) +' /\/\/\');
end;
end;



Procedure MiningIron;
Begin
FindColorSpiralTolerance(x,y,1976644,0,0,517,339,20);
AntiBan;
Wait(2000+random(1000));
AntiRandoms;
MMouse(x,y,5,5);
if IsUpText('ine') then
Mouse(x,y,5,5,true);
if InvFull then
GetRidOf;
if (LoadsDone=10) then
NextPlayer(false);
end;

begin
SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
MiningIron;
until(AllPlayersInactive);
end.

mormonman

2009-01-29 00:09:05

very very simple, you need someway to reset the loadsdone after one player finishes… because the way you have it, it will only do one player, then will log into next and then do nextplayer(false) for that one and all the remaining ones.

NiCbaZ

2009-01-29 04:20:10

Good start , much better then my first script. Just a few pointers.

- Try useing the SRL Include lots more and The Wizzy Plugin that is full of TPA function, that be used with the FindColorTol you have been using to make Color finding lots better.

Procedure MiningIron;
Begin
FindColorSpiralTolerance(x,y,1976644,0,0,517,339,20);
AntiBan;
Wait(2000+random(1000));
AntiRandoms;
MMouse(x,y,5,5);
if IsUpText('ine') then
Mouse(x,y,5,5,true);
if InvFull then
GetRidOf;
if (LoadsDone=10) then
NextPlayer(false);
end;

here you might want to use a loop for when its waiting for the next rock such in….


Procedure MiningIron;
var
Start, Finsh : Integer;
Begin
FindColorSpiralTolerance(x,y,1976644,0,0,517,339,20);
AntiBan;
Wait(2000+random(1000));
AntiRandoms;
Start:= InvCount;
MMouse(x,y,5,5);
if IsUpText('ine') then
Mouse(x,y,5,5,true);
while Start =< InvCount do
begin
antiban
wait(2000);
end;
if InvFull then
GetRidOf;
if (LoadsDone=10) then
NextPlayer(True);
end;



if you see there i used some simple Integers a While Loop.

The While loop simply works as

While Someting = True do some other code.

so basiclly what that does while you havent mined a rock it will wait until you have mined a rock.

006786

2009-01-29 15:46:30

Thank you all very much :D

The next miner I make will be much better :)

006786

2009-01-29 21:05:00

One thing that I could use help with is a better way to find the rocks.

Looking for a sliver of color isn't very efficient :|

mormonman

2009-01-29 21:06:29

look in the mining.scar, it has colors for each rock from each mine…