Cool VL Viewer forum
http://sldev.free.fr/forum/

Lua scripting related requests
http://sldev.free.fr/forum/viewtopic.php?f=9&t=1737
Page 5 of 10

Author:  Henri Beauchamp [ 2017-04-09 20:57:35 ]
Post subject:  Re: Lua scripting related requests

ZaneZimer wrote:
I haven't isolated a pattern yet, but there might be something wrong with the new Lua pie menu functionality. First, when I stop the automation script the pie menu doesn't always revert to default. I was trying to use pie menu type 4, slice 1 to add a simple, clickable SendChat() greeting. Second, sometimes stopping or loading a new script causes the viewer to crash. I will try to provide more details as I learn them.

In OnLogin(), I have:
Code:
LuaPieMenuSlice(4, 1, "Howdy...", "AutomationMessage(\"avatar-say-howdy|\" .. GetPickedObjectID())")

I found the problem (in HBLuaPieMenu::removeAllSlices(): I forgot the indices and as a result it clears the vectors instead of emptying their string). It will be fixed in next release. In the mean time, avoid reloading a Lua automation script... Note that it won't crash the viewer under Linux (the vectors staying apparently allocated), and that's why I didn't notice the bug sooner...

Author:  ZaneZimer [ 2017-04-09 21:29:18 ]
Post subject:  Re: Lua scripting related requests

Henri Beauchamp wrote:
I found the problem (in HBLuaPieMenu::removeAllSlices(): I forgot the indices and as a result it clears the vectors instead of emptying their string).
Cool. Glad you were able to isolate it from my crude description of the problem. For now, I'll just comment out my pie menu initialization. I was really only tinkering with them to see how they worked. I was having a hard time coming up with a 'real' use case for pie menu functions anyway. :-)

Author:  ZaneZimer [ 2017-04-10 13:31:18 ]
Post subject:  Re: Lua scripting related requests

I was pondering a bit last night. Which occurs first, the LuaPieMenuSlice 'command' or the OnLuaPieMenu 'event'? Also, would it be beneficial to have the slice index passed in the 'data' coming to OnLuaPieMenu?

Author:  Henri Beauchamp [ 2017-04-10 14:36:05 ]
Post subject:  Re: Lua scripting related requests

ZaneZimer wrote:
I was pondering a bit last night. Which occurs first, the LuaPieMenuSlice 'command' or the OnLuaPieMenu 'event'?
The command line (when not "nop") is executed first, then the event (if any) is called.

Quote:
Also, would it be beneficial to have the slice index passed in the 'data' coming to OnLuaPieMenu?
That has already been added for next release (I thought about it as I was compiling v1.26.20.16 for release, so it was to late for it).

Author:  ZaneZimer [ 2017-04-10 16:51:49 ]
Post subject:  Re: Lua scripting related requests

Henri Beauchamp wrote:
The command line (when not "nop") is executed first, then the event (if any) is called.
I figured the order was consistent and assumed that they were executed in that order. Thanks for confirming.
Quote:
That has already been added for next release (I thought about it as I was compiling v1.26.20.16 for release, so it was to late for it).
Cool. I should have known that you would have thought of that.

Author:  ZaneZimer [ 2017-04-11 22:38:54 ]
Post subject:  Re: Lua scripting related requests

Should ApplySkySettings() return true for the pseudo-setting names: "region", "sunrise", "noon", "sunset" and "midnight"? Right now the function call does change the setting but returns false, implying it didn't locate the name.

Author:  Henri Beauchamp [ 2017-04-11 23:45:15 ]
Post subject:  Re: Lua scripting related requests

ZaneZimer wrote:
Should ApplySkySettings() return true for the pseudo-setting names: "region", "sunrise", "noon", "sunset" and "midnight"? Right now the function call does change the setting but returns false, implying it didn't locate the name.
Yes, it should... Fixed for next release.

Author:  ZaneZimer [ 2017-04-17 16:13:26 ]
Post subject:  Re: Lua scripting related requests

I have verified the ApplySkySettings() fix. Thanks for getting that in.

I'm running into something I can't seem to track down. CallbackAfter() doesn't fire many times. I have a simple function like:
Code:
if AgentSit() then
    CallbackAfter(30, AgentStand)
    OpenNotification(0, "Sitting on ground.")
else
    OpenNotification(0, "Unable to sit on ground.")
end
My avatar sits properly but then never stands. I use CallbackAfter() in another function to callback to itself and it works fine. If I reload (stop and load) the automation script, the code above starts working.

As a side, a reload menu option might be nice to stop and reload the automation script instead of popping the file picker dialog.

Author:  Henri Beauchamp [ 2017-04-17 16:59:23 ]
Post subject:  Re: Lua scripting related requests

ZaneZimer wrote:
I'm running into something I can't seem to track down. CallbackAfter() doesn't fire many times. I have a simple function like:
Code:
if AgentSit() then
    CallbackAfter(30, AgentStand)
    OpenNotification(0, "Sitting on ground.")
else
    OpenNotification(0, "Unable to sit on ground.")
end
My avatar sits properly but then never stands. I use CallbackAfter() in another function to callback to itself and it works fine. If I reload (stop and load) the automation script, the code above starts working.
It depends where you put that piece of code... If it's in not inside a callback, it's obvious it will not be executed aside from on viewer startup (or on script reload), while the agent is not yet initialized, which will result in a "nop"...

Author:  ZaneZimer [ 2017-04-17 17:12:13 ]
Post subject:  Re: Lua scripting related requests

Henri Beauchamp wrote:
It depends where you put that piece of code... If it's in not inside a callback, it's obvious it will not be executed aside from on viewer startup (or on script reload), while the agent is not yet initialized, which will result in a "nop"...
Right. The code is in the OnSendChat() callback. I'm keying off of '/sit' as a 'command' to execute that block.

Page 5 of 10 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/