Jenna Huntsman Posted May 25, 2020 Share Posted May 25, 2020 (edited) Hey! I'm having trouble getting a script to read the incoming number from link_message, and if it doesn't match either numbers, then return. Here's the code I've got: if(number != (10006 || 10008)) { llWhisper(0, "Wrong number!\n" + (string)number + "::" + message); return; } I've tried the statement as many different forms, such as: number == !(10006 || 10008) number != 10006 || 10008 number != 10006 | 10008 number != (10006 | 10008) number == !(10006 | 10008) None of which seem to work properly. How can I perform this check? Edited May 25, 2020 by Jenna Huntsman Link to comment Share on other sites More sharing options...
Ruthven Ravenhurst Posted May 25, 2020 Share Posted May 25, 2020 (edited) 3 minutes ago, Jenna Huntsman said: if((number != 10006) || (number != 10008)) Also this should be an && test, as the OR will always result to true in this case, so: if((number != 10006) && (number != 10008)) Edited May 25, 2020 by Ruthven Ravenhurst Link to comment Share on other sites More sharing options...
Jenna Huntsman Posted May 25, 2020 Author Share Posted May 25, 2020 3 minutes ago, Ruthven Ravenhurst said: Thank you! Got it working, though had to modify your command a little - here's what I've got now: if((number != 10006) && (number != 10008)) 2 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 25, 2020 Share Posted May 25, 2020 (edited) I like to use llListFindList rather than a simple if...else comparison for tests like this because it's so much easier to add and remove items to test for: default { state_entry() { } touch_start(integer total_number) { integer iNeedle = 3; list lHaystack =[ 1,2,3,4,5 ]; if(~llListFindList(lHaystack,[iNeedle])){ llOwnerSay((string)iNeedle+" is an item in the list"); } else{ llOwnerSay((string)iNeedle+" is not an item in the list"); } } } Edited May 25, 2020 by Innula Zenovka 1 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