Zaine Swords Posted May 2, 2013 Share Posted May 2, 2013 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 More sharing options...
Ron Khondji Posted May 2, 2013 Share Posted May 2, 2013 else if(msg = "LIGHTHIGH") You´re missing a "=" there. Link to comment Share on other sites More sharing options...
Zaine Swords Posted May 2, 2013 Author Share Posted May 2, 2013 ok.. ty.. i feel like an idiot now.. lol Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 3, 2013 Share Posted May 3, 2013 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 More sharing options...
Recommended Posts
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