SRL Archive - OSR Help

My first script (Feedback Aprreciated)


funnyman9292

2015-04-01 11:44:40

Hey all,

With the generous help of you folks and resources I made a simple powerminer. I had it run for an hour last night no problem, probably because the script is really simple. There's a few things I'm looking to add to it but I'm not sure how to go about it.

Want to add: Banking, Proggie, Walking (How do you identify tiles?, Antiban, Compass movement, and worldhop when it gets too busy.

Now you guys don't have to show me how to do all these things, but if you could kindly link me a few OSRS reflectrion scripts that could help me (so I can learn), would be appreciated.

Feedback is always appreciated, feel free to use it. Cheers!
 program LetsTryToMine;
{$DEFINE SMART}
{$DEFINE WALKER}

{$i AeroLib/AeroLib.Simba}
{$i Reflection/Reflection.simba}

var MyPlayer: TReflectLocalPlayer;
Oremined: Integer;
NumOfLoops: Integer;
procedure DeclarePlayers;
begin
MyPlayer.Username := 'Zezima';
MyPlayer.Password := 'WRATH OF THE GODS';
MyPlayer.Pin := '';
MyPlayer.Active := True;
MyPlayer.Login;
end;

procedure DropMyOre;
var
tempInt : Integer;
coppa : tstringArray;
//Want to add antiban and compass movement here
begin
coppa := ['Copper ore']; //Can't figure out how to only drop copper, ex. I get gems
Oremined+= reflect.Inv.Count();
reflect.Inv.DropAll();
Writeln('You have mined ' + IntToStr(Oremined) + ' Copper');
NumOfLoops+=1;
//reflect.KeyBoard.TypeSend('Mining is so boring',True);
end;

procedure FindCopperOre;
var
AllObjects: TReflectObjectArray;
OurObject: TReflectObject;
CoreLoc: Tpoint;
begin
AllObjects.GetAll(objGame, 20); //Loads all game objects within 20 tiles
AllObjects.Get(objGame, 'Rocks', 20);// Loads all 'Rock's within 20 tiles
while Reflect.Inv.IsFull() = false do
begin
if(OurObject.Find(objGame, random(14884,14886), 10)) then //Picks nearest copper ore randomly, this can be done because they all practically have same rock ID
begin
CoreLoc :=OurObject.GetMSPoint();
reflect.Mouse.Move(CoreLoc,5,5);
wait (random(100,300));
Reflect.Mouse.Click(1);
Myplayer.WaitForAnimation(100,2000);
if Myplayer.IsAnimating() then
Myplayer.WaitWhileAnimating(100,random(10000,20000)) //Put in b/c script was being impatient
end;
Writeln(reflect.Inv.Count());
end;
DropMyOre;
end;



begin
initAL();
Reflect.Setup;
DeclarePlayers;
repeat FindCopperOre;
until NumofLoops > 5; //Adjust # of loads
Myplayer.Logout();

end.

Zace

2015-04-06 09:37:53

To only drop copper you want to turn it into a DTM from your inventory and have it select that DTM to drop and should leave whatever doesn't match, not sure if reflection has any commands for that.
Also hope this answers the walking questions https://villavu.com/forum/showthread.php?t=64891&highlight=path
As far as world hopping i'm not to sure i know people use the AeroLib for controlling world selection, IDK about hopping tho.

funnyman9292

2015-04-08 09:37:06

Thanks for the thread link Zace, I'll look into it later. As for the copper drop, I changed the way the script goes about doing it. I'll post it later, it's on a different computer.

rj

2015-04-08 10:34:24

Just a tip you should do


AllObjects.Get(objGame, 'Rocks', 20);// Loads all 'Rock's within 20 tiles

Instead of
AllObjects.GetAll(objGame, 20); //Loads all game objects within 20 tiles
AllObjects.Get(objGame, 'Rocks', 20);// Loads all 'Rock's within 20 tiles

The second line is overrides the first line anyway, it's just spending time getting data that will never be used. The second line does the exact same thing as the first line, except it filters out all the objects that aren't named Rock (it regathers all the objects again lol)

funnyman9292

2015-04-08 10:52:49

So this is my method to drop copper ore, the issue is that I have to put in wait() because it'll try to drop the same ore twice if I don't. Any way of avoiding this issue?
 procedure DropMyOre;
var
tempInt : Integer;
coppa : tstringArray;

begin
coppa := ['Copper ore'];
while reflect.Inv.Contains(coppa) do
begin
reflect.Inv.Drop(436); //Slow method but prevents script from trying to drop same ore twice
wait(500 + random(150,200));
Oremined+=1;
end;
Writeln('You have mined ' + IntToStr(Oremined) + ' Copper');
NumOfLoops+=1;
end;

rj thanks for the tip, I took it straight from a tutorial and I wasn't sure. I'm also working on an antiban but it's pretty buggy at the moment. For example, boredhuman; takes 10 or so seconds to run, which is counter intuitive for a powerminer. Is there anyway I can break out of the function once ore has been mined? I can identify when a rock has been mined, for its ID changes, but don't know how to implement it
procedure antiban;
begin
//Writeln('Antiban');
if random(1,10) >= 9 then
begin
Writeln('Running bored human...');
//boredhuman; This function takes a while to run, and I can't find a way to break out of it once i'm finished mining
Writeln('Running humanRandomMouse');
humanRandomMouse;
end;
if random(1,10) >= 9 then
Writeln('Running compassMovement(0,100,true)');
compassMovement(0,100,true)
end;

Thanks for the help guys!