Error message(string expected, got nil)

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Palkki
Posts: 4
Joined: Wed Aug 18, 2010 7:14 am

Error message(string expected, got nil)

#1 Post by Palkki »

I am getting this error when trying to start bot.lua.

".../rom/settings.lua:310: bad argument #1 to ´?´ (string expected, got nil)"

I am no expert with scripts or programming but I expect that 310 means line 310 in settings.lua file.

This is what I have on line 310

309 if( key[v:getAttribute("key")] == nil ) then
310 local err = sprintf(language[122], -- does not have a valid hotkey!
311 v:getAttribute("description"));
312 error(err, 0);


Any help would be appreciated.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Error message(string expected, got nil)

#2 Post by rock5 »

Palkki wrote:I am getting this error when trying to start bot.lua.

".../rom/settings.lua:310: bad argument #1 to ´?´ (string expected, got nil)"

I am no expert with scripts or programming but I expect that 310 means line 310 in settings.lua file.

This is what I have on line 310

309 if( key[v:getAttribute("key")] == nil ) then
310 local err = sprintf(language[122], -- does not have a valid hotkey!
311 v:getAttribute("description"));
312 error(err, 0);


Any help would be appreciated.
What this means is, while loading the 'hotkeys' section of your profile, the bot encountered an invalid value for the 'key' variable.

Check your 'hotkeys' section of your profile.
  • 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
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Error message(string expected, got nil)

#3 Post by Administrator »

Actually, that part specifically refers to settings.xml, not your profile. Same idea, though. It should probably be trying to read from your bindings.txt (if available), so I'm not even sure why you were messing with settings.xml.
Palkki
Posts: 4
Joined: Wed Aug 18, 2010 7:14 am

Re: Error message(string expected, got nil)

#4 Post by Palkki »

Well I kinda understood that it was key related, but I didn't get what was wrong with it. Because I thought the script was supposed to use the bindings.txt. And I have checked settings.lua multiple times and it appears that the keys are just fine. I am starting to lose my mind with this issue.
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Error message(string expected, got nil)

#5 Post by Administrator »

The problem is settings.xml, not settings.lua. It would help if you provided a copy of your log.txt, bindings.txt, and settings.xml.
Palkki
Posts: 4
Joined: Wed Aug 18, 2010 7:14 am

Re: Error message(string expected, got nil)

#6 Post by Palkki »

Bindings:

Code: Select all

