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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Sat Sep 08, 2007 5:00 am   

[2.03Pro] Pipes in status bar
 
I use pipes ( | ) to visually seperate sections of my statusbar text. However, in the latest version, they add extra junk into the view. I can change them to backslashes and the extra junk goes away. See image and code below:



Code:
<alias name="stats" id="15">
  <value><![CDATA[#ST {hp: @hppercent% cash: @cash exp: @exp | exp change: @expchange | smug: @pillvl jedi: @jedilvl dip: @diplvl | idle: %eval( 59 - %eval( @timeridle/ 60000))m %eval( 59 - %eval( %mod( @timeridle, 60000)/1000))s} "ExpMoney" "stats"]]></value>
</alias>


The @timeridle variable updates once per second with the current info from associated alarm.
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Sep 08, 2007 5:05 am   
 
Try putting quotes around the vertical | bar characters, or put a ~ in front of the bar characters. Remember that CMUD is parsing your status bar item as an "expanded string" and the bars might be confusing it into creating a string list instead.

I can't tell what the extra characters in your screen shot are. Are they quotes maybe? If so, then that means it's definitely parsing it as a string list.
Reply with quote
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Sat Sep 08, 2007 5:09 am   
 
I can't tell. They look like quotes, but that's purely a guess.

However, putting quotes around the pipes in the code worked just fine and seems to have fixed the problem.

EDIT: Yup double quotes:

Code:
"""""""hp: 100% cash: 957980 exp: 1595200 """"|"""" """"exp change: 242011 ""|"" ""smug: 0 jedi: 110000 dip: 49480
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Sep 08, 2007 5:16 am   
 
One way to think about status bars and windows is that they are similar to variables. So, the

#STATUS {value}

is similar to doing

#VAR varname {value}

In fact, they use the same parser. So sometimes you might need to quote special characters in your status bar. As I've fixed bugs in the parser to deal with things like string lists, that has had the side effect on the status bars. The parser used in zMUD to expand variables in the status bar was much simpler (slower and less powerful too), so it didn't have these problems. In CMUD, the status bar is compiled just like any other script or variable, so it needs to have the proper syntax to pass the compiler.

One thing that I might be able to do is enable the special flag in the parser that I use for handling string lists in trigger patterns. When using a string list in a regular expression, it's important to strip the quotes around the elements of the list. So I might try this for the status bar too. I'll experiment and see what I can do.

But it's good to know how CMUD works so that you can predict what might happen with other special characters in your status bar (like parenthesis for expression evaluation).
Reply with quote
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Sat Sep 08, 2007 5:37 am   
 
Well, I've got screenshots of that same statusbar working in version 1.34. It must have been related to all of the string list work you've done between now and then.
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Sep 08, 2007 5:41 am   
 
Yep, that's true. String lists were not being parsed properly in 1.34. They were getting stored as simple strings. In v2.0, they are converted to hash tables, and when they are converted back to strings, quotes are placed around the elements, allowing them to contain other lists or special characters. I thought it was only supposed to add the quotes if the element contained quotes or the | character itself, so it's something else for me to look into.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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