Log in

View Full Version : Mining help



apples
05-23-2007, 11:08 PM
Hi, I just started using SCAR and SRL, and I have a question. I wrote a simple mining script, but I dropped as soon as I picked up an item, and afterwards I would try to pick up the coal. I tried building in a safeguard so it wouldn't pick up the coal, and it worked, but the mouse would just jump around on the coal, and not move to a new rock. Here's my code.


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

const rockwait=2000;
const rockcolor=2570810;

procedure mine;
begin
if findcolorspiral(x,y,rockcolor,100,100,515,336) then
begin
mmouse(x,y,3,3)
if isUpText('Mine') = true then
begin
mouse(x,y,2,2,true)
wait(rockwait+random(300))
end;
end;
end;

Procedure drop;
begin
dropto(2,28);
end;

begin
SetupSRL;
repeat
drop;
repeat
mine;
until(invfull = true)
until(false)
end.


P.S. I added in tabs because I'm used to brackets in other languages :p

Hobbit
05-23-2007, 11:23 PM
I don't have time to test but try this. It's better not to put in capital letters for things when its searches for words, and I also moved the drop to after the mine so it's more efficient.

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

const rockwait=2000;
const rockcolor=2570810;

procedure mine;
begin
if findcolorspiral(x,y,rockcolor,100,100,515,336) then
begin
mmouse(x,y,3,3)
if isUpText('ine') = true then
begin
mouse(x,y,2,2,true)
wait(rockwait+random(300))
end;
end;
end;

Procedure drop;
begin
dropto(2,28);
end;

begin
SetupSRL;
repeat
repeat
mine;
until(invfull = true)
drop;
until(false)
end.

apples
05-27-2007, 05:04 PM
Thanks for the help, it worked for a while, but for some reason my script randomly stopped working. The mouse travels to the rock it wants to mine, but right before it clicks, it goes up to a point near the mini-map. I haven't modified the script from Hobbit's post. Any suggestions would be appreciated. :)

Noob Killa
05-27-2007, 07:00 PM
i am having probvlems becoming a srl member. any tips? thank you.

evilwalrus
05-27-2007, 08:38 PM
nice job on actually making a script and not using someone elses =b

apples
05-27-2007, 09:19 PM
well, it's not really working..so it's not that much of an achievement. ;)

geerhedd
05-27-2007, 10:24 PM
maybe a minute change in color for the rock or even a different tolerence will help stop the going to point near mm problem,(have you used scar to check for your rockcolor where it is going(near mm)) GL also much props on starting scripting for yourself instead of leeching,which with that amount of posts is most suprising

Hobbit
05-27-2007, 10:30 PM
program SimpleMine;
{.include SRL\SRL.scar}

const rockwait=2000;
const rockcolor=2570810;

procedure mine;
begin
if(FindColorSpiral(x,y,rockcolor,MSX1,MSY1,MSX2,MS Y2))then
begin
Mmouse(x,y,3,3):
if(isUpText('ine'))then
begin
Mouse(x,y,2,2,True);
Wait(rockwait+random(300));
end;
end;
end;

Procedure drop;
begin
DropToPosition(2,28);
end;

begin
SetupSRL;
repeat
repeat
mine;
until(InvFull)
drop;
until(IsFKeyDown(12))
end.

Here try it this time. I had time too look over it some more. It propably wasn't mining the rock because you missed the semi-colin after Mouse(x,y,2,2,True);. I also changed your FindColorSpiral coordinates to the preset SRL coords for the main rs screen. Lastly it's never good to have repeat until false, thats called and infinite loop, they aren't good. So I changed it so it will keep repeating until you press F12.


@Noob Killa
You need to make your own script and apply for it. Don't copy one because we WILL catch you.

evilwalrus
05-28-2007, 04:39 PM
tutorial