|
Cbisazza Wanderer
Joined: 27 Feb 2003 Posts: 69 Location: Australia
|
Posted: Thu Sep 04, 2003 5:35 am
Eliminating spaces ... |
I'm trying to assign item properties to variables in numeric form (rather than text form as they appear off the MUD).
A typical example is the text:
You rub the orb with both hands, sensing no energy whatsoever.
What I want to do is to match the "no energy whatsoever" part, and translate it to a numeric sequence .... so that at the end the variable @ORB contains a number ... from 0-13 corresponding to the energy state of the orb as sensed.
I have done this in the past, but it has always been possible to reduce the match to a single word. What I usually do is something of the form:
#VAR {orbstate.no energy whatsoever} 0
and then assign it to the variable.
However, this does not work in this case as the variable is illegal.
What I'm doing now is manipulating the string to eliminate the spaces. My question is ... is there some easier way to achieve this?
Thanks, |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Sep 04, 2003 1:13 pm |
Use the other, conventional methods of accessing record variables. To create the key with it's corresponding value you would do:
#ADDKEY orbstate {no energy whatsoever} {0}
To retrieve the value of this key, you use the %db function:
#SH %db(@orbstate, "no energy whatsoever") |
|
|
|
|
|
|
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
|
|