Jump to content

Turn Glow off help


Zaine Swords
 Share

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

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

Recommended Posts

I have a problem, everytime the message gets sent to turn the light off, it sets the glow back to 1.0 instead of 0.0. any idea what i did wrong here?

integer CHAN;

float glow;

integer SetID(key id)
{
    integer mainkey = 952;
    string tempkey = llGetSubString((string)id, 0, 7);
    integer hex2int = (integer)("0x" + tempkey);
    return (hex2int + mainkey);
}

default
{
    state_entry()
    {
        CHAN = SetID(llGetOwner());
        llListen(CHAN, "", NULL_KEY, "");
        llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0]);
    }

    listen(integer chan, string name, key id, string msg)
    {
        if(msg == "LIGHTON")
        {
            llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, glow]);
        }
        else if(msg == "LIGHTLOW")
        {
            glow = 0.1;
            llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, glow]);
        }
        else if(msg == "LIGHTMEDIUM")
        {
            glow = 0.5;
            llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, glow]);
        }
        else if(msg = "LIGHTHIGH")
        {
            glow = 1.0;
            llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, glow]);
        }
        else if(msg == "LIGHTOFF")
        {
            llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, 0]);
        }
    }
}

 

Link to comment
Share on other sites

Don't worry.   We''ve all done it often enough, and it's a pain to spot.

One tip is to get into the habit of  switiching the elements round, so instead of saying 

if (message == "yes")

 you say 

if ("yes" == message)

 That's because if you make a mistake and type 

 

if ("yes"= message)

 it throws an error and won't compile, so it's a lot easier to see what's gone wrong, and where.  

Link to comment
Share on other sites

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