SRL Archive - First Scripts

Power miner


Kasmember13

2009-01-15 20:19:58

This is my first script.
There is a lot of problems whit it like no anti gas and It constantly bounces the mouse around to find the rock color and some times it cant find it for a couple of seconds.It is an Power mine use for mining iron in the fally mine.


Time Running : 9 Minutes and 32 Seconds. 
Gained 1750 xp.
and running…

This does not need color editing as far as I know…just fill out your name and pass.

program PowerMiner;
{.Include SRL/SRL.Scar}

Var
x, y, i, timer, Dropped, Symbolcolor, OreDTM: Integer;

Mining: Boolean;

Rockcolor: array [0..2] of Integer;

Rockmound: array [0..2] of Integer;

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

Players[0].Name := 'Kasmember18';
Players[0].Pass := 'Password';
Players[0].Nick := 'smem'; // 3-4 letters of username
Players[0].Active := True; // Is the player active?

end;

Procedure Inti;
begin
Rockcolor[0]:= 2107972;//Color of rock vein
Rockcolor[1]:= 2108231;//Color of rock vein
Rockcolor[2]:= 2371662;//Color of rock vein
Rockmound[0]:= 5600126;//Color of the actual rock it self
Rockmound[1]:= 6785687;
Rockmound[2]:= 7510182;
SymbolColor := 11381427;//Color of the oblesk on minimap grey part
Mining:=False;
Dropped:=0;


OreDTM := DTMFromString('78DA63DCCBC4C0B09991011978E92A31D83BF' +
'1338044FF0301E341A09AA5A86A1818189148207D0CA866270135' +
'A7806AD61050B306A8661301355B816AF61250B303A8660901359' +
'B806A56E3570300625F10A9');

end;

Procedure Angle;
begin
KeyDown(Vk_Up);
Wait(1000+Random(500));
KeyUp(Vk_Up);
MakeCompass('S');
end;


Procedure Antirandom;
begin
lampskill:='smithing';
FindNormalRandoms;
FindTalk;
if FindFight=true then
begin
RunAway('W',true,1,4000+random(2000));
if FindColorSpiralTolerance(x, y, Symbolcolor, MMX1, MMY1, MMX2, MMY2,5) then
begin
MMouse(x, y, 3, 3);
ClickMouse(x, y, True);
Wait(2000+random(1000));
end else RunAway('E',true,1,4000+random(2000));
end;
end;



Procedure Antiban;
begin
Case Random(10) of
0:PickupMouse;
1:BoredHuman;
2:HoverSkill('Mining', False);
3:RandomMovement;
4:RandomRClick;
5:Writeln('Nothing');
6:Writeln('Nothing');
7:Writeln('Nothing');
8:Writeln('Nothing');
9:Writeln('Nothing');
end;
end;


Procedure Mineore;
begin
repeat
if FindObjCustom(x, y,['ock','rock','roc'], [Rockmound[1],Rockmound[2],Rockmound[0]],0) then
begin
MMouse(x, y, 5, 5);
end;

For i:=0 to 2 do
begin
if FindObjTPA(x, y, Rockcolor[i], 5, 5, MSX2, MSY2, 0, ['ock','rock','roc']) then
begin
MMouse(x, y, 3, 3);
ClickMouse(x, y, True);
Mining:=True;
Antiban;
AntiRandom;
Wait(4000+random(100));
Mining:=False;
AntiRandom;
end;
end;
until(Invfull);
end;

Procedure Dropore;
begin
repeat
begin
FindDTM(OreDTM, x, y, 550, 205, 735, 460);
MMouse(x, y, 3, 3);
ClickMouse(x, y, False);
Wait(100+random(10));
ChooseOption('Dro');
Dropped:=Dropped+1
Wait(300+random(10));
AntiRandom;
end;
until( not FindDTM(OreDTM, x, y, 550, 205, 735, 460) );
end;

