i just started my first script and i don't know what's wrong.
i just started my first script and i don't know what's wrong.
And in turn:PHP Code:if FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7) then
repeat
case (Random(2)) of
1: begin
Mouse(x, y, 4, 4,false);
ChooseOption('hop');
end;
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
And also, I'm pretty sure Random() can start at 0, so your cases should start at 0? Or just make it:PHP Code:if FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7) then
repeat
case (Random(2)) of
1: begin
Mouse(x, y, 4, 4,false);
ChooseOption('dow');
end;
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
case (1+Random(1)) of
Last edited by code841; 10-27-2009 at 01:09 PM.
You made a mistake with the case(random(2)) thing.
andCode:case (Random(2)) of 1: begin Mouse(x, y, 4, 4,false); ChooseOption('hop'); end; 2: Mouse(x, y, 4, 4, True); end;
The problem is that after : the scripts expects only one command, like Mouse(x, y, 4, 4, True);. You entered 2 command: Mouse(); and ChooseOption();. So you have to put it between begin and end tags.Code:case (Random(2)) of 1: begin Mouse(x, y, 4, 4,false); ChooseOption('dow'); end; 2: Mouse(x, y, 4, 4, True); end;
E: code was just a few seconds faster
And I can't find the DropTo(2,28); function but maybe my SRL is outdated...
Last edited by masterBB; 10-27-2009 at 01:14 PM.
On your case in cutwillow procedure you should change the numbers to 0 and 1 because random(2) outputs a random number between 0 and 1 (hence the 2 which is the the number of possible values).
And, as pointed out already, you must put a begin and end nest in the first case statement because of there being more than one procedure/function performed.
Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
Originally Posted by #srl
"A programmer is just a tool which converts caffeine into code"
ToSCAR Code:if FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7) then
repeat
case (Random(2)) of
1: begin
Mouse(x, y, 4, 4,false);
ChooseOption('dow');
end;
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
SCAR Code:if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
repeat
case (Random(2)) of
0 :
begin
Mouse(x, y, 4, 4, False);
Wait(100 + Random(200));
ChooseOption('dow');
end;
1 : Mouse(x, y, 4, 4, True);
end;
until(InvFull);
The other people were right, but you also needed a Wait after right clicking. Not bad for a first script tho, keep it up
~Camo
Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
{ MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }
When posting a bug, please post debug! Help us, help you!
I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.
SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.
thank you guys you are best. now my cutter cuts and dropsbut he chops only one tree. only one. what's wrong? it's something with mouse?
What does he do after he drops the logs? Does he just stand there? What is the mouse doing?
~Camo
Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
{ MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }
When posting a bug, please post debug! Help us, help you!
I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.
SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.
he cutt tree but only one. only one. not finding other trees. just waiting till same tree up again it's bad with colors?
you can try
const
willowcolor1= 4683362;
willowcolor2= 2444868;
logcolor1= 1325891;
logcolor2= 1391941;
var
x, y, i, Tries: integer;
procedure cuttwillow;
begin
if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
repeat
case (Random(1)) of
0 :
begin
Wait(8000 + Random(200));
Mouse(x, y, 4, 4, False);
ChooseOption('dow');
end;
1 : Mouse(x, y, 4, 4, True);
end;
until(InvFull);
end;
Procedure Droplogs;
begin
if FindObjCustom(x, y, ['log'], [logcolor1, logcolor2], 7) then
for i := 2 to 28 do
dropItem(i);
end;
begin
SetupSRL;
repeat
cuttwillow;
Droplogs;
until (False)
end.
should be:Code:begin SetupSRL; repeat cuttwillow; Droplogs; AntiBan; until (False) end.
And this repeat is wrong:Code:begin SetupSRL; repeat repeat cuttwillow; until(InvFull) Droplogs; AntiBan; until (False) end.
you should remove that repeat ... until (InvFull) partCode:repeat case (Random(2)) of 0: begin Mouse(x, y, 4, 4,false); ChooseOption('hop'); end; 1: Mouse(x, y, 4, 4, True); end; until (InvFull)
Last edited by masterBB; 10-27-2009 at 02:39 PM.
That's what I try to say... you should repeat the cutWillow function, so it search again after chopping, not just the clicking part.
And where in your script you wait for the tree to be down?
Last edited by masterBB; 10-27-2009 at 02:43 PM.
No he needs to change his CutWillow function, it's repeating the mouse actions until inventory is full.
Edit: Opps you editted it in your post :/
om i'm deleted until (fullinv) and it says
Line 26: [Error] (20606:1): Identifier expected in script
You still need an until statement if you have a repeat statement.
ok so my script looks like that
{.include SRL/SRL.scar}
const
willowcolor1= 4683362;
willowcolor2= 2444868;
logcolor1= 1325891;
logcolor2= 1391941;
var
x, y, i, Tries: integer;
procedure cuttwillow;
begin
if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
repeat
case (Random(1)) of
0: begin Mouse(x, y, 4, 4,false);
ChooseOption('hop');
wait(5000+random(800));
1: Mouse(x, y, 4, 4, True);
end.
until
end;
Procedure Droplogs;
begin
if FindObjCustom(x, y, ['log'], [logcolor1, logcolor2], 7) then
for i := 2 to 28 do
dropItem(i);
end;
begin
SetupSRL;
repeat
repeat
cuttwillow;
until(InvFull)
Droplogs;
until (False)
end.
can someone fix it or help how to fix?
Your case in CutWillows need to be Random(2) or more.
Correct code:
SCAR Code:procedure cuttwillow;
begin
if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
begin
//repeat - remove this line
case (Random(2)) of
0: begin
Mouse(x, y, 4, 4,false);
wait(300+random(200)); //- it can take some time for rs to show the option menu
ChooseOption('hop');
wait(5000+random(800));
end; //- every begin needs an end!
1: begin
Mouse(x, y, 4, 4, True);
wait(5000+random(800));
end;
end;
end;
SCAR Code:begin
SetupSRL;
repeat
repeat
cuttwillow;
until(InvFull)
Droplogs;
until (False)
end.
To explain why I use an extra repeat in the last piece of code:
- You want to cutt willow trees till your inventory is full.
- When your inv is full you want to drop them.
- So it only needs to execute the drop command if you inventory is full.
- So you will have to "repeat" "cutting willows" "until your inv is full.
Last edited by masterBB; 10-27-2009 at 07:26 PM. Reason: found an other bug
There are currently 1 users browsing this thread. (0 members and 1 guests)