SRL Archive - OSR Help

Help with first script


the henhead

2013-01-29 13:59:08

I'm making a script for the RSPS soulplit, i'm having trouble, when I run this, it doesn't click the maple tree, but it hovers over it. If you can also help me I need to drop or firemake the logs. Thanks

program chopper;
{$I SRL/SRL.SIMBA}

procedure CutTree;
var
x, y: integer;
begin
if FindObjCustom(x, y, ['Chop down', 'Maple tree'], [10344, 26768, 8264], 7) or //This will have the script find an object of your choice
FindObj (x,y, 'Maple tree', 10344,10) or
FindObj (x,y, 'Maple tree', 26768,10) then
repeat
Mouse(x,y,0,0, true);
ChooseOption('Chop down');
wait(1500+random(1000)); // This will make the script wait for a certain time
until (InvFull);
end;

begin
SetupSRL;
MouseSpeed := 10; //Mouse speed
repeat
CutTree
until(false);
end.

Kevin

2013-01-29 14:03:58

Try changing
Mouse(x,y,0,0, true);
ChooseOption('Chop down');
to
 Mouse(x,y,0,0,false);//right click
Waitoption('Chop down', 200);//wait for it to load up to 200ms then select the option

Edit: Btw, I had Sjoe and Gucci correct me, I originally said WaitOptionMulti, and you want to use WaitOption for a single string.

Kevin

2013-01-29 14:08:34

As for dropping, I think this will work. Honestly, I'm writing this all in a browser and am not currently testing it.


procedure DropAll;
var
i: integer;
begin
for i:=0 to 28 do
begin
invmouse(i, mouse_right);//Command may be incorrect, but i think it is fine
WaitoptionMulti('rop ', 250);//To drop
end;
end;

the henhead

2013-01-29 14:12:21

It still does the same thing as before, it also doesn't right click.
I will try the dropping on a new project to test it.

Sjoe

2013-01-29 14:22:45

From: the henhead
It still does the same thing as before, it also doesn't right click.
I will try the dropping on a new project to test it.


Add some debug lines, so you know where your script cramps up.
Like this


if FindObjCustom(x, y, ['Chop down', 'Maple tree'], [10344, 26768, 8264], 7) then Writeln(' found the tree')

So u would know that the script did find it. if not, it means your colors are wrong or your uptext.

And I would change your uptext to strings of 3-4 letters example ['Cho'], ['hop'], ['dow'], ['aple']
(it's more precise)

EDIT: U don't need ChooseOption('Chop down'); (it works when you right click an object so it click the option Chop down).
But you are left clicking the tree.

bud_wis_er_420

2013-01-29 14:57:55

Here is the dropping function I use for my Pickpocket script. Your more than welcome to edit it as you need.

Function DropSeeds: Boolean;
var
i, lobby, x, y :integer;
iBox: TBox;
ItemsToKeep: TStringArray;
begin
//Lokes at each inv slot for items wanting to drop or not.
for i := 1 to 28 do
begin
//Below is a list of items to keep, add or remove as needed.
ItemsToKeep := ['Irit', 'wuar', 'antad', 'adant', 'napd', 'warf', 'ellst',
'vant', 'impw', 'orst', 'obst', 'anar', 'oadf', 'ater', 'traw'];
//Below is a DTM of a lobby, make your own for something else.
Lobby := DTMFromString('78DA63CC60626030616440054C601226CA580' +
'8E41B11505302E49B1150930DE4BB1350130BE45B1350530AE4DB' +
'E1570300EF310411');
iBox := InvBox(i);
//Below skips inv box if it finds a lobby. Anti ban,
// so mouse don't go to every inv slot. Looks more human like.
if not(FindDTm(lobby, x, y, iBox.x1, iBox.y1, iBox.x2, iBox.y2)) and ExistsItem(i) then
begin
InvMouse(i, 3);
//Check uptexts for list of items to keep.
if IsUpTextMultiCustom(ItemsToKeep) then
begin
Writeln('Keeping item');
end else
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false)
//Below double checks item name in the right click menu,
// incase reading uptext messes up
if OptionsExist(ItemsToKeep, false)then
begin
Writeln('Opps, I want to keep this item');
MMouse(200, 200, 100, 100);
Sleep(200+random(500));
end else
begin
Status('Dropping item');
ChooseOption('rop');
end;
end;
end;
end;
if not(InvFull) then
begin
writeln('Seeds droped');
result := true;
end else
begin
writeln('Inv full, no seeds to drop');
result := false;
FreeDTM(lobby);
end;
end;

Sjoe

2013-01-29 16:48:20

I noticed the leaves of the maple tree, doesn't give you the uptext Chop down, only the bark (center of the tree), try and lower your camera angle down?
There should be a more advanced method, that I'm not aware of myself.
Or try adding that Bark color in there too.

the henhead

2013-01-29 16:59:56

I did it so it clicks coordinates instead, it's working.

Justin

2013-01-29 17:14:53

I'm going to assume the private server isn't using the same font as RuneScape use (For uptext ect) therefor anything with 'option finding' isn't going to work (IsUpText, GetUpText, ChooseOption ect)