Lua scripting related requests
Author |
Message |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
It seems to be related to using CallbackAfter() more than one time in my script for different callback functions. Which ever one is executed first is the one that will continue to work for future calls. Any CallbackAfter() set after the first one, doesn't seem to fire.
|
2017-04-17 17:25:25 |
|
 |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5915
|
Strange. I'll have a look at it.
|
2017-04-17 17:33:40 |
|
 |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
Thanks. This test.lua may help illustrate: Callback1 is executed 2 times where Callback2 is never executed.
|
2017-04-17 17:46:25 |
|
 |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5915
|
Yes, this is very weird, because my code does properly store each callback in a different slot of the LUA_REGISTRYINDEX table, and does pass the corresponding (Lua-engine-allocated) reference to the callback. With debug messages on, I can see both callbacks properly queued with different references, and then called with the corresponding references. It's like if Lua was returning the first callback data (function + parameters) for *both* references... I'll investigate further but to me, it looks like a Lua bug !
|
2017-04-17 19:08:38 |
|
 |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5915
|
I found the bug: my code missed a lua_pop() in HBViewerAutomation::doAfterIntervalCallback(). In fact, as is, it should never have worked at all (because on lua_pcall() the first stack element is a number instead of the function "pointer", which only appears as the second element on stack), but apparently, a bug in Lua makes it more or less work (but only calling the first function)... Fixed for next release.
|
2017-04-17 21:58:07 |
|
 |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
Ugh, those are some of the most insidious types of bugs to trace. A few effects can combine and 'sort of work' but they mask what the real problem is. Thanks for tracking it down.
|
2017-04-17 22:09:26 |
|
 |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5915
|
Implemented in today's release.
|
2017-04-29 09:35:13 |
|
 |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
Thanks. I appreciate the add, as it saves me a few clicks when working on my automation and testing it.
|
2017-04-30 13:38:10 |
|
 |
ZaneZimer
Joined: 2016-06-19 21:33:37 Posts: 384 Location: Columbus area, OH, USA
|
As I was working on my Lua automation today, a couple of ideas for enhancements occurred to me: - TeleportAgentToPos() - allow a 'look at' parameter similar to the LSL one for llTeleportAgentGlobalCoords()
- GetGridSimAndPos() - might need to have the cardinal direction returned too to be symetric with TeleportAgentToPos()
- GetAgentInfo() new - similar to llGetAgentInfo() either for self only or any avatar UUID
Any thoughts?
|
2017-04-30 23:59:27 |
|
 |
Henri Beauchamp
Joined: 2009-03-17 18:42:51 Posts: 5915
|

Please note that viewer-side Lua scripting is not meant to replace server-side LSL scripting (especially since you can have LSL scripts invoking Lua commands, bringing a whole new lot of possibilities for your scripts). So, I'm not going to reimplement on the viewer side all what already exists on server side with LSL... However, I implemented the following for next release: - GetAgentInfo() will return a table for the agent (i.e. your avatar only) containing sundry info (legacy name, display name, agent UUID, maturity, active group, control flags, flying and sitting booleans, RLV info/restrictions...).
- TeleportAgentToPos() was extended to accept a boolean as an optional fourth parameter which, when present and true, causes the TP to preserve the "lookat" vector (i.e. your avatar will face the same direction on arrival as on departure): I don't find any practical use in adding a facing vector, since there is little to no chance to know what direction to look at for a random destination: better trusting the builder and parcel owner about what your avatar should face on arrival.
- TeleportAgentHome() has been added.
There will also be group-related functions for getting agent group info and setting agent group and title (role).
|
2017-05-04 09:07:20 |
|
|
Who is online |
Users browsing this forum: No registered users and 15 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|