Is there an equivilant to
llListenRemove();
for
link_message(); or llMessageLinked(); ?
I need to flush a thread in a state if remote_data is received
Many thanks,
Mark.
These forums are CLOSED. Please visit the new forums HERE
link_message() remove possible? [llListenRemove() equivilant?] |
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-14-2007 04:54
Is there an equivilant to
llListenRemove(); for link_message(); or llMessageLinked(); ? I need to flush a thread in a state if remote_data is received Many thanks, Mark. |
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
03-14-2007 09:21
No, not that I'm aware of.
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
03-14-2007 09:31
You could switch to a state without a link_message event handler.
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
03-14-2007 12:03
If you need to flush a thread, why not just follow your original llMessage_Linked with another link message that "flushes"...ie..
CODE
_____________________
--AeonVox--
Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music. |
|
Gaius Goodliffe
Dreamsmith
Join date: 15 Jan 2006
Posts: 116
|
03-14-2007 18:51
If you need to flush a thread, why not just follow your original llMessage_Linked with another link message that "flushes"...ie.. The flush would then not occur until the script gets through the link messages queued up before it, which defeats the point. Lex has it right -- to turn off link_messages, switch to a state with no link_message handler. To flush the queue, do that, and in that state immediately switch back. I've used this trick before for scripts that would accumulate unwanted, stale link messages if things were laggy, to make sure it only responded to the next link message of a given type, not any that might be hanging around in the queue. |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
03-14-2007 19:57
It shouldn't matter if it has a link_message event or not (the target state i mean), the event queue is cleared on state change.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
03-14-2007 22:30
Gotcha. I don't think I've ever run into that issue...as I don't send link_messages on a repeated basis in most instances.
_____________________
--AeonVox--
Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music. |
|
Gaius Goodliffe
Dreamsmith
Join date: 15 Jan 2006
Posts: 116
|
03-15-2007 15:57
It shouldn't matter if it has a link_message event or not (the target state i mean), the event queue is cleared on state change. Correct. It only matters if what you're trying to do is turn off link messages. |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-16-2007 06:39
State change would be ideal... but, I have a timer event (190 seconds) which would never get sparked if I changed state.
More importantly, if I change state when I receive new remote_data I will lose the latest link_message sparked by this remote_data Background: The "waiting" state which listens to remote_data calls a function which sends a linked message to LINK_THIS. The function then returns to the "waiting" state which picks up the linked message and loops it back to the function, thus the function loops continuously (it makes the object pulse at a variable speed) based on the integer sent from remote_data (outside sl) or listen (within sl). I used a listen to do this initially, but found I couldn't have two listen events in the same state.... Mark. |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-16-2007 06:50
State change would be ideal... but, I have a timer event (190 seconds) which would never get sparked if I changed state. More importantly, if I change state when I receive new remote_data I will lose the latest link_message sparked by this remote_data Background: The "waiting" state which listens to remote_data calls a function which sends a linked message to LINK_THIS. The function then returns to the "waiting" state which picks up the linked message and loops it back to the function, thus the function loops continuously (it makes the object pulse at a variable speed) based on the integer sent from remote_data (outside sl) or listen (within sl). I used a listen to do this initially, but found I couldn't have two listen events in the same state.... Mark. Timer events are not cleared by state changes, so switch state to flush the queue then switch back to carry on the timer. |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-16-2007 06:56
really? Even if the timer is actually kicked off within the state I am changing from?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-16-2007 07:10
Yep, event if its in a different state.
Of course it requires a timer() event handler within the new state to actually do anything. You can prove it with the following code CODE
CODE
|
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-16-2007 07:19
okay brilliant thanks! I still can't seem to flush the thread though, here is the code, I've tried calling state restart; to flush it on remote_data receipt:
The pulse function is what is looped continously and it is within this that the llMessageLinked is created. The waiting state listens to listen, remote_data and the message_linked state restart restarts the waiting state and it is here that I tried to flush the message_linked thread but to no avail... Cheers, Mark. CODE
|
|
Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
|
03-16-2007 08:36
As a side note, why not use list-commands to get rid of all those if-statements?
list listcolors = ["red", "<1,0,0>", "light red", <1,0.16,0>"... a.s.o and something like... integer colorpos = llListFindList(listcolors, col) + 1; vector colorcode = llList2Vector(listcolors, colorpos); llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, colorcode, 1, PRIM_POINT_LIGHT, TRUE, colorcode, c_i, 10, 0.75]); P.s. Code not tested. [EDIT] Notice you already have list commands in code in other places. Better performance with if's? |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-16-2007 16:15
oh dont let Osgeld see that if tree.
As Woopys suggested, use lists the performance hit is negligible compared to the additional code space and processing required for that many if's. |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-17-2007 01:53
Okay I'll go with that =P Much neater and yes faster
Side note: If I send detectedName via HTTPRequest how can I avoid receiving "DiegoPannotia" instead of Diego Pannotia? Substring the two seperate parts of the name and place %20 inbetween? Answered my own question right... =P llHTTPRequest("http://nakedimagination.co.uk/secondlife/publish.php?topic=slstats/Fan&msg=" + llDetectedName(0) + "&uid=slhome",[HTTP_METHOD,"GET"],"" ;That aside, any suggestions on how to get rid of that thread when I receive new remote_data or listen? |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-17-2007 01:54
Okay I'll go with that =P Much neater and yes faster
Side note: If I send detectedName via HTTPRequest how can I avoid receiving "DiegoPannotia" instead of Diego Pannotia? Substring the two seperate parts of the name and place %20 inbetween? Answered my own question right... =P llHTTPRequest("http://xxx/publish.php?msg=" + llDetectedName(0) + ",[HTTP_METHOD,"GET"],"" ;That aside, any suggestions on how to get rid of that thread when I receive new remote_data or listen? |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-17-2007 01:55
Okay I'll go with that =P Much neater and yes faster
Side note: If I send detectedName via HTTPRequest how can I avoid receiving "DiegoPannotia" instead of Diego Pannotia? Substring the two seperate parts of the name and place %20 inbetween? Answered my own question right... =P llHTTPRequest("http://xxx/publish.php?msg=" + llDetectedName(0),[HTTP_METHOD,"GET"],"" ;That aside, any suggestions on how to get rid of that thread when I receive new remote_data or listen? |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
03-17-2007 02:49
That implementation of colour(string col) above, is about the worst way it could be written.
This way is marginally better. The right solution is to pack the vectors into integers. There are some nice functions for doing that on: https://wiki.secondlife.com/wiki/Category:LSL_Color CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
|
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
|
03-17-2007 14:30
excellent! very much better than before =D teeny error
llList2Float(llGetPrimitiveParams([PRIM_POINT_LIGHT], 2)), should be llList2Float(llGetPrimitiveParams([PRIM_POINT_LIGHT]), 2), __________________________ However! Wonderful as that was, it slightly detracts from the point of this thread =P Any furthur thoughts? Many thanks to all Mark |