SRL Archive - Script Requests

[PkHonor] Magic Tree Cutter Need Help with Random Event


schmidt73

2013-03-22 12:46:54

I would like to add a random event solver into my code, so I could cut magic trees essentially forever. There is no bank requires because on this private server whenever you cut down a tree instead of getting logs you get points. There is only one random event and it requires you to click on a portal and leave. It happens about once a hour and although my bot works well without it I would like to know how to solve a random event and it would help me to bot overnight.
program PkHonor;
{$i srl/srl.simba}

const
LOGS = 100;

Procedure ClickTree;
var
X,Y:Integer;
begin
repeat
if FindColorTolerance(X, Y, 14678264, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 12187896, 1, 5, 760, 502, 1)then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(10000+random(5000));
end;
until (LOGS > 100);
end;
Begin
SetupSRL;
MouseSpeed := 30;
ClickTree;
end.

Kevin

2013-03-22 12:54:36

Just add another FindColorTolerance that matches the color of the portal and click it when it's visible.

schmidt73

2013-03-22 15:08:53

How could i have it teleport back to the certain area if it goes there though?

schmidt73

2013-03-22 15:11:09

Ok, so its cutting trees it gets the random and the random teleports it to falador where there are no trees. Could I have a else statement returning me to the tree cutting area?

Kevin

2013-03-22 15:19:30

I didn't realise it could teleport you elsewhere in the world. You would have to have an else statement that somehow returned you to the tree cutting area.

schmidt73

2013-03-22 15:30:16

Yes I have the else statement but I have no idea how to have it teleport me back. Thanks!

Kevin

2013-03-22 15:33:46

I won't be able to help much without knowing what you're capable of on this server. I recommend some sort of teleport return if you can, or some method of transporting yourself to a known area, and walking from there.

schmidt73

2013-03-22 15:39:43

Well, there is a teleport in the magic book to get you there? Is it possible to click it?

Kevin

2013-03-22 15:46:02

If you have access to said magic and are capable of casting the spell, then I don't see why not? I recommend using DTMs to find spells to cast.

rj

2013-03-22 15:53:28

Can we see a pic of the portal?

schmidt73

2013-03-22 16:09:18

Here is full code works perfectly and tellies back! How could I make it not take over my mouse?
 program PkHonor;
{$i srl/srl.simba}

const
LOGS = 100;

Procedure ClickTree;
var
X,Y:Integer;
begin
repeat
if FindColorTolerance(X, Y, 14678264, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 12187896, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 11661552, 1, 5, 760, 502, 1) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(10000+random(5000));
KeyDown(39);
wait(RandomRange(50,100));
KeyUp(39);
end else
begin
KeyDown(39);
wait(RandomRange(100,200));
KeyUp(39);
wait(RandomRange(500,1000));
PressKey(118);
wait(500);
mmouse(648, 400, 1, 1);
wait(100)
ClickMouse(X, Y, mouse_Left);
wait(500);
mmouse(263, 447, 1, 1);
wait(100);
ClickMouse(X, Y, mouse_Left);
wait(10000);
end;
until (LOGS > 100);
end;

Begin
SetupSRL;
MouseSpeed := 30;
ClickTree;
end.


rj

2013-03-22 16:14:23

From: schmidt73
Here is full code works perfectly and tellies back! How could I make it not take over my mouse?
 program PkHonor;
{$i srl/srl.simba}

const
LOGS = 100;

Procedure ClickTree;
var
X,Y:Integer;
begin
repeat
if FindColorTolerance(X, Y, 14678264, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 12187896, 1, 5, 760, 502, 1) or
FindColorTolerance(X, Y, 11661552, 1, 5, 760, 502, 1) then
begin
mmouse(x, y,1,1);
wait(250);
ClickMouse(X, Y, mouse_Left)
wait(10000+random(5000));
KeyDown(39);
wait(RandomRange(50,100));
KeyUp(39);
end else
begin
KeyDown(39);
wait(RandomRange(100,200));
KeyUp(39);
wait(RandomRange(500,1000));
PressKey(118);
wait(500);
mmouse(648, 400, 1, 1);
wait(100)
ClickMouse(X, Y, mouse_Left);
wait(500);
mmouse(263, 447, 1, 1);
wait(100);
ClickMouse(X, Y, mouse_Left);
wait(10000);
end;
until (LOGS > 100);
end;

Begin
SetupSRL;
MouseSpeed := 30;
ClickTree;
end.



You would have to make massive edits to S.M.A.R.T which would require a lot of Java and Pascal knowledge OR you could use a virtual machine

ProJoe

2013-06-02 13:48:13

Using a virtual machine seems to be the most reasonable.. I have played the server before. I have a script that I used to use for magic logs, but I believe the random event was different. There was never a random that tellied me to fally, just bob the cat.