MOVEFORWARD UP W
MOVEBACKWARD S DOWN
STRAFELEFT A LEFT
STRAFERIGHT D RIGHT
TURNLEFT , 
TURNRIGHT . 
JUMP SPACE 
SITORSTAND X 
TOGGLEAUTORUN  
TOGGLERUN  
TOGGLESHEATH Z 
FOLLOWTARGET  
SCREENSHOT PRTSCR 
PUSHTOTALK  
TOGGLEBACKPACK B 
TOGGLECHARACTER0 C 
TOGGLECHARACTER1 V 
TOGGLECHARACTER2 Y 
TOGGLECHARACTER3 T 
TOGGLECHARACTER4 H 
TOGGLECHARACTER5  
TOGGLESPELLBOOK K 
TOGGLEQUESTBOOK L 
TOGGLEGUILD G 
TOGGLEINSTANCERECORD  
TOGGLESOCIALFRAME O 
TOGGLEBLACKLISTFRAME N 
TOGGLEHATEFRIEND MULTIPLY 
TOGGLESEARCHGROUP U 
TOGGLECHARTBOOK P 
TOGGLEBEAUTYSTUDIO  
TOGGLEITEMMALL  
TOGGLEBULLETINBOARD  
TOGGLEWORLDMAP M 
TOGGLEAREAMAP SHIFT+M 
TOGGLENPCTRACK BACKSPACE 
TOGGLETEACHING F10 
TOGGLEGAMEHELP F11 
TOGGLESORTSCOREBOARD NUMPAD9 
TOGGLEDRAWOUTRUNE  
TOGGLESKILLSUIT - 
TOGGLETUTORIALEXPLAIN F12 
TOGGLEFPSTEXT CTRL+X 
TOGGLEUI CTRL+Z 
TOGGLEGAMEMENU ESCAPE 
TOGGLENPCNAME F7 
TOGGLEHEALTH F8 
TOGGLEPLATES F9 
OPENCHAT ENTER 
REPLY R 
REPEAT SHIFT+R 
CHATPAGEUP PAGEUP 
CHATPAGEDOWN PAGEDOWN 
CHATTOP  
CHATBOTTOM END 
CHAT_PARTY CTRL+P 
CHAT_GUILD CTRL+G 
CHAT_SAY CTRL+S 
CHAT_YELL CTRL+Y 
CHAT_ZONE  
MINIMAPZOOMIN SUBTRACT 
MINIMAPZOOMOUT ADD 
TARGETNEARESTENEMY TAB 
TARGETPREVIOUSENEMY SHIFT+TAB 
TARGETNEARESTFRIEND J 
TARGETPREVIOUSFRIEND  
TARGETSELF F1 
TARGETPARTY1 F2 
TARGETPARTY2 F3 
TARGETPARTY3 F4 
TARGETPARTY4 F5 
TARGETPARTY5 F6 
TARGETPLAYERPET SHIFT+F1 
TARGETPARTY1PET SHIFT+F2 
TARGETPARTY2PET SHIFT+F3 
TARGETPARTY3PET SHIFT+F4 
TARGETPARTY4PET SHIFT+F5 
TARGETPARTY5PET SHIFT+F6 
ASSISTTARGET F 
RAIDTARGET1 NUMPAD1 
RAIDTARGET2 NUMPAD2 
RAIDTARGET3 NUMPAD3 
RAIDTARGET4 NUMPAD4 
RAIDTARGET5 NUMPAD5 
RAIDTARGET6 NUMPAD6 
RAIDTARGET7 NUMPAD7 
RAIDTARGET8 NUMPAD8 
ACTIONBAR1BUTTON1 1 
ACTIONBAR1BUTTON2 2 
ACTIONBAR1BUTTON3 3 
ACTIONBAR1BUTTON4 4 
ACTIONBAR1BUTTON5 5 
ACTIONBAR1BUTTON6 6 
ACTIONBAR1BUTTON7 7 
ACTIONBAR1BUTTON8 8 
ACTIONBAR1BUTTON9 9 
ACTIONBAR1BUTTON10 0 
ACTIONBAR1BUTTON11 = 
ACTIONBAR1BUTTON12  
ACTIONBAR1BUTTON13  
ACTIONBAR1BUTTON14  
ACTIONBAR1BUTTON15 \ 
ACTIONBAR1BUTTON16 Q 
ACTIONBAR1BUTTON17 E 
ACTIONBAR1BUTTON18  
ACTIONBAR1BUTTON19  
ACTIONBAR1BUTTON20  
ACTIONBAR2BUTTON1 CTRL+1 
ACTIONBAR2BUTTON2 CTRL+2 
ACTIONBAR2BUTTON3 CTRL+3 
ACTIONBAR2BUTTON4 CTRL+4 
ACTIONBAR2BUTTON5 CTRL+5 
ACTIONBAR2BUTTON6 CTRL+6 
ACTIONBAR2BUTTON7 CTRL+7 
ACTIONBAR2BUTTON8  
ACTIONBAR2BUTTON9  
ACTIONBAR2BUTTON10  
ACTIONBAR2BUTTON11  
ACTIONBAR2BUTTON12  
ACTIONBAR2BUTTON13  
ACTIONBAR2BUTTON14  
ACTIONBAR2BUTTON15  
ACTIONBAR2BUTTON16  
ACTIONBAR2BUTTON17  
ACTIONBAR2BUTTON18  
ACTIONBAR2BUTTON19  
ACTIONBAR2BUTTON20  
ACTIONBAR3BUTTON1 INSERT 
ACTIONBAR3BUTTON2  
ACTIONBAR3BUTTON3  
ACTIONBAR3BUTTON4  
ACTIONBAR3BUTTON5  
ACTIONBAR3BUTTON6  
ACTIONBAR3BUTTON7  
ACTIONBAR3BUTTON8  
ACTIONBAR3BUTTON9  
ACTIONBAR3BUTTON10  
ACTIONBAR3BUTTON11 HOME 
ACTIONBAR3BUTTON12  
ACTIONBAR3BUTTON13  
ACTIONBAR3BUTTON14  
ACTIONBAR3BUTTON15  
ACTIONBAR3BUTTON16  
ACTIONBAR3BUTTON17  
ACTIONBAR3BUTTON18  
ACTIONBAR3BUTTON19  
ACTIONBAR3BUTTON20  
ACTIONBAR4BUTTON1  
ACTIONBAR4BUTTON2  
ACTIONBAR4BUTTON3  
ACTIONBAR4BUTTON4  
ACTIONBAR4BUTTON5  
ACTIONBAR4BUTTON6  
ACTIONBAR4BUTTON7  
ACTIONBAR4BUTTON8  
ACTIONBAR4BUTTON9  
ACTIONBAR4BUTTON10  
ACTIONBAR4BUTTON11  
ACTIONBAR4BUTTON12  
ACTIONBAR4BUTTON13  
ACTIONBAR4BUTTON14  
ACTIONBAR4BUTTON15  
ACTIONBAR4BUTTON16  
ACTIONBAR4BUTTON17  
ACTIONBAR4BUTTON18  
ACTIONBAR4BUTTON19  
ACTIONBAR4BUTTON20  
PETACTIONBARBUTTON1  
PETACTIONBARBUTTON2  
PETACTIONBARBUTTON3  
PETACTIONBARBUTTON4  
PETACTIONBARBUTTON5  
PETACTIONBARBUTTON6  
PETACTIONBARBUTTON7  
PETACTIONBARBUTTON8 CTRL+8 
PETACTIONBARBUTTON9 CTRL+9 
PETACTIONBARBUTTON10 CTRL+0 
EXTRAACTIONBUTTON1 ALT+1 
EXTRAACTIONBUTTON2 ALT+2 
EXTRAACTIONBUTTON3 ALT+3 
EXTRAACTIONBUTTON4 ALT+4 
EXTRAACTIONBUTTON5 ALT+5 
EXTRAACTIONBUTTON6 ALT+6 
EXTRAACTIONBUTTON7 ALT+7 
EXTRAACTIONBUTTON8 ALT+8 
EXTRAACTIONBUTTON9 ALT+9 
EXTRAACTIONBUTTON10 ALT+0 
Settings.xml

Code: Select all

<settings>
	<hotkeys>
		<!-- Cannot use modifiers -->
		<hotkey description="MOVE_FORWARD" key="VK_W" modifier="" />
		<hotkey description="MOVE_BACKWARD" key="VK_S" modifier="" />
		<hotkey description="ROTATE_LEFT" key="VK_OEM_COMMA" modifier="" />
		<hotkey description="ROTATE_RIGHT" key="VK_OEM_PERIOD" modifier="" />
		<hotkey description="STRAFF_LEFT" key="VK_A" modifier="" />
		<hotkey description="STRAFF_RIGHT" key="VK_D" modifier="" />
		<hotkey description="JUMP" key="VK_SPACE" modifier="" />

		<hotkey description="TARGET" key="VK_TAB" modifier="" />
		<hotkey description="TARGET_FRIEND" key="VK_J" modifier="" />
	</hotkeys>

	<options>
		<option name="ENABLE_FIGHT_SLOW_TURN" value="false" />
		<option name="MELEE_DISTANCE" value="45" />
		<option name="LANGUAGE" value="english" />	<!-- english|deutsch|french|russian -->
		<option name="USE_CLIENT_LANGUAGE" value="true" />
		<option name="DEBUGGING" value="true" />

		<!--
			Leave ROMDATA_PATH blank to use automatic settings.
			If it cannot find your bindings.txt automatically,
			place the FULL PATH to the "Runes of Magic"
			directory here.
		-->
		<option name="ROMDATA_PATH" value="" />
	</options>
</settings>
Log.txt

Code: Select all

Thu Aug 19 09:15:27 2010 : MicroMacro v1.0
Thu Aug 19 09:15:27 2010 : Processor Type: 4X 586, OS: Windows XP Service Pack 3
Thu Aug 19 09:15:27 2010 : LuaCoco is available.
Thu Aug 19 09:15:27 2010 : Lua glues exported.
Thu Aug 19 09:15:27 2010 : Keyboard layout: US English
Thu Aug 19 09:15:57 2010 : Executing script 'bot.lua'
--------------------------------------------------------------------------------

Thu Aug 19 09:15:57 2010 : ...t/Runes of Magic/micromacro/scripts/rom/settings.lua:310: bad argument #1 to '?' (string expected, got nil)
Thu Aug 19 09:15:57 2010 : Execution error: Runtime error
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Error message(string expected, got nil)

#7 Post by Administrator »

In settings.lua, on line 311, you'll see this:

Code: Select all

                  v:getAttribute("description"));
Change to:

Code: Select all

				  v:getAttribute("description") or v:getAttribute("name") or "<invalid>");
Save and run it again. What does it say?
Palkki
Posts: 4
Joined: Wed Aug 18, 2010 7:14 am

Re: Error message(string expected, got nil)

#8 Post by Palkki »

log.txt with the changes:

Code: Select all

Sat Aug 21 15:03:15 2010 : MicroMacro v1.0
Sat Aug 21 15:03:15 2010 : Processor Type: 4X 586, OS: Windows XP Service Pack 3
Sat Aug 21 15:03:15 2010 : LuaCoco is available.
Sat Aug 21 15:03:15 2010 : Lua glues exported.
Sat Aug 21 15:03:15 2010 : Keyboard layout: US English
Sat Aug 21 15:03:34 2010 : Executing script 'bot.lua'
--------------------------------------------------------------------------------

Sat Aug 21 15:03:34 2010 : ...t/Runes of Magic/micromacro/scripts/rom/settings.lua:310: bad argument #1 to '?' (string expected, got nil)
Sat Aug 21 15:03:34 2010 : Execution error: Runtime error
Hey. I noticed it says Keyboard layout: US English. I dont have Us English keyboard. This is Swedish/Finnish keyboard. Any idea if that has any effect?
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Error message(string expected, got nil)

#9 Post by Administrator »

That doesn't mater. Pay attention to what the console says. It will give a specific error message before exiting script execution. What does it say?
Post Reply