Jump to content

Alguem pode me dizer o que está errado?


Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...