Jump to content

Are there any problems with running scripts?


prootoxy
 Share

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

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

Recommended Posts

Hello, how are you? I've been creating scripts for SL for a long time, and I've never encountered such a problem.

The problem I'm referring to is a simple "for", see the example:

 

test() {
   integer i = 0;
   for (; i <= 6; i++) {
        llOwnerSay((string)i);  
    }
}

default
{
    state_entry()
    {
        
    }

    touch_start(integer total_number)
    {

       test();
    }
}


This should give me an output from 0 to 6 but since yesterday this has been giving me strange outputs, follow the example:

Click 1: 

6
0
1
2
3
4
5

Click 2: 

3
0
1
2
4
5
6

I don't understand what's going on with my script, does anyone have a solution?

Link to comment
Share on other sites

Might just be a touch of chat lag on your sim.  I mean it just that you're spitting out all 7 numbers on the llSay line as rapidly as it can go, it's very possible that the chat messages are simply coming to you out of order. You might try putting very tiny pause between says and see what happens.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

 

13 minutes ago, Anna Salyx said:

Might just be a touch of chat lag on your sim.  I mean it just that you're spitting out all 7 numbers on the llSay line as rapidly as it can go, it's very possible that the chat messages are simply coming to you out of order. You might try putting very tiny pause between says and see what happens.

 

This worked for me, however I don't know if in "real" use this would be viable, since I normally build games and the functions need to be fast for the game to continue. There have always been functions debugged this way without needing to use llSleep() and always working correctly. But anyway, thank you!!
 

image.png

image.png

Edited by prootoxy
Link to comment
Share on other sites

34 minutes ago, sandi Mexicola said:

I don't know what the problem is, but my first attempt would be to change 

for (; i <= 6; i++) {

to

for (i=0; i <= 6; i++) {

and see if that makes any difference?

I already did the test, the result is the same :/

  • Like 1
Link to comment
Share on other sites

5 hours ago, prootoxy said:

 

 

This worked for me, however I don't know if in "real" use this would be viable, since I normally build games and the functions need to be fast for the game to continue. There have always been functions debugged this way without needing to use llSleep() and always working correctly. But anyway, thank you!!
 

image.png

image.png

I first saw this issue with chat lag about 10 years ago. You may not see the issue in "real" use since your script will do some work between each loop.

There are other options for you to address this, but there are many cases where your scripts will be more consistent if you add llSleep() in the right place.

 

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 77 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...