PDA

View Full Version : what are best practices for using ScriptEnable/GirderEnable?



mhwlng
August 17th, 2005, 12:31 AM
As most people, I need 'stuff' to happen at girder startup and when F11 is pressed.

The logger shows the situation right after starting G4. It shows that both the ScriptEnable event and the GirderEnable event happen.

BUT, I found that my actions linked to the ScriptEnable event are NOT called at startup (works fine when pressing F11)

so I added 2 events to each action. At startup the GirderEnable triggers the action and at F11 press, the ScriptEnable triggers the same action.


Is this how it's supposed to work or is there a better/recommended way to do this ?

Marcel

Mastiff
August 17th, 2005, 01:46 AM
I have found that Girder Enable and Script Enable works pretty well. There is also Girder Open, but the problem with that is that if you have both Script Enable and Girder Open all startup scripts will be run twice on startup. At least that happened a few versions ago, when I last changed that stuff.

mhwlng
August 17th, 2005, 10:27 PM
Ron ?

any comment on my missing ScriptEnable at startup ? Is that by design ?


Marcel

danward79
August 18th, 2005, 01:06 AM
In my experience using both causes event handles to be set twice, so you may find that you end up with events and commands being triggered several times.

mhwlng
August 18th, 2005, 01:11 AM
that's the whole point of this thread...

this doesn't happen for me, In above example my actions are triggered ONCE at startup (as you can see in the logger picture) and ONCE when pressing F11, which is not what I would expect. (as you say)

That is why I would like Ron to say something on the subject...

Marcel

Ron
August 18th, 2005, 06:56 AM
Hook GirderOpen and ScriptEnable to trigger when the luastate is new. Don't use GirderEnable since that gets triggered by F9.

mhwlng
August 18th, 2005, 07:01 AM
ok,

but why doesn't my action linked to scriptenable get called at startup (only at F11) ?


Marcel

Ron
August 18th, 2005, 07:03 AM
as I said when that event happens no files are loaded yet.

mhwlng
August 18th, 2005, 07:04 AM
I just found that

an action linked to girderopen also doesn't get executed at startup

Marcel

Ron
August 18th, 2005, 07:06 AM
Works for me.

In the event editor did you deselect any event modifiers?

mhwlng
August 18th, 2005, 07:11 AM
my mistake...

it did work ok

thanks

Marcel

Ron
August 18th, 2005, 07:13 AM
Great!