  | 
	
	
	
		Junker23 Newbie
 
  Joined: 15 Nov 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Thu Nov 15, 2001 5:06 pm   
  If statements   | 
			 
			
				Is it possible to have an if command turn off a class?  I get a sytnax error when using the following:  %if( @conc<"10", #class combat 0)  
 
 
Also is it possible to perform two commands when an if statement is true?  For example:  %if( @conc<"1", @leavedir and heal) | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		LightBulb MASTER
 
  Joined: 28 Nov 2000 Posts: 4817 Location: USA
  | 
		
		  
			
			   Posted: Thu Nov 15, 2001 6:58 pm      | 
			 
			
				What you are using is the IF function (%IF), which requires that all arguments be present. You get a syntax error because you left out the false response argument. You're also trying to use a "less than" operator with a string value ("10") instead of a numerical value (10), I'm not sure what the result will be.
 
 
The simplest solution would be to switch to the IF command (#IF), where the false response is optional and multiple commands are easily done.
 
 
#IF (@conc < 10) {#CLASS combat 0}
 
#IF (@conc < 1) {@leavedir;heal}
 
 
LightBulb | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Castaway GURU
  
  Joined: 10 Oct 2000 Posts: 793 Location: Swindon, England
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 9:29 am      | 
			 
			
				Turning off a class is done with #T- combat (and turning on with #T+ combat)
 
 
Lady C. | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		decantor Apprentice
 
  Joined: 14 Nov 2001 Posts: 100
 
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 3:14 pm      | 
			 
			
				You are probably running into problems simply because 1 is also less than 10. Unless the @leavedir;heal trigger(as well as the leavedir variable) is in a different class than 'combat', once the @conc variable is less than 10, your <1 trigger will no longer fire.
 
 
 
#IF (@conc < 10)&&(@conc > 1) {#t- combat}#IF (@conc < 1){[@leavedir;heal] #abort} | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Junker23 Newbie
 
  Joined: 15 Nov 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 5:06 pm      | 
			 
			
				Is there a way to differntiate between 10 and 1?
  | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Junker23 Newbie
 
  Joined: 15 Nov 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 5:10 pm      | 
			 
			
				Let me explain some more.  I have a trigger set up in the default (no)class.  The trigger is as follows:  #IF (@conc<1) {off;he;@leavedir}  The trigger kicks on everytime @conc is less than 10.  Is there anyway to fix this problem?
  | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		decantor Apprentice
 
  Joined: 14 Nov 2001 Posts: 100
 
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 5:24 pm      | 
			 
			
				define what it should do when @conc is less than 10 but greater than one using:
 
 
#IF (@conc > 1)&&(@conc < 10) {whatever_you_want_to_do} | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		LightBulb MASTER
 
  Joined: 28 Nov 2000 Posts: 4817 Location: USA
  | 
		
		  
			
			   Posted: Fri Nov 16, 2001 6:01 pm      | 
			 
			
				What is the value of @conc? That is, what is the script that creates/updates it? Are you sure it's a number and not a string? As I already pointed out, string comparisons don't work the same as numerical comparisons and it's only a numerical comparison if both sides are numerical.
 
 
Note to Lady C: I thought about pointing out the #T+/#T- commands, but reading through the helpfile for #CLASS it appears to be a proper, if unusual, method of controlling the class.
 
 
LightBulb | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Junker23 Newbie
 
  Joined: 15 Nov 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Sat Nov 17, 2001 12:08 am      | 
			 
			
				Well the trigger I am using to store the variable is C: &conc   Is there a way to make sure that this is stored as a number?
  | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		MattLofton GURU
 
  Joined: 23 Dec 2000 Posts: 4834 Location: USA
  | 
		
		  
			
			   Posted: Sat Nov 17, 2001 8:08 am      | 
			 
			
				quote: 
 
Well the trigger I am using to store the variable is C: &conc   Is there a way to make sure that this is stored as a number?
 
  
 
 
Yep.  You can modify your trigger pattern from 'C: &conc' to 'C: (%d)'.  The pattern will ensure the trigger ONLY fires when a number appears where (%d) is.  Then in the Value section of the trigger you'd assign %1 to @conc (ie, @conc = %1 or #VAR conc %1).
 
 
EDIT: technically, all variables are stored as strings.  I haven't a clue if the mathematical functions actually validate the data given to it, though.
 
 
li'l shmoe of Dragon's Gate MUD | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		| 
		
		 | 
	
	
		 |