Log in

View Full Version : Mine until ore mined?



ilikegrapesoda72
03-20-2007, 02:01 AM
program GrapeSodaMine;
{.include SRL/SRL.scar}
var
j : integer;
//Procedures//

Procedure Mine;

begin
findcolorspiral(x,y,2108746,0,0,598,340);
MMouse(x,y,5,5);
Mouse(x,y,0,0,true);

repeat
wait(900+random(300));
Until(invcount=j);
j:= j + 1;
end;

begin
setupSRL;
repeat
mine;
until(false);
end.

As you can see I am trying to get it to click the iron rock and wait until the iron is mined. Doing so many inventory counts every like 500ms causes far to much lag, while if I do them not as frequent it makes a less efficient script.

How do you guys make the waits for the ore mined?

Edit: Yes I know there is alot of things you or I could say about this script, but please only the question ^-^

logik
03-20-2007, 03:27 AM
Well I may have just started scripting but I may know one answer and that is make a const where you can change time like this

program GrapeSodaMine;
{.include SRL/SRL.scar}
var
j : integer;

const
waittime = 7000; // amount of time in milliseconds (7000 = 7 seconds)

Procedure Mine;

begin
findcolorspiral(x,y,2108746,0,0,598,340);
MMouse(x,y,5,5);
Mouse(x,y,0,0,true);

repeat
Wait((waittime)+random(200));
Until(invcount=j);
j:= j + 1;
end;

begin
setupSRL;
repeat
mine;
until(false);
end.


I might have misunderstood with what you said because i have dyslexia but just in case i will make it appear as if you making a power miner too which is right here:

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

var
Load: Integer;

{_-_-_-_-_-_-SETUP-_-_-_-_-_-_}
const
Drops = 10;
TreeColor = 1464392;
waittime = 7000;

{_-_-_-_-_-_-MINING-_-_-_-_-_-_}
procedure Mine;
begin
repeat
if (FindMSColor(x,y,OreColor)) then
Mouse(x,y,2,2,true);
Wait((waittime)+random(200));
until(InvFull)
end;

{_-_-_-_-_-_-DROPPING-_-_-_-_-_-_}
procedure Drop;
begin
GameTab(4);
DropTo(1,28);
Load := Load + 1;
end;

{_-_-_-_-_-_-REPEATS THE PROCESS-_-_-_-_-_-_}
begin
SetupSRL;
repeat
ActivateClient;
Report;
Credz;
Mine;
Drop;
until(false)
end.


just look at that and maybe some tutorials I hope it helps but I might have messed up, i'm just trying to help a fellow scripter thats all

Bobarkinator
03-20-2007, 03:38 AM
you can use the inchat() function

repeat
Wait(1);
until(IsChat('anage'))

tarajunky
03-20-2007, 04:02 AM
You should probably use multiple criteria. One could be based on your inventory count, one based on 'you managed to mine some...', and one based on a maximum wait.

For the 'you manage to mine' text, you can either use InChat as was suggested earlier, or you can even use a simple GetColor(147,421)=0. That pixel is only black for that message and not the other mining ones (like 'no ore in the rock..' or 'you swing your pick...'). A getcolor is much faster than a text search.

BTW I use GetColor(167,423) = 0 for 'no ore in the rock' and GetColor(154, 417) = 0 for 'you swing your pick'. They work very well, and allow your script to 'know' what is currently going on much better if you check them as you go along.

ilikegrapesoda72
03-20-2007, 05:06 AM
Thanks guys, I will try to adsorb into me what your suggestions are. Also Logik, I don't want it to be based on a user input time for the ore. I would like it to be based on re-mining when it retrieves the ore. I may have to resort to that if it gets to laggy or some random problem.

Edit: Hmm.. I like the multi-criteria idea, I'll see what I come up with :D

XcanadamanX
03-20-2007, 07:51 PM
you can also look in a 20 x 20 square to see if the color you picked is still there.

n3ss3s
03-21-2007, 01:40 PM
My clarion v0.6(not published yet) has a rockexists:boolean function.
It is more useful than a checker for inv count to be invcount+1.
That is because on a crowded world someone else may catch your rock,your script is waiting for invcount to be +1 and 1.a you timeoutlogout and the script may crash if not so advanced. 2. if your mining procedure doesnt include antibans and antirandoms you may get banned. i hope i helped

Dark_Sniper
03-21-2007, 01:56 PM
my guild miner io was making did everything in check points..

waited till seen 'wing' on chat...

if not it timed out.


then it checked for a broken pic... then went into a repeat with antirandoms in it.. with waits... until it found 'man'... click to continue (lvled up) .... until it finds the no ore col... or times out... then checks if its full.... and so on :p

make sure to include fails safes and alternitaves to everything.

JuKKa
03-21-2007, 02:10 PM
heres a function i wrote a while ago .. i have never used it but i know it works

HERE:



Function UntilMined(Time : integer) : boolean;
var timer: integer;
begin
status('waiting for pick swing')
if FindText(x,y,'You swing your',SmallChars,20, 415,152,431)then
begin
marktime(Timer);
status('waiting for ore')
repeat
wait(1000+random(1000))
until FindText(x,y,'You get some',SmallChars,20, 415,152,431)or
(timefrommark(Timer)>Time);
writeln('Finnished mining')
end;
end;


atleast this works for wood cutting im not sure about mining, u might have to change the string, if u know what i mean..

ilikegrapesoda72
03-22-2007, 02:40 AM
Thanks JuKKa, will be sure to include you as the creditor to the function if I use it (probably will). I'm going to try to add some findfastrandoms in there while it waiting for efficiency.

JuKKa
03-22-2007, 06:16 AM
good to hear that u will use it :rolleyes: remember to credit mee :D

and good idea to add findfastrandoms.

rkroxpunk
03-22-2007, 11:21 AM
Finally some straight answers! i've been asking this for ages and get crazy confusing answers. @ jukka can you show me what to put in main loop for your thing because no matter what i do i can't get it lol. will give credits if i can use:spot:

n3ss3s
03-22-2007, 07:47 PM
Jukka toi on parempi ku mun! :D
Leechaus lupa?