Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: 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?
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: 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)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: 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 !=
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net