Jump to content

Recommended Posts

Why isn't the touch script working? Please, I need help from a scripter ASAP. Here's the snippet:
 

integer setting;
float wait;
float rand;
default
{
    state_entry()
    {
        @blink;
        llSetText((string)setting, <1, 1, 1>, 1);
        if(setting == 0)
        {
            llOffsetTexture(0, 0.2, -1);
            llOffsetTexture(0, 0.4, -1);
            wait = 0;
            rand = llFrand(0.2) + 0.1;
            while(wait < rand)
            {
                wait = wait + 0.25;
                llOffsetTexture(0, 0.4, -1);
            }
            llOffsetTexture(0, 0.2, -1);
            llOffsetTexture(0, 0, -1);
            wait = 0;
            rand = llFrand(8.0);
            while(wait < rand)
            {
                wait = wait + 0.25;
                llOffsetTexture(0, 0, -1);
            }
        }
        if(setting == 1)
        {
            llOffsetTexture(0, 0, -1);
        }
        if(setting == 2)
        {
            llOffsetTexture(0, 0.4, -1);
        }
        if(setting == 3)
        {
            llOffsetTexture(0, -0.1, -1);
        }
        if(setting == 4)
        {
            llOffsetTexture(0, 0.2, -1);
        }
        jump blink;
    }
    
    touch(integer total_number)
    {
        if(setting == 4)
        {
            setting = 0;
        }
        else
        {
            setting = setting + 1;
        }
        llOwnerSay((string)setting);
    }
}

 

Edited by JondiDitto

Share this post


Link to post
Share on other sites
13 minutes ago, Ruthven Willenov said:

It's because you have the jump in the state entry creating an infinite loop, and doesn't let it leave the event

Ah, so how would I do an infinite loop and let the script leave the state entry?

Share this post


Link to post
Share on other sites

See how to use a Timer.

Basic concept in LSL: you do a little something to change your objects and exit. The world simulator then does lots of other things. Then you get another event, and another chance to change your objects a little. This repeats.

There are scripting classes available at Oxbridge Caledon.

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites
13 minutes ago, animats said:

See how to use a Timer.

Basic concept in LSL: you do a little something to change your objects and exit. The world simulator then does lots of other things. Then you get another event, and another chance to change your objects a little. This repeats.

There are scripting classes available at Oxbridge Caledon.

Alright, I will check that out soon. If I run into any problems, I'll continue here.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...