Jump to content
flachdrache

"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("active","0")
   self.model:SetKey("valuetouse","1")
   self.model:SetKey("keytoset0","active")
   self.model:SetKey("arguments","self.active")
   self.model:SetKey("message0","Run Code")
   self.model:SetKey("message1","Activate")
   self.model:SetKey("reloadafterscript","1")
   self.disable = 0 
end

 

thx

Share this post


Link to post

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

--[[
function object:Reset()
end
]]--

 

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:

object:Reset()

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.

Guest
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...