| View previous topic :: View next topic |
| Author |
Message |
rosc
Joined: 13 Dec 2004 Posts: 115
|
Posted: Wed Dec 07, 2005 4:43 pm Post subject: uniq? |
|
|
Is there a way to format a string/var to only contain 1 unique instance of a word?
And if not, can you add such a function? =)
Working on a script that will do like:
#act {You feel less protected.} {`var {needspells} {$needspells armor protection}
("You feel less protected" is a trigger for 2 different spells, 'armor' and 'protection')
If both spells go off at the same time, i'd have like "var $needspells armor protection armor protection"
which would be a needless duplication further along in the script when the spells are being casted.
So i'm looking for a way to only append a string to a var, if it is not already in the var (unique).
Maybe some function in #format can be added to accomplish this?
Thanks :) |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Dec 08, 2005 5:41 pm Post subject: |
|
|
You can check it like this: #if {"$needspells" == "*armor protection*"} {#showme var is already set}
The * is regexp. |
|
| Back to top |
|
 |
moebius
Joined: 27 Jan 2005 Posts: 96
|
Posted: Fri Dec 09, 2005 12:34 am Post subject: |
|
|
Technically the * is a wildcard. It would need to be ".*armor protection.*" to be a regexp. _________________ StrangeMUD - strangemud.net:9332 |
|
| Back to top |
|
 |
|