Jump to content

overcoming chat delay?


Tighern McDonnell
 Share

You are about to reply to a thread that has been inactive for 4166 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Ok so have a very basic interaction script going. Object A is listening for string on channel x. When it hears it from Object B being touched, Object A then have three llSay lines to spit out... how to I make it so that they stay in order? I looked bout could not find a "wait" function. Maybe I am over looking something very simple. Thanks.

Link to comment
Share on other sites

You can't guarantee the order in which the lines are said. They should come out in the proper order --- the order in which they appear in your code --- every single time, but when the sim's server is lagging, the order can get scrambled.  You have no control over chat lag.  The best you can do is build a deliberate delay in, by having the lines spit out from a timer event that loops, say, once a second, and hope that chat lag isn't so bad that it overwhelms even that result.

listen(integer chan, string name, key id, string msg){    if (name == "B")    {        llSetTimerEvent(1.0);        gCount = -1;   // Be sure gCount is global;    }}timer(){    llSay(0, llList2String(messages,++gCount));    if (gCount == 2)    {        llSetTimerEvent(0.0);    }}

 Then you put your three lines of output into the list named messages.

 

Link to comment
Share on other sites

But beware that llSleep does exactly what it says.  It puts your entire script to sleep for that interval.  It will not respond to stimulae (chat messages, touch events, sensor input ....).  By contrast, a timer event only fires when the specified time interval has elapsed.  Until then, the script will respond to all normal stimulae.

Link to comment
Share on other sites

I agree with Rolig; llSleep is a dangerous function to use unless you're sure that you really want to disable the script  for a while.  Sometimes you do, of course, but usually a timer is what's really needed, even though it's a bit more to set up.

My rule of thumb is if I'm contemplating sleeping a script for much longer than 0.5 seconds I'm probably doing it wrong.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4166 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...