Search the Community
Showing results for tags 'if'.
-
Dear All, I have been in SL quite a few years, but my scripting skills are still quite raw. I'm after some tips please to reduce my scripting down to less lines, as I am sure there must be a better way and I just can't understand on the wiki as they don't always explain all the possible configurations. I want to check the value of a time is between certain minutes (i.e. between 21and 30, between 31 and 40, between 41 and 50 or above 50) so that my "speaking clock" will read out "20","30","40" or "50" before it reads the minutes (i.e. "50" "1" for 51 minutes. Could anybody kindly help me in getting the syntax right so that it can check all of the above in one "IF" instead of having to do IF > ELSE in the same way I have? I'm basically hoping to say something like if (Minute>=21 && Minute<30) or (Minute>=31 && Minute<40) or (Minute>=41 && Minute<50) or (Minute>50) For your reference "Minute" is the variable taken from the time and represents the minutes in the hour. unimin = the unit measurement of the minutes, decmin = the tens measurement of the minutes (i.e. if the time is 15:34 then the decmin would equal "3" and the unimin would equal "4") a snippet of my huge code below - Thank you so much in advance!! if (Minute>=21 && Minute<30) { if (unimin==1) { llPlaySound("1",1.0); } else if (unimin==2) { llPlaySound("2",1.0); } else if (unimin==3) { llPlaySound("3",1.0); } else if (unimin==4) { llPlaySound("4",1.0); } else if (unimin==5) { llPlaySound("5",1.0); } else if (unimin==6) { llPlaySound("6",1.0); } else if (unimin==7) { llPlaySound("7",1.0); } else if (unimin==8) { llPlaySound("8",1.0); } else if (unimin==9) { llPlaySound("9",1.0); } } else if (Minute>=31 && Minute<40) { if (unimin==1) { llPlaySound("1",1.0); } else if (unimin==2) { llPlaySound("2",1.0); } else if (unimin==3) { llPlaySound("3",1.0); } else if (unimin==4) { llPlaySound("4",1.0); } else if (unimin==5) { llPlaySound("5",1.0); } else if (unimin==6) { llPlaySound("6",1.0); } else if (unimin==7) { llPlaySound("7",1.0); } else if (unimin==8) { llPlaySound("8",1.0); } else if (unimin==9) { llPlaySound("9",1.0); } } else if (Minute>=41 && Minute<50) { if (unimin==1) { llPlaySound("1",1.0); } else if (unimin==2) { llPlaySound("2",1.0); } else if (unimin==3) { llPlaySound("3",1.0); } else if (unimin==4) { llPlaySound("4",1.0); } else if (unimin==5) { llPlaySound("5",1.0); } else if (unimin==6) { llPlaySound("6",1.0); } else if (unimin==7) { llPlaySound("7",1.0); } else if (unimin==8) { llPlaySound("8",1.0); } else if (unimin==9) { llPlaySound("9",1.0); } } else if (Minute>50) { if (unimin==1) { llPlaySound("1",1.0); } else if (unimin==2) { llPlaySound("2",1.0); } else if (unimin==3) { llPlaySound("3",1.0); } else if (unimin==4) { llPlaySound("4",1.0); } else if (unimin==5) { llPlaySound("5",1.0); } else if (unimin==6) { llPlaySound("6",1.0); } else if (unimin==7) { llPlaySound("7",1.0); } else if (unimin==8) { llPlaySound("8",1.0); } else if (unimin==9) { llPlaySound("9",1.0); } } else if (Minute<10) { if (unimin==1) { llPlaySound("1",1.0); } else if (unimin==2) { llPlaySound("2",1.0); } else if (unimin==3) { llPlaySound("3",1.0); } else if (unimin==4) { llPlaySound("4",1.0); } else if (unimin==5) { llPlaySound("5",1.0); } else if (unimin==6) { llPlaySound("6",1.0); } else if (unimin==7) { llPlaySound("7",1.0); } else if (unimin==8) { llPlaySound("8",1.0); } else if (unimin==9) { llPlaySound("9",1.0); } }
-
I'm working on a script but seem to be running into issues when it comes to having multiple requirements without having a specific order to which they are completed or confirmed as met to getting the script to work. For example, I am trying to design a breakable window, but I don't want anything under "x" amount of velocity to be allowed to damage the hit points. (this is only part of the script) collision(integer num) { if(vel < llVecMag(llDetectedVel(0)) && hp > 0) { llSetTexture("Broken",ALL_SIDES); } } If any of you can help I would greatly appreciate it, if you need more to help I'll be happy to give it and if you see that I'm doing anything wrong PLEASE let me know.. I'm getting frustrated with it.
-
Hi everyone! I just started learning how to script in LSL and I've got a little script now by using the web and the wiki. However, there's a tiny thing that I can't find: I want to set a float variable (let's say its called "cat" from 0.0 to 1.0 by using an "if" command). so in my noobbrain it would look like: if(channel == 0) { cat = 1) } However, this doesn't work. How would I make this work properly? Thank you very much for your time!