šŸ“ƒ SLua Alpha

General discussion and feedback on Second Life's SLua Alpha
Significant delay with object_rez event when rezzing scripted prims
I'm attempting spawning a scripted arrow using ll.RezObjectWIthParams ll.RezObjectWithParams(projectile, { REZ_PARAM, 0, REZ_FLAGS, bit32.bor(REZ_FLAG_PHYSICAL, REZ_FLAG_DIE_ON_NOENTRY, REZ_FLAG_NO_COLLIDE_OWNER, REZ_FLAG_TEMP, REZ_FLAG_BLOCK_GRAB_OBJECT), REZ_POS, projectilePosition, false, true, REZ_ROT, avatarCameraRot, false, REZ_VEL, vector(currentStance.Speed, 0.0, 0.0), true, false, REZ_LOCK_AXES, vector(1.0, 1.0, 1.0), }) When attempting to rez a non-scripted prim, the object_rez event is fired with little delay [9:23 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: daaf9d30-d42b-43bd-5467-f6e649d18b08 [9:23 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 0.17778599995654076 [9:23 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: ee6945cb-7234-2879-96bc-37900ec01782 [9:23 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 0.17782800004351884 [9:23 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: ba83213a-4c80-ce3e-a513-e550aed047d0 [9:23 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 0.15552400005981326 However, when dropping in a script to the arrow (in this case the default Luau script) there is a delay in the script in the arrow becoming active along with the event. [9:26 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: a37f1021-6c51-4aab-a569-37dd55c26103 [9:26 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 3.066867999965325 [9:26 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: cc467eb3-5715-bfe9-e637-4e16ce34317e [9:26 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 3.066815000027418 [9:26 AM] zCS#Slua Bow#TEST-0.01: Object rezzed: 6ab801c0-43bd-4bed-6a68-f701f64d46d6 [9:26 AM] zCS#Slua Bow#TEST-0.01: Spawn time: 3.066683000070043 In the past, there was a similar problem when using Mono, so a lot of the time LSO was used for projectiles, however here I am trying to go full Luau.
4
Ā·
Bug
Ā·
complete
Fix touch_start behaviour in slua
LSL has an awkward bug / behavior with touch_start If a user is already touching a prim, no other users touch_start s will trigger, only their touch and touch_end events. This is awkward and seemingly undocumented at least on the wiki. While it may not be something that can be changed in lsl, it would be nice to clear this up in slua and not carry this "bug" over LSL script list ks = []; handle(string name, integer t) { while(t--) { string evnt = name + ": " + llDetectedName(t); if(llListFindList(ks,[evnt]) == -1) { ks += evnt; } } ks = llListSort(ks,1,1); llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT,llDumpList2String(ks,"\n"),<1,1,1>,1]); llSetTimerEvent(5.0); } default { state_entry() { llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT,"",<1,1,1>,1]); } touch_start(integer t) { handle("touch_start",t); } touch(integer t) { handle("touch",t); } touch_end(integer t) { handle("touch_end",t); } timer() { ks = []; llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT,"",<1,1,1>,1]); } } SLua script local ks = {} local clearHandle = nil local function clear() ll.SetLinkPrimitiveParamsFast(0, {PRIM_TEXT,"",vector.one,1}) ks = {} end local function handler(name) return function(events:{DetectedEvent}) for _,event in events do local evnt = `{name}: {event:getName()}` if not table.find(ks, evnt) then ks[#ks+1] = evnt end end table.sort(ks) ll.SetLinkPrimitiveParamsFast(0, {PRIM_TEXT,table.concat(ks,"\n"),vector.one,1}) if clearHandle then LLTimers:off(clearHandle) end clearHandle = LLTimers:once(5, clear) end end clear() LLEvents:on("touch_start", handler("touch_start")) LLEvents:on("touch", handler("touch")) LLEvents:on("touch_end", handler("touch_end")) Both of these scripts require 2 users to click, and you can see that only the person that clicks first gets a touch_start set text.
5
Ā·
Bug
Ā·
complete
Load More
→