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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: 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.
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: 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.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: 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, ",")
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: Thu Nov 27, 2003 10:10 pm   
 
quote:
Originally posted by Oracle
#VARIABLE VTemp %word( %concat( %string( %1), ","), 1, ",")


uh-huh
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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.
Reply with quote
Talmark
Novice


Joined: 22 Nov 2003
Posts: 34

PostPosted: 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 -.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: 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?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Sat Nov 29, 2003 6:46 am   
 
Not a problem, I used Vijilante's suggestion and it worked fine.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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