"SelectOptionByName" no longer works (4.0.5.2467) [solved]

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

"SelectOptionByName" no longer works (4.0.5.2467) [solved]

#1 Post by Rickster »

I am at rom bot rev. 675

I once added some functions to interface/addons/ingamefunctions.lua. One of them is

Code: Select all

------------------------------------------------
-- Select Option By Name
-- optiontext = option text or part of
-- NPC option dialog should already be open
------------------------------------------------
function SelectOptionByName(optiontext)
    counter = 1
    while RoMScript("GetSpeakOption("..counter..")") do
        if string.find(RoMScript("GetSpeakOption("..counter..")"),optiontext,0,"plain") then
            sendMacro("ChoiceOption("..counter..");"); yrest(1500);
            return true
        end
        counter = counter + 1
    end
    return false
end
I used to call it from a waypoint file like this

Code: Select all

player:target_NPC("Sturobold");
SelectOptionByName("Silberquell"); yrest(500);
But when calling this function MM aborts with following error:

Code: Select all

[string "..."]:8: attempt to call global 'SelectOptionByName' (a nil value)
Any Ideas whats going wrong?

With the RoM Update 4.0.5.2467 I completely deleted my bot folder and got MM and rombot by SVN with MM1.02 and rombot revision 675.
I then added some userfunctions to
  • \scripts\rom\userfunctions
and inserted some ingamefunctions to
  • \interface\addons\ingamefunctions\ingamefunctions.lua
I am not sure where I once got these additional ingamefunctions. i did a forum search, but without any result.
I use the following additional ingamefunctions in ingamefunctions.lua, but did not test them except "SelectOptionByName" :

Code: Select all

	function CheckForBuff(buffname)
	function CancelBuff(buffname)
	function targetNPC(NPCName)
	function BuyItemByName(itemname, num)
	function DeleteItemByNameOrId(itemNameOrId,onceOnly)
	function SelectOptionByName(optiontext)
Maybe someone can tell me why SelectOptionByName does not work and where I can find informations about these additional functions.

Thanx
Ric
Last edited by Rickster on Fri Nov 25, 2011 3:14 am, edited 1 time in total.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: "SelectOptionByName" no longer works (4.0.5.2467)

#2 Post by rock5 »

Nothing runs from "interface/addons/ingamefunctions.lua". What you have are user functions. Try putting it in the "rom/userfunctions" folder. You'll need to prefix it with "userfunction_" so rename it to

Code: Select all

userfunction_ingamefunctions.lua
then try again.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: "SelectOptionByName" no longer works (4.0.5.2467)

#3 Post by Rickster »

:oops: i messed up a little bit with my files.

as you said, these functions do not get into the addon files, but into the rombot userfunctions folder.
putting the functions into rom\userfunctions\userfunction_userfunctions.lua works well :)

thank you!

i looked up my backups and did not find a special file in the userfunctions folder except some downloaded, prewritten files. i wonder where i put these functions before, because i already had used them ;) ... but it does not matter.

Ric
Post Reply