SRL Archive - First Scripts

[OSR] First PowerMiner


Ender

2013-12-10 22:07:30

I made this from Torrent of Flame's tutorial: "Updated Guide to Making a PowerMiner". I'd give you a link but I can't yet. Just search for that exact thread title.

It is slightly outdated and I haven't found anything better for OSRS scripts yet. (Like a kiddie walk-thru script write)

I have a some questions.

1) Do I need to call the procedure AntiRandoms in my main loop? Flame's tut excluded it from his main loop.

2) I tried to include
FindFight;
in my AntiRandoms procedure. It wasn't found. Is there an alternative to this? Does "FindNormalRandoms" call this? It was included in Flame's tut.

3) Like "2)" except with
FindLamp;
. Same questions. I ended up removing the AntiRandoms procedure entirely.

3) Did I call
FindNormalRandoms;
correctly? Sin's tutorial: "[TUT]Calling FindNormalRandoms Correctly!" indicates that I didn't. However I don't fully comprehend why Sin's version is correct and what it does.

Code compiles. I sat it at the mine south of the legends guild. It right clicked about 10 times until it found the rock which it then mined. It continued to mine the depleted rock :)

Script:
program CheapMiner;

{$DEFINE SMART8}
{$DEFINE SMART}
{$I SRL-OSR/SRL.Simba}

//Creds to Torrent of Flame. I followed his powerminer tutorial


const
RockColor1= 1976128;
RockColor2= 2700888;
OreColorIron= 2305869;

var
x, y, Tries: Integer;

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

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

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(63) of
1: HoverSkill('random', False);
2: RandomMovement;
3: PickUpMouse;
4: RandomRClick;
5: BoredHuman;
6: ExamineInv;
7: RandomTab(True);
8: HoverSkill('mining', False);
9: Wait(2394 + Random(4829));
end;
end;

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

procedure DropInv;
begin
if FindObjCustom(x, y, ['Ore'], [OreColorIron], 7) then
DropAllExcept([1]);
end;

begin
SetupSRL;
DeclarePlayers;
LogInPlayer;
repeat
MineRocks;
DropInv;
AntiBan;
until (False)
end.

Any tips/tutorials/ways to learn to code are appreciated. I have a lot of trouble finding something to make with the tutorials available.

Thanks

Kyle

2013-12-11 15:00:01

Well Ok I will try and break it down.
First, on the calling the randoms, you should be able to just call FindNormalRandoms, but in all honestly so few randoms are actually working atm it usually won't pick them up and in my experience will just go out of range if a random is found. Seeing as you edited your post with it now working, i'm glad you figured out that you need to have a begin and end on each of the cases. It looks good for your first script, I would just suggest looking at other peoples scripts and read more tutorials. The next thing that you will want to learn about is using Auto Color and TPA's. The latter will completely change the way that your scripts run.
Pm me if you have any questions or need anything!

Ender

2013-12-11 17:28:46

Thanks a lot elfyyy. I'll definitely check out those tuts. I'm looking at pascal tutorials as well. I appreciate your offer for help in the future!

All the best!

Max

2013-12-15 02:32:37

Good try man trying to make one atm myself