|  | 
	
	
		| sponge-bob Beginner
 
 
 Joined: 10 Nov 2001
 Posts: 18
 
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 4:08 am 
 Trigger Help
 
 |  
				| In a trigger I have multible #if statements, is there a way to end a trigger if one of the #if statements is true, for example(this is off the top of my head) 
 Input:
 this color is red
 
 Trigger:
 ^this color is ({red|blue|green})
 
 Script:
 #if (%1="red") {%1=~%ansi~(high,red~)%1} {%1=~%ansi~(gray~)the default color}
 #if (%1="blue") {%1=~%ansi~(high,blue~)%1} {%1=~%ansi~(gray~)the default color}
 #if (%1="green") {%1=~%ansi~(high,green~)%1} {%1=~%ansi~(gray~)the default color}
 #show this is @%1
 
 Now if the input was "this color is red" then the output would end up being "this color is the default color" because in the scipt theres multible if so...
 
 #if (%1="red") {%1=~%ansi~(high,red~)%1} {%1=~%ansi~(gray~)the default color}
 the above would be true so then var %1 = (red) %1 then it goes to the next if
 
 #if (%1="blue") {%1=~%ansi~(high,blue~)%1} {%1=~%ansi~(gray~)the default color}
 sense %1 = (red) %1 from the first if statement this if statement is false so it make %1 = (gray) the default color, on to the next if
 
 #if (%1="green") {%1=~%ansi~(high,green~)%1} {%1=~%ansi~(gray~)the default color}
 sense %1 = (gray) the default color this statement is false so %1 = (gray) the default color again :) so after all that
 Input: this is red
 turns out
 Output: this is (gray)the default color
 
 the only way for this to turn out the way its sapose to be is if the input was this is green because in the script the last if statement is true so theres nothing to modify it, so i need a way to stop the trigger from continuing if a #if statement is true or a better easier way to do this cause im pretty sure there probably is a way :p thanks
 |  | 
	
	  |  | 
	
		|  | 
	
		| Aennor Apprentice
 
 
 Joined: 06 Dec 2001
 Posts: 131
 Location: USA
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 4:31 am 
 |  
				| quote:I believe the #abort command would fit this bill:In a trigger I have multible #if statements, is there a way to end a trigger if one of the #if statements is true
 
 
 #if (%1="red") {%1=~%ansi~(high,red~)%1} {#abort}{%1=~%ansi~(gray~)the default color}
 
 .... etc.
 
 Yout last comand then would never fire however so you would need to set a variable if true then execute an alias to do the #show command.
 
 Hope that makes sense... very tired.  Bad toothach, painkillers.... d  r i f t i n g off...
 
 If that doesn't do it and nobody else has popped up with the correct answer I'll look at it again in the Am after I get back from the dentist.
 
 --
 Aennor the Paragon of Gratuitous Agony
 Staff on WoTMUD
 wotmud.org 2222
 |  | 
	
	  |  | 
	
		|  | 
	
		| sponge-bob Beginner
 
 
 Joined: 10 Nov 2001
 Posts: 18
 
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 2:15 pm 
 |  
				| Ok thanks I get what your trying to say although you said it wrong ;p I think the correct way would be #if (%1="red") {%1=~%ansi~(high,red~)%1;(alias here to show it);#abort} {%1=~%ansi~(gray~)the default color}
 |  | 
	
	  |  | 
	
		|  | 
	
		| Kjata GURU
 
  
 Joined: 10 Oct 2000
 Posts: 4379
 Location: USA
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 4:30 pm 
 |  
				| Also, you can change the structure of your if's to have them all in one big if. Example: #IF (@a=1) {@a=1 - do something} {#IF (@2=2) {@a=2 - do something} {#IF (@2=3) {@a=3 - do something} {@a is neither 1, 2 or 3 - do something}}}
 
 Kjata
 |  | 
	
	  |  | 
	
		|  | 
	
		| LightBulb MASTER
 
 
 Joined: 28 Nov 2000
 Posts: 4817
 Location: USA
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 6:14 pm 
 |  
				| We already know it's not the default color because your trigger phrase requires it to be red, blue, or green. Therefore, it's only necessary to determine which of the three it is and act accordingly. As it turns out, there's no need for any #IF statements. 
 #TR {^this color is ({red|blue|green})} {%ansi(high,%1);#SHOW this is %1}
 
 LightBulb
 |  | 
	
	  |  | 
	
		|  | 
	
		| Aennor Apprentice
 
 
 Joined: 06 Dec 2001
 Posts: 131
 Location: USA
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 7:59 pm 
 |  
				| Yeah that. :P 
 Sorry was deep into pain killers at the time.  Oh well, that's why this is a community right?  :-)
 
 
 
 --
 Aennor the Paragon of Gratuitous Agony
 Staff on WoTMUD
 wotmud.org 2222
 |  | 
	
	  |  | 
	
		|  | 
	
		| sponge-bob Beginner
 
 
 Joined: 10 Nov 2001
 Posts: 18
 
 
 | 
			
			  |  Posted: Wed Dec 12, 2001 9:51 pm 
 |  
				| I like kjata's way :) never thought of it that way 
 |  | 
	
	  |  | 
	
		|  | 
	
		|  | 
	
		|  |