SRL Archive - OSR Help

Help with ChooseOption function


ne lg

2012-06-03 16:27:43

Hi, im making my very first script which is pickpocketing pickpocketers in the pickpocketing guild :D :spot:

However, when i'm using the chooseoption function built into SRL it chooses talk-to instead of pickpocket?

I change it to Cheak-points and it managed to click that, just not the pickpocket option,

Now im wondering is it because the string of the NPC's name is the same as the string for the option?

Any help appreciated!

litoris

2012-06-03 16:30:10

If you just search for something like "ick", it will click the first option or something because that phrase exists in all options. User WaitOption instead(so that you don't have to add a separate wait) and look for "ick P", which should choose the appropriate option. There is a script made for there BTW, you could always check that one to see how its author managed certain things.

ne lg

2012-06-03 16:58:16

From: litoris
If you just search for something like "ick", it will click the first option or something because that phrase exists in all options. User WaitOption instead(so that you don't have to add a separate wait) and look for "ick P", which should choose the appropriate option. There is a script made for there BTW, you could always check that one to see how its author managed certain things.


I've tried using both WaitOption and ChooseOption, both dont work for pickpocketing option, but i changed to try for another option(not the first one) and it picked that, so it's defently somthing to do with the NPC name has the same string as the option.

I tried looking at flights script but instantly closed it off, far to complex for me, literally couldn't understand what was going on,

This is my first attempt at a script and only know the absolute basics.

Heres the script so far xD :


program Pickpocketer;
{$DEFINE SMART}
{.include SRL\SRL.simba}


const
BreakEvery='180';
BreakFor= '6';
StartPlayer= 0;
NumbOfPlayers=1;



procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;

end;

end;


Function Pickpocket_The_Pickpocketers:Boolean;
var
X, Y: Integer;
begin
if (FindObjCustom(X,Y,['Pickpocketing'],[8304356], 10)) then
begin;
Mouse(X,Y,5,5,false);
WaitOption('ickp',500);
end else
if (FindObjCustom(X,Y,['Pickpocketing'],[6458544], 10)) then
begin;
Mouse(X,Y,5,5,false);
WaitOption('ickp',500);
end else
if (FindObjCustom(X,Y,['Pickpocketing'],[8433383], 10)) then
begin;
Mouse(X,Y,5,5,false);
WaitOption('ickp',500);
end else
if (FindObjCustom(X,Y,['Pickpocketing'],[9234685], 10)) then
begin;
Mouse(X,Y,5,5,false);
WaitOption('ickp',500);
end;
end;

begin
SetupSRL;
DeclarePlayers;
Repeat
Pickpocket_The_Pickpocketers;
until(false)
end.

I know this doesn't classify as a script but im just trying to tackle pickpocketing before i try add in failsafes for when i get stunned etc.

Runaway

2012-06-03 17:21:33

Try using the space between the name and the option:


if WaitOption('er pick', 500) then // from "Pickpocketing trainer pickpocket"
begin
//...

That should work for both the volunteer and the trainer.

ne lg

2012-06-03 17:40:06

Okay, so i managed to get it to work, Thanks a ton :)

Mufasa

2012-06-03 18:57:25

Haha, I was in the thieve guild earlier on my skiller doing this exact same thing. Messing with that Auto colour aid (ACA). Got it working pretty fast:spot: Problem I had with it was, whenever they walked out of screen, my character would just stand there, until the pickpocket volunteer came back onto the screen.
(maybe I need to have it rotate the camera whenever it fails to locate the npc)

Helpful Tip: If you're as newbie as I am, then you probably have it running all round the place pickpocketing from any pickpocket volunteer at random. There's a girl in that place with blonde hair. Try setting it to click her hair ^-^ that way it will stick to the same NPC and you'll look less like a bot.