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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
shade_the_third
Newbie


Joined: 20 Aug 2007
Posts: 1

PostPosted: Mon Aug 20, 2007 6:38 pm   

Issue with local variable and %i
 
What it's -supposed- to do is this:

Today is the 17th of Estar, 184 years after the Coming of Estarra. The phase of the moon is that of the Waxing Crescent.
[Herb System]: The following herbs are in hibernation: merbloom, flax, myrtle, weed.

What it does however is this:

Today is the 17th of Estar, 184 years after the Coming of Estarra. The phase of the moon is that of the Waxing Crescent.
[Herb System]: The following herbs are in hibernation: flax, flax, myrtle, weed.

#trigger{^Today is the (%d){st|nd|rd|th} of (%w), (%d) years after the Coming of Estarra. The phase of the moon is that of (*).$} {
#local $alert
#forall @herbHibernation.%lower(%2) {
#switch ($alert=%null) {
$alert = %i
} ($alert!=%null) {
$alert = %concat($alert,", ",%i)
}
}
herbSysAlert The following herbs are in hibernation: $alert.}

(didn't know how to list the variable so.. here we go)
#LOOPDB @herbHibernation {#SAY Key - %key Value - %val}
Key - date Value - dioni
Key - estar Value - merbloom|flax|myrtle|weed
Key - urlachmar Value - kafe
Key - kiani Value - colewort
Key - dioni Value - calamus|earwort|juniper|kombu|sage
Key - vestian Value - wormwood|horehound
Key - avenchary Value - mistletoe
Key - dvarsh Value - sparkleberry
Key - tzarin Value - reishi|sargassum
Key - klangiary Value - arnica|pennyroyal
Key - juliary Value - coltsfoot|faeleaf
Key - shanthin Value - galingale|marjoram|rosehips
Key - roarkian Value - chervil|yarrow

As far as I've seen the issue seems to be $alert having the same value as %i.

If I change the code to this:

#local $alert
#forall @herbHibernation.%lower(%2) {
#switch ($alert=%null) {
$alert = %i
#echo $alert
} ($alert!=%null) {
#echo $alert
}
}


Today is the 17th of estar, 184 years after the Coming of Estarra. The phase of the moon is that of the Waxing Crescent.
merbloom
flax
myrtle
weed

I only set $alert -once-, it should remain at 'merbloom' the whole time however it changes each time as if it was %i instead.

EDIT: It only happens if $alert has the same value as %i. If I set $alert to 'merbloom1' for example it would execute fine.

Any idea what I could do to fix that?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Aug 20, 2007 8:06 pm   
 
Yep, that was a bug in v1.34. It was assigning the direct pointer of %i to the $alert variable, and changing $alert then had the side effect of changing %i. This is already fixed for v2.0.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Aug 20, 2007 8:57 pm   
 
You could use %expandlist to accomplish those many lines with just one line, by the way. Smile
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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