joaokennedy Posted July 20, 2014 Share Posted July 20, 2014 Alguem pode me dizer o que está errado? function Teste (Element) -- Teste end addEventHandler ( "onColShapeHit", ColCuboid, Teste) function RemoverEvent(source) RemoveEventHandler ( "onColShapeHit", ColCuboid, Teste) end addCommandHandler ( "removeevent", RemoverEvent) Erro: [Teste]\TesteScript.lua:07: attempt to call global 'RemoveEventHandler' (a nil value) E ai vem a pergunta o que está de errado? Link to comment
manawydan Posted July 20, 2014 Share Posted July 20, 2014 é porque RemoveEventHandler não existe removeEventHandler esse é o certo lua é case sensitive(letras maiusculas e minusculas são diferentes) apenes troque o RemoveEventHandler para removeEventHandler Link to comment
joaokennedy Posted July 21, 2014 Author Share Posted July 21, 2014 Nossa muito obrigado, por acaso você mecher com a função onSettingChange? Link to comment
manawydan Posted July 21, 2014 Share Posted July 21, 2014 o que você quer faze com o evento onSettingChange ? para pegar o valor usamos fromJSON para "converter" o valor para lua, igual no exemplo wiki: function makeSettingsChangesVisible ( setting, oldValue, newValue ) whatItWas = fromJSON ( oldValue ) whatItsNow = fromJSON ( newValue ) outputDebugString ( "The setting "..setting.." was "..whatItWas.." and has been changed to "..whatItsNow.."." ) --Making the setting change visible in debug (use /debugscript [number] to see it) end addEventHandler( "onSettingChange", getRootElement(), makeSettingsChangesVisible ) --adding the event O oldValue seria o valor antigo, o new valor é o valor de agora, e o setting é o nome do valor. Esse evento é parecido com onElementDataChange. Só que para ele ocorrer deve haver uma setting Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now