AnaZofia Posted October 5, 2012 Share Posted October 5, 2012 Hi Im trying to get a script to work Can anyone please help me? (im new to scripting)Here is what i gotso far: default { state_entry() { llListen( 10, "", NULL_KEY, "" ); } listen( integer channel, string name, key id, string message ) { if ( message == "open sesame" ) { llWhisper( 0, "Welcome, sesame!" ); } { if ( message == "open" ) { llWhisper( 0, "Welcome, open!" ); } { if ( message == "open3" ) { llWhisper( 0, "Welcome, open3!" ); } else { llWhisper( 0, "That's not the magic word." ); } } } } } Link to comment Share on other sites More sharing options...
Restless Swords Posted October 5, 2012 Share Posted October 5, 2012 the else only applies to the last if. you probably want: if xxxx else if xxxxx else if xxxx else 1 Link to comment Share on other sites More sharing options...
outtaspace Posted October 5, 2012 Share Posted October 5, 2012 need to use else if also far to many { in there default{ state_entry() { llListen( 10, "", NULL_KEY, "" ); } listen( integer channel, string name, key id, string message ) { if ( message == "open sesame" ) { llWhisper( 0, "Welcome, sesame!" ); } else if ( message == "open" ) { llWhisper( 0, "Welcome, open!" ); } else if ( message == "open3" ) { llWhisper( 0, "Welcome, open3!" ); } else { llWhisper( 0, "That's not the magic word." ); } }} 1 Link to comment Share on other sites More sharing options...
AnaZofia Posted October 5, 2012 Author Share Posted October 5, 2012 Tanks to both of you! It worked now Link to comment Share on other sites More sharing options...
steph Arnott Posted October 17, 2012 Share Posted October 17, 2012 if ( message == "open sesame" ) { llWhisper( 0, "Welcome, sesame!" ); } { //this is incorrect and not needed if ( message == "open" ) { llWhisper( 0, "Welcome, open!" ); } {// this to simple logik, am i doing this or not. ie if { im rich say wow } else if { im poor say oh well, im healthy } else { im off for a cup of coffee, nothing of any use here. } you are asking a true or false question. when the statement is false it will go to the next true or false line and so on. also the else statement is more of conclusoin that nothig fits the true or false statements. 1 Link to comment Share on other sites More sharing options...
AnaZofia Posted October 30, 2012 Author Share Posted October 30, 2012 thanks steph 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