Log in

View Full Version : How To Right Click NPC's and Choose An Option?



jbrauman
06-27-2007, 06:59 AM
Basically what the Title says. I have used RadialWalk and FindSymbol to get to inside the shop, and FindObj to find the position of the ShopKeeper, but how do I get Scar to right click on the shop keeper and select a specified option from the list? (E.g 'Trade')

Thanks

-jbrauman

Markus
06-27-2007, 07:10 AM
First you need to right click.
You can click left with Mouse but right too:

Mouse(x-coord, y-coord, ranx, rany, false);

If the last argument is true, it will click left. If it is false (like now), it will click right.
Now you only need to choose the right option from the menu:

chooseoptionex('WhatYouWantToClickHere');

And there you go, it will right click and choose the option.

jbrauman
06-27-2007, 07:32 AM
Thanks... I keep getting a 'type mismatch' error though... Can you take a look at my script?
program New;
{.include SRL/SRL.scar}
{Start At Varrock East Bank
Walk To General Store
Buy Buckets / Pots Until Inventory Is Full
If There are no more log out and switch worlds
Walk back to bank and deposit
repeat.}
const
PotColor = 1591209;
ShopKeeperColor = 1198988;
ShopAssistantColor = 4568254;
var
i: Integer;
StartTime: Integer;

begin
////
i := 0;
StartTime := 0;
SymbolAccuracy := 0.6;
SetupSRL;
ClearDebug;
ActivateClient;
////

Wait(1000 + random(100));
MakeCompass('N');
Wait(100 + random(200));
HighestAngle;
RadialRoadWalk(FindVarrockRoadColor, 285, 310, 60, 0, 0);
FFlag(3);
Wait(200 + random(300));
RadialRoadWalk(FindVarrockRoadColor, 249, 257, 70, -10, 0);
FFlag(3);
Wait(200 + random(300));

MarkTime(StartTime); //Mark the time.
repeat
Wait(50 + random(100));
until((FindSymbol(x, y, 'shop')) or (TimeFromMark(StartTime) >= 15000)) //Wait until it finds the shop, or 15 seconds have elapsed.
if(TimeFromMark(StartTime) >= 15000) then
begin
Writeln('ERROR COULDNT FIND STORE');
TerminateScript;
end;
Mouse(x, y, 5, 5, True);
Flag;
Writeln('FOUND THE STORE');

//Find The Shop Keeper or the Shop Assistant
MarkTime(StartTime);
repeat
Wait(200 + random(300));
case Random(1) of
0: FindObj(x, y,'eepe', ShopKeeperColor, 5);
1: FindObj(x, y,'ssis', ShopAssistantColor, 5);
end;
Mouse(x, y, 0, 0, False);
until(ChooseOptionEx('rade') or TimeFromMark(StartTime) >= 15000);
if(TimeFromMark(StartTime) >= 15000) then
begin
Writeln('ERROR COULDNT OPEN SHOP');
TerminateScript;
end;
end.

Thanks

Markus
06-27-2007, 08:15 AM
It is a pretty easy error.
At line 60, replace this line:

until(ChooseOptionEx('rade') or TimeFromMark(StartTime) >= 15000);

with this one:

until(ChooseOptionEx('rade') or (TimeFromMark(StartTime) >= 15000));

Notice the ( and the ) I added at TimeFromMark

jbrauman
06-27-2007, 08:23 AM
Thanks, it was bugging me.
-jbrauman

Pancakes
06-29-2007, 02:35 PM
Mouse(x, y, 0, 0, False);
Wait(200 + random(100);
ChooseOptionEx('rade');