Page 1 of 1

How to select highest level available buff at stable?

Posted: Thu Sep 05, 2013 5:34 pm
by Cindy
The generic question is, how does one pick the 2nd last option in a dialog box?

I want to go to the stable and get the highest level buff. Different guilds have different level stables, if I could just chose '2nd last' option somehow, that would be perfect.

Re: How to select highest level available buff at stable?

Posted: Thu Sep 05, 2013 8:42 pm
by lisa
I am sure you asked this already in a different topic and I answered it.
lisa wrote: Did you try

Code: Select all

ChoiceOptionByName(optiontext)
In your case just do

Code: Select all


local counter = 1
local option
    repeat
		option = RoMScript("GetSpeakOption("..counter..")")
        counter = counter + 1
    until not option
after it leaves the loop counter will be 1 more than the number of options you have, so - 2 from it to get second last option?

There are no doubt more efficient ways to do it, probably even an in game function that returns the number of options. Looking at the games wiki is a good place to find such functions.
http://runesofmagic.gamepedia.com/List_of_Functions

Re: How to select highest level available buff at stable?

Posted: Fri Sep 06, 2013 12:10 am
by rock5
Probably GetNumSpeakOption(). I don't think it includes "Leave Conversation" in the count. So you can use

Code: Select all

RoMScript("ChoiceOption(GetNumSpeakOption())")
to select the last option.

Re: How to select highest level available buff at stable?

Posted: Fri Sep 06, 2013 4:58 pm
by Cindy
Oh.. I thought I asked it, but I couldn't find it so I figured I only thought about asking it.

The problem with the name scheme is that I don't know what the highest level buff will be (since I don't know what level the stable is).

(Well technically, I could know, but I would like to write the code so as to it works for any and all levels of stables.)

I will try Rock's idea, thanks!

Re: How to select highest level available buff at stable?

Posted: Fri Sep 06, 2013 7:15 pm
by Cindy
Works great, though I got 3rd last option (ie one buff lower than max) I will do more testing tomorrow.

Re: How to select highest level available buff at stable?

Posted: Sat Sep 07, 2013 1:02 am
by rock5
Cindy wrote:Works great, though I got 3rd last option (ie one buff lower than max) I will do more testing tomorrow.
That's strange. Using my example? Maybe you should print the value first and see what it prints. Using commandline

Code: Select all

print(RoMScript("GetNumSpeakOption()"))
I just tested it myself. It worked for me. It selected the second one (I a level 2 Stable).