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
aduan
Newbie


Joined: 12 Jul 2008
Posts: 4

PostPosted: Sun Jul 13, 2008 4:03 pm   

%key, %val challenge
 
I have the following problem since i updated to cmud.

This executes just fine. However it won't set the value to 0. I am trying to set the value belonging to the current key to 0 and somehow i'm at a loss there.

#loopdb @herbafflictions {#if (@illprev.illherb=%val) {#var herbafflictions.%key 0}

I'd really appreciate a clue here.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Jul 13, 2008 4:29 pm   
 
Two options:

#addkey herbafflictions %key 0

or

#var %concat("herbafflictions.",%key) 0

The reason this fails is that the %key is being seen as part of the literal string that makes up the variable name, and isn't evaluated. You end up setting the key "%key" (that is, the string "%key") to 0 instead.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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