SRL Archive - RuneScape Private-Server Scripts

Help with script


henryuscola

2015-02-23 01:24:18

Hi, I'm having trouble making a basic woodcutting script for an rsps my script compiles sucessfully however it does not click on the tree even with the color selected

heres what i have so far

program YewCutter;
{$I SRL-6/SRL.simba}

Procedure ChopYew;
var
X,Y:Integer;
Begin
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
wait(250);
ClickMouse(X, Y, mouse_left)
end;
begin
MouseSpeed := 15;
End.

cosmasjdz

2015-02-23 02:44:03

From: henryuscola
Hi, I'm having trouble making a basic woodcutting script for an rsps my script compiles sucessfully however it does not click on the tree even with the color selected

heres what i have so far

program YewCutter;
{$I SRL-6/SRL.simba}

Procedure ChopYew;
var
X,Y:Integer;
Begin
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
wait(250);
ClickMouse(X, Y, mouse_left)
end;
begin
MouseSpeed := 15;
End.


You not calling ChopYew procedure. Try this:

program YewCutter;
{$I SRL-6/SRL.simba}

Procedure ChopYew;
var
X,Y:Integer;
Begin
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
begin
wait(250);
ClickMouse(X, Y, mouse_left);
end
else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if tree not found.
end;
begin
MouseSpeed := 15;
ChopYew(); // <- basicly missed this line
end.

henryuscola

2015-02-23 08:25:41

Hello, so far the script compiles successfully but it cant seem to find the color and the script ends.
this is what it says in the debug;

– TRSMainscreen.findObject()
—- No colors found
– TRSMainscreen.findObject(): False
tree not found
Successfully executed.

cosmasjdz

2015-02-23 08:43:24

From: henryuscola
Hello, so far the script compiles successfully but it cant seem to find the color and the script ends.
this is what it says in the debug;

– TRSMainscreen.findObject()
—- No colors found
– TRSMainscreen.findObject(): False
tree not found
Successfully executed.


Aparently either you didnt dragged simba cursor called select screen to your game window or/and colors bad especially when debug says no colors found :D

henryuscola

2015-02-23 08:56:39

Thank you for your help is there a way i could make it search for the tree colors without the script stopping? like have it on a repeat loop until i manually stop the script

Flight

2015-02-23 09:07:26

Unsure about SRL6 but here's a way to do a loop X amount of times, or until the desired task was completed successfully:

program YewCutter;
{$I SRL-6/SRL.simba}

Function ChopYew(): Boolean;
var
X,Y:Integer;
Begin
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
begin
writeln('Found the Yew tree');
wait(250);
ClickMouse(X, Y, mouse_left);
rexult := true;
end else
writeln('Tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if tree not found.
end;

var
i : Integer;

begin
MouseSpeed := 15;

for i:=0 to 4 do // Loop 5 times [0,1,2,3,4]
if ChopYew() then
break; // Successfully chopped a Yew tree so break the loop
end.

cosmasjdz

2015-02-23 09:08:53

From: henryuscola
Thank you for your help is there a way i could make it search for the tree colors without the script stopping? like have it on a repeat loop until i manually stop the script


Yes.

program YewCutter;
{$I SRL-6/SRL.simba}

Procedure ChopYew;
var
X,Y:Integer;
Begin
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
begin
wait(250);
ClickMouse(X, Y, mouse_left);
end
else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if tree not found.
end;
begin
MouseSpeed := 15;
repeat
ChopYew();
until false;
end.

This repeats searching tree untill you stop script.

or you might do it repeat untill it clicks tree:

program YewCutter;
{$I SRL-6/SRL.simba}

function ChopYew(): boolean;
var
X,Y:Integer;
Begin
result:=false;
if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
begin
wait(250);
ClickMouse(X, Y, mouse_left);
result:=true; // returns true if found and clicked on tree so loop can stop itself.
end
else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if tree not found.
end;
begin
MouseSpeed := 15;
repeat
wait(100); // waits few ms before trying again
until ChopYew();
end.

henryuscola

2015-03-02 02:06:16

Thank you all for the help I have so far made the script run on a loop searching for the yew trees.