SRL Archive - OSR Help

Failsafe wont work whats wrong?


Sable

2013-05-08 08:17:40

Question : Why wont it click the X of the shop when it sees the colors of the mystic robe top?
info;
this is a procedure for finding a shop owner. but rarely sometimes it trades another shop and it will keep finding the shopowner(which the bot obviously wont find in a opened shop) untill he sees the color of the nature rune.
now i added a item from the wrong shop and said if it found those colors of the item it will close the shop;
if FindObjCustom(x,y, ['alue Mystic robe top', badItemName1], [badItemColor_1, badItemColor_2, badItemColor_3],2) then
begin
writeln('could not find the right trader, trying again')
MMouse(487, 41,0,0);
ClickMouse2(MOUSE_LEFT);
end;
end;


procedure findOwner;
var c1, c2, x, y : integer;
tpa: TPointArray;
begin
MakeCompass(randomrange(0,100));
begin
repeat
if FindObjCustom(c1, c2, ['alk-to', ownerName], [ownerColor_1, ownerColor_2, ownerColor_3, ownerColor_4, ownerColor_5, ownerColor_6], 5) then
MouseBox(c1,c2,c1+4,c2+4,mouse_right);
ClickMouse2(mouse_right);
wait(RandomRange(40,100));
ChooseOptionMulti (['Trade']);
wait(2000 + randomrange(580,1280));
until(FindObjCustom(x,y, ['alue Nature', itemName], [itemColor_1, itemColor_2],5))
wait(randomrange(100,400));
if FindObjCustom(x,y, ['alue Mystic robe top', badItemName1], [badItemColor_1, badItemColor_2, badItemColor_3],2) then
begin
writeln('could not find the right trader, trying again')
MMouse(487, 41,0,0);
ClickMouse2(MOUSE_LEFT);
end;
end;
end;

xtrapsp

2013-05-08 08:36:54

Before we go anywhere else I'd love it if you could put it into simba tags and add some standards :P

Other than that, I can make some suggestions to make the overall project easier.

Move away from FindObj and read up on TPA's. Plenty of tutorials about

Mousebox is good and all, but is it necessary?

Sable

2013-05-08 09:13:23

Do you also have an answer for my problem? Il figure out TPAs soon enough but currently i need my script to work properly.

dzpliu

2013-05-08 09:29:36

if FindObjCustom(x,y, ['alue Mystic robe top', badItemName1], [badItemColor_1, badItemColor_2, badItemColor_3],2) then
begin
writeln('could not find the right trader, trying again')
MMouse(487, 41,0,0); //wat is x and y for when u already put in the mouse values?
ClickMouse2(MOUSE_LEFT);
end;
end;


procedure findOwner;
var c1, c2, x, y : integer;
tpa: TPointArray;
begin
MakeCompass(randomrange(0,100));
begin
repeat
if FindObjCustom(c1, c2, ['alk-to', ownerName], [ownerColor_1, ownerColor_2, ownerColor_3, ownerColor_4, ownerColor_5, ownerColor_6], 5) then
MouseBox(c1,c2,c1+4,c2+4,mouse_right);
ClickMouse2(mouse_right);
wait(RandomRange(40,100));
ChooseOptionMulti (['Trade']);
wait(2000 + randomrange(580,1280));
until(FindObjCustom(x,y, ['alue Nature', itemName], [itemColor_1, itemColor_2],5))
wait(randomrange(100,400));
if FindObjCustom(x,y, ['alue Mystic robe top', badItemName1], [badItemColor_1, badItemColor_2, badItemColor_3],2) then
begin
writeln('could not find the right trader, trying again')
MMouse(487, 41,0,0);
ClickMouse2(MOUSE_LEFT);
end;
end;
end;

can u post the entire script? lol this is quite messy

Sable

2013-05-08 09:43:13

why would i need to post the script? isn't this all you need?

Hoodz

2013-05-08 12:46:46

dont put long names. use like: ystic

Kevin

2013-05-08 13:04:52

The length of your variable names doesn't affect anything, do whatever you feel like as far as that is concerned so long as it remains readable. :)

However as for why it doesn't work… It's supposed to find the Mystic robes in the second shop to know it's in the wrong one, correct?:
FindObjCustom(x,y, ['alue Mystic robe top', badItemName1], [badItemColor_1, badItemColor_2, badItemColor_3],2)
Does it even highlight the top, or does it do nothing?