Log in

View Full Version : Problem trading with shop keeper



chamilton
06-18-2007, 01:01 AM
in my script it says

FindObj ( x, y, 'Shop', Store_Owner, 10 );
GetMousePos ( x, y );
Mouse( x, y, 0, 0, False )
Until ( ChooseOption ( x, y, 'Trade' ) )

but instead of trading with the shopkeeper, it randomly chooses any other trade option and tries to trade with other people... any idea how to make it trade with just shopkeeper?

x13om13e12x
06-18-2007, 01:58 AM
in my script it says

FindObj ( x, y, 'Shop', Store_Owner, 10 );
GetMousePos ( x, y );
Mouse( x, y, 0, 0, False )
Until ( ChooseOption ( x, y, 'Trade' ) )

but instead of trading with the shopkeeper, it randomly chooses any other trade option and tries to trade with other people... any idea how to make it trade with just shopkeeper?

that was of finding the shop owner seems prone for errors. Im kind of new with scripting but i would try getting a unique color from the shop keeper's clothing, and then use FindColorTolerant(x,y,ColorofClothing,MSX1,MSY1,MS X2,MSY2,Tolerance);
Also im not familiar with GetMousePos(x,y) but i dont think it moves the mouse, and that is diffenetly not human like and would ban you. so i would use MMouse(x,y,1,1)

And lastly, i think is really wierd is that your using a repeat loop in which has
until ChooseOption
When you use Repeat and until, you would say repeat yadayada until soemthing equals something, or a boolean, not a command. so that part of the code does not make scence.
So the code i would write is

Begin
FindColorTolerance(x,y,color,MSX1,MSY1,MSX2,MSY2,3 );
if(not(FindColorTolerance(x,y,color,MSX1,MSY1,MSX2 ,MSY2,3))) then
begin
Tries:=0;
repeat
Wait(400 + random(50));
Tries := Tries + 1;
If Tries=20 then
Begin
Writeln('Cant find ShopKeeper');
NextPlayer(false);
end;
until FindColorTolerance(x,y,color,MSX1,MSY1,MSX2,MSY2,3 );
MMouse(x,y,3,3);
Mouse(x,y,2,2,false);
flag;
wait(387 + random(154));
ChooseOption(x,y,'Trade');
end;
end;


The extra stuff i added was failsafes, which i can't explain, you should learn it in TUTs
and make sure to Assign Tries as an integer with the code Tries: Integer; somewhere in your script.
Hope i helped some

chamilton
06-18-2007, 12:01 PM
it workes finding the shopkeeper, its the trading part that doesnt work. as soon as it right-clicks, it randomly chooses one of the trade options and trys to trade with players since they are all standing around shopkeeper so when you right-click they show up too.

FindObj ( x, y, 'Shop', Store_Owner, 10 );
GetMousePos ( x, y );
Mouse( x, y, 0, 0, False )
Until ( ChooseOption ( x, y, 'Trade' ) )


and also, the GetMousPos sets the coordinates to click on, if you just leave in (x,y)