|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Thu Nov 27, 2003 7:54 am
Possible %String() bug? |
Not sure if this is truly a bug or not but doesn't make sense to me.
If you use the %string() and if there is a hyphen, the end result is a 0.
So, if you did the following you will see what I mean.
#show %string(jim-bob)
Displays: "0"
So, a bug?
I'm also using Zmud 6.62. |
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Thu Nov 27, 2003 9:58 am |
Try encasing your string constant in quotes. Why you would need to use %string for constant strings is beyond me, though. For variables, no quoting is necessary.
|
|
|
|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Thu Nov 27, 2003 8:00 pm |
%String(jim-bob) was just an example, my script doesn't use constants to do this but instead does the following:
#VARIABLE VTemp %word( %concat( %string( %1), ","), 1, ",") |
|
|
|
hatespyware Apprentice
Joined: 16 Dec 2002 Posts: 103
|
Posted: Thu Nov 27, 2003 10:10 pm |
quote: Originally posted by Oracle
#VARIABLE VTemp %word( %concat( %string( %1), ","), 1, ",")
uh-huh |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Nov 28, 2003 6:24 pm |
All the string function does is internally apply a set of quotes to its parameter. In the case of what you want to do it is better to simply type the quotes there. Also the %word function returns everything up to the delimeter character for word 1, and between delimeters for other words. End of string is forced as a delimeter so your variable assignment can be simplified to:
#VAR VTemp %word("%1",1,",")
Also of note the %word function applies quotes internally to its return value which provides a proper marker for the #VARIABLE command to understand that it is all one parameter. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Nov 28, 2003 6:49 pm |
Even better would be to change your pattern wildcards so that %1 picks up the information you're interested in without need for additional manipulation.
|
|
|
|
Talmark Novice
Joined: 22 Nov 2003 Posts: 34
|
Posted: Fri Nov 28, 2003 9:09 pm |
If you're trying to match words with hyphens, you might try using %x in the trigger pattern instead of %w. %x will match any amount of non-white space, so it won't be stopped at the -.
|
|
|
|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Fri Nov 28, 2003 10:12 pm |
quote: Originally posted by LightBulb
Even better would be to change your pattern wildcards so that %1 picks up the information you're interested in without need for additional manipulation.
Do you have an example of this?
I read if you put the paramenter is brackets {} this would change the input to a string. Is this what you mean? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Nov 29, 2003 2:11 am |
Since you haven't given us the slightest clue to what MUD output you're trying to match, no I don't have an example.
|
|
|
|
Oracle Apprentice
Joined: 29 May 2002 Posts: 121
|
Posted: Sat Nov 29, 2003 6:46 am |
Not a problem, I used Vijilante's suggestion and it worked fine.
|
|
|
|
|
|