|  | 
	
	
		| Qiz Novice
 
 
 Joined: 14 Aug 2006
 Posts: 34
 Location: Sweden
 
 | 
			
			  |  Posted: Sat Aug 19, 2006 8:44 pm 
 variable evaluation problems
 
 |  
				| I have two problems with variable evaluation. 
 First problem:
 ---------------------------------------------------------------------------
 ./multiAdept/numSpell = %numitems( @./multiAdept/adeptList)
 #SHOW numSpell: @./multiAdept/numSpell
 #BREAK
 #WHILE (@./multiAdept/numSpell <> 0 ) {
 #SHOW NumSpell: @./multiAdept/numSpell
 }
 
 The first #SHOW is executed and shows:
 numSpell: 3
 Execution breaks and I evaluate numSpell with mouse over and value still shows as 3.
 However, the execution never enters the WHILE loop.
 
 
 Second problem:
 ---------------------------------------------------------------------------
 MUD output:
 New        Old
 Dexterity        13          15
 Intelligence     10           9
 
 Trigger on pattern: ^(%w)%s(%d)
 #IF (%1 = "Intelligence") {
 INT = %2
 }
 
 Once all stats have been stored it goes through to check that all are acceptable
 #IF (@INT >= %item( @{minStats@charClass}, @intPos)) {
 acceptStats = 1
 #SHOW INT ok
 } {acceptStats = 0}
 However, this evaluates to true when 5<= @INT <= 9, and false if @INT > 9. It is supopsed to evaluate to true whenever @INT >= 5. Is the variable considered to be a string?
 |  | 
	
	  |  | 
	
		|  | 
	
		| Rorso Wizard
 
 
 Joined: 14 Oct 2000
 Posts: 1368
 
 
 | 
			
			  |  Posted: Sat Aug 19, 2006 10:48 pm   Re: variable evaluation problems 
 |  
				| 
 
	  | Qiz wrote: |  
	  | I have two problems with variable evaluation. 
 First problem:
 ---------------------------------------------------------------------------
 ./multiAdept/numSpell = %numitems( @./multiAdept/adeptList)
 #SHOW numSpell: @./multiAdept/numSpell
 #BREAK
 #WHILE (@./multiAdept/numSpell <> 0 ) {
 #SHOW NumSpell: @./multiAdept/numSpell
 }
 
 The first #SHOW is executed and shows:
 numSpell: 3
 Execution breaks and I evaluate numSpell with mouse over and value still shows as 3.
 However, the execution never enters the WHILE loop.
 
 |  Try remove the space before ')':
 #WHILE (@./multiAdept/numSpell <> 0 )
 --->
 #WHILE (@./multiAdept/numSpell <> 0)
 |  | 
	
	  |  | 
	
		|  | 
	
		| MattLofton GURU
 
 
 Joined: 23 Dec 2000
 Posts: 4834
 Location: USA
 
 | 
			
			  |  Posted: Sun Aug 20, 2006 4:49 am 
 |  
				| Does ZMud support <>?  I know it does support !=, but I've never really seen or used <> within ZMud.  Could be you're using an invalid operator. 
 |  | 
	
	  | 
		    
			  | _________________ EDIT: I didn't like my old signature
 |   |  | 
	
		|  | 
	
		| Qiz Novice
 
 
 Joined: 14 Aug 2006
 Posts: 34
 Location: Sweden
 
 | 
			
			  |  Posted: Sun Aug 20, 2006 11:30 am   Re: variable evaluation problems 
 |  
				| 
 
	  | Rorso wrote: |  
	  | Try remove the space before ')': #WHILE (@./multiAdept/numSpell <> 0 )
 --->
 #WHILE (@./multiAdept/numSpell <> 0)
 |  
 Thanks for the input. The problem was indeed the ' ' before the ')'. Space removed, problem solved.
 
 And the <> is supported as well as the !=
 |  | 
	
	  |  | 
	
		|  | 
	
		| Vijilante SubAdmin
 
  
 Joined: 18 Nov 2001
 Posts: 5187
 
 
 | 
			
			  |  Posted: Sun Aug 20, 2006 7:50 pm 
 |  
				| Your second problem is caused by a small oddity.  The %item function returns results with quotes around them, although it is extremely hard to ever catch it doing it.  This causes the evaultion preformed by the #IF to operate on a string basis instead of a mathematical basis.  Use %number to fix this. #IF (@INT >= %number(%item( @{minStats@charClass}, @intPos))) {
 |  | 
	
	  | 
		    
			  | _________________ The only good questions are the ones we have never answered before.
 Search the Forums
 |   |  | 
	
		|  | 
	
		|  | 
	
		|  |