procedure ProgressReport;
begin
ClearDebug;
Writeln('Time Running : ' + TimeRunning +'. ');
Writeln('Gained '+ IntToStr(Dropped*35) +' xp.');


end;


begin
Cleardebug;
Inti;
setupsrl;
DeclarePlayers;
loginplayer;


repeat
Angle;
Mineore;
Dropore;
Mineore;
Dropore;
Logout;
ProgressReport;
Wait(20000+random(1000));
LoginPlayer;
until(false);


end.

Aser

2009-01-15 20:32:41

I would add some fail safes to your untils:false and invfull. Change it to until(invfull or condition);
Make condition a boolean and make it true if it cannot find the rock a certain amount of times in a row.

Kasmember13

2009-01-15 20:43:00

I'm new how do I do that? I originally want to make it so if it couldn't find it a certain number of times then Make Compass('N'); and try again. Idk I'll mess around with it and try to figure it out.

Time Running : 14 Minutes and 14 Seconds.
Gained 3290 xp.

Aser

2009-01-15 21:19:49


if not FindObjTPA(x, y, Rockcolor[i], 5, 5, MSX2, MSY2, 0, ['ock','rock','roc']) then
begin
Inc(MissedFind);
if (MissedFind > ({ammount of colors in your array}) then NoFind: = True;



until(InvFull or NoFind);

Something to that extent. Make sure you declare NoFind (or whatever you use as a variable)

you could also do


if (MissedFind > ({ammount of colors in your array}) then end;

Look up on terminate script. You might want to have that.

Kasmember13

2009-01-15 21:24:38

How would I make the loop star back up again?

Like

until(InvFull or NoFind);
If Nofind then
Makecompass('N');//Try to find the color again angled north
(Go back to begining of loop and try again)// <—–That's what I need to find

Aser

2009-01-15 21:26:23



until(InvFull or NoFind);
If Nofind then
Makecompass('N');//Try to find the color again angled north
FindOre;

noidea

2009-01-15 22:43:06

From: Kasmember13
How would I make the loop star back up again?

Like

until(InvFull or NoFind);
If Nofind then
Makecompass('N');//Try to find the color again angled north
(Go back to begining of loop and try again)// <—–That's what I need to find


Look for a tut with GoTo and Labels in it. Nvm here.

Under the procedure name
put Label Start;
Procedure lolz;
label DoSt00f;
begin
DoSt00f:
begin
repeat
omglolminingorecrap;
until InvFull or NoFind;
end;
if NoFind then
begin
inc(NofindsOres);
if nofindsOres < 10 then GoTo DoSt00f
else exit;
end;
end;

Aser

2009-01-16 00:48:13

Why wouldn't my solution work? Wondering so I can learn to post better help.

Kasmember13

2009-01-16 20:39:04

Type mismatch in script

until Invfull or Trys > 9 ;

Aser

2009-01-17 03:15:59


until(InvFull or (Trys > 9));

How about now?

hamgooof

2009-01-18 15:19:22

 Procedure Mineore;
begin
repeat
if FindObjCustom(x, y,['ock','rock','roc'], [Rockmound[1],Rockmound[2],Rockmound[0]],0) then
begin
MMouse(x, y, 5, 5);
end;

For i:=0 to 2 do
begin
if FindObjTPA(x, y, Rockcolor[i], 5, 5, MSX2, MSY2, 0, ['ock','rock','roc']) then
begin
MMouse(x, y, 3, 3);
ClickMouse(x, y, True);
Mining:=True;
Antiban;
AntiRandom;
Wait(4000+random(100));
Mining:=False;
AntiRandom;
end;
end;
until(Invfull);
end;
what is the 3 in the mmouse parts i know x,y are variables and also the 5+msxsomething in
if FindObjTPA(x, y, Rockcolor[i], 5, 5, MSX2, MSY2, 0, ['ock','rock','roc']) then