Jump to content

LSL IF OR statement


Jenna Huntsman
 Share

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

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

Recommended Posts

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 by Jenna Huntsman
Link to comment
Share on other sites

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 by Innula Zenovka
  • Like 1
Link to comment
Share on other sites

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