Jump to content

"old" script confusion[s] - switch.lua

Recommended Posts

from switch.lua - does this actually mean something or is it outdated...


function object:Reset()
   self.model:SetKey("message0","Run Code")
   self.disable = 0 



Share this post

Link to post

... while we are on it, the template.lua got a Reset function.

function object:Reset()


When and how will it be called e.g. automatically like UnlockKeys ?!

Share this post

Link to post

well since that code from the switch script does not exist in any of the code that i have since 2.31 - i can only assume that is the old lua code from when LE had multi-state lua instead of single state. so yes - i would assume that code is outdated...


as for the object:Reset(), according to the Getting Started with Lua:


This function is called whenever a model's reset matrix is reset. This can happen if physics are reset in the editor, or if a model is manually moved in the editor. Models that use internal joints can be updated with this function.


So it looks like it calls the Reset() when you first place the model into the scene, any time you move the model, or if you hit the Reset Physics button on the toolbar.

Share this post

Link to post

I am not too sure about when stuff gets called ... e.g. onReset() Vs. doReset() would have been more clear. I`ll test that out again then ... the issue iam having is to build positionable game entity`s w/o disturbing the update loop. A combination of Reset() and UnlockKeys() does work currently but going for random tests is not a preferable task ... but you know that.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...