Page 1 of 1
Button Add Connector?
Posted: Fri Oct 19, 2012 8:10 am
by MM037
I am trying to add a connector to a button through a script entity. It reads:
dungeon_secret_button_large_4:addConnector(toggle, script_entity_11, buttonstuck)
buttonstuck is the name of the function of the new entity. It keeps saying,
bad argument #1 to 'addConnector' (string expected, got nil)
Can anyone let me know what I did wrong?
Re: Button Add Connector?
Posted: Fri Oct 19, 2012 8:25 am
by msyblade
I'm not positive, but I believe (just by working with the editor) that the buttons lack the variable required for any connector to attach to them.(say to activate/deactivate it remotely) can connect the button to something(to change a variable), but connect to the button and there simply is no variable to change. You can see this in editor, connect to it and the "action" dropdown is blank (nil).Which is the error youre getting from the script.This is just guesswork on my part and I could be completely mistaken.
Re: Button Add Connector?
Posted: Fri Oct 19, 2012 8:26 am
by antti
The addConnector-method expects strings so you need to put those parameters in quotes like so:
dungeon_secret_button_large_4:addConnector("toggle", "script_entity_11", "buttonstuck")
Re: Button Add Connector?
Posted: Fri Oct 19, 2012 8:29 am
by msyblade
That is awesome, thank you antti!
Re: Button Add Connector?
Posted: Fri Oct 19, 2012 8:36 am
by MM037
Ah, awesome. Works great now. Many thanks. Learning Lua as I go. Hehe.