SRL Archive - OSR Help

first script (rsps)


ProJoe

2013-01-04 01:48:18

This is my first script. I'm making it for a rsps, so a lot of the includes and tools don't work for me. just trying to do, what I think should be a simple task, is becoming very difficult. So it isn't working right and I would love some help.
Heres the code

program MageChopper; // this is my first script ever \\
{$i srl/srl.simba} // and inteded for a rsps \\

procedure chop;
var x, y: integer;
var x1, y1: integer;
var x2, y2: integer;

begin
repeat
if FindColorTolerance(x1, y1, 13826296 , 1, 1, 514, 337, 3) and
FindColorTolerance(x2, y2, 12829954 , 84, 8, 150, 18, 3) then
begin
MoveMouse(x1, y1);
Wait(500+random(217));
ClickMouse(x1, y1, 1);
Wait(520+random(132));
end;
until FindColorTolerance(x, y, 65536 , 686, 433, 726, 459, 3)
end;

procedure drop;
begin
SendKeys('::empty', 100, 30);
pressKey(13)
end;

begin
SetUpSRL;
repeat
begin
chop;
drop;
end;
until(false);
end.

The script compiles fine, and I feel like, in theory it should work. Unfortunately when I run the script it seems to only do the drop procedure.

Please, constructive criticism only. I know its probably sloppy or I might be doing something completely idiotic. Just keep in mind this is my first bit of coding ever.

xdarkshadowx

2013-01-04 02:03:52

you only need var once, like..

var
x,y,y1,y2,x1,x2: integer;

if the chop function isn't working, try setting the tolerance to ten or maybe fifteen. And you might want to only have one condition for the if statement at the beginning of chop, unless both are necessary.

Basically: get the chop function to click on the screen first, after you verify it clicks, then start restricting where it'll click until it'll only click where you want it to. Cause if it's not clicking anywhere you have too many restrictions, or non functional restrictions.

ProJoe

2013-01-04 02:58:45

I appreciate the reply xdarkshadowx. I tried adjusting the tol. I was able to get it to clock on the screen. but I ran into a problem I encountered before, which is that the script sometimes clicks when the mouse isnt on the tree. I would like to implement a check to see if the mouse is over the tree(thats what the 2nd if-then statement was supposed to be). I will review some more tuts and hit it hard again tomorrow.

xdarkshadowx

2013-01-04 03:11:44

Is the color of the tree visible elsewhere? once you get better at scripting you can start including some of the harder functions, some from the wizzy plug-in would work quite well for locating trees I think. You also might want to open up some other tree-finding scripts to get an idea of how they did it.
Feel free to PM me if you have any trouble, best of luck in your coding!