|
Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
|
05-30-2008 06:45
Hi, I have a very strange problem http://pastebin.com/m116979bfThis code works the only the FIRST time the av sits on the target. On first sit the 3 debugs are shown : 1 2 3 1 Then the av 'stands up' On 2. (and all consecutive 'sits') there is NO debug -eg the function 'changed' is NEVER called?!? That not all.. The FIRST time an av sits on target the 'touch' function is ALSO not longer registrated??! What on earth is going on?! The function 'loop' is stopped (no debug from 'loop') tyia ab
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
05-30-2008 07:49
Not sure exactly what the problem is but doing something like this is probably not a good idea... loop() { while(bool==1) { rollCnt+=1; if(rollCnt==5000) //emote { agent = llAvatarOnSitTarget(); if(agent) { llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION); llStartAnimation("express_open_mouth"); rollCnt=0; //reset cnt loop llSay(0, "reset"); } } } }
I've never tried to treat LSL like it's multi-threaded but expect that it won't be happy with the above code. You'd be better off doing llSettimerEvent (5.0) when somebody starts sitting to set a 5-second timer then have something like timer() { agent = llAvatarOnSitTarget(); if(agent) { if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStartAnimation("express_open_mouth"); } }
edit: also, you should call RequestPermissions when they sit but not actually stop/start the animations until you get a callback to run_time_permissions. From there, you can use GetPermissions to see if you were granted anim perms and do stop/startAnimation and set the timer if you got them.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-30-2008 07:50
I suggest removing the infinite loop in the loop() function (the 'bool' variable isn't changed within the while loop, so 'bool==1' is always true).
|
|
Abraxes Binder
Registered User
Join date: 23 May 2008
Posts: 205
|
Solved
05-30-2008 08:29
Hi, I used Meade's solution. It -is- properly not a good idea to try anything threaded in lsl.. Also this showed me hopw i can use timers Thank You to both of you! BR ab
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-30-2008 09:51
There is no such THING as a multi-threaded script. If you want multiple threads, you must use multiple scripts.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
05-30-2008 14:01
From: Abraxes Binder Hi, I used Meade's solution. It -is- properly not a good idea to try anything threaded in lsl.. Also this showed me hopw i can use timers Thank You to both of you! BR ab LSL is Monotonic, each event handler must complete before the next can execute.
_____________________
I'm back......
|