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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ilhares
Newbie


Joined: 29 Apr 2011
Posts: 6

PostPosted: Fri Apr 29, 2011 10:06 pm   

Variable string assistance required (space compression)
 
I am willing to acnkowledge I may just be an idiot, but I've searched all over and not found this same problem yet. The MUD where I spend most of my time has a number of public 'radio frequency' channels. For one character in particular, I keep their radio set to scan the full spectrum most of the time, only changing it when they need to broadcast. For simplicity, I turned this into an alias with variable use.

The problem I am encountering is that the text, as typed, is not being correctly broadcast - namely, it is being stripped of extra spacing between words. I may be in the minority, but I and several other players come from the school of typing where you double-space it after periods. Once the text gets loaded into the variable, it loses this. Is there some flag somewhere I can set to prevent this? It isn't just following the periods, it's any irregular spacing that gets removed so far.

Alias: "BR"
Code:
#VA radmes {%0}
radio center @freq
broad @radmes
rs


If the radio is centered ahead of time and I type "broad This ·········· place needs ·········· WORK!", it will broadcast "This ·········· place needs ·········· WORK!". Using the alias, @radmes contains "This place needs WORK!"

Help, insight, criticism?
(edited to hardcode spacing in, it seems this forum ALSO condenses the extra spaces)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Apr 29, 2011 10:19 pm   
 
I assume you use the alias like so:

br blah blah blah

This is natural, but it also causes CMud to ignore extra spacing just like HTML. The only way to prevent this is by using quotes.
_________________
EDIT: I didn't like my old signature
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Fri Apr 29, 2011 11:52 pm   
 
If you make an 'oninput' type trigger that recognizes user input beginning with br, instead of making 'br' an alias, it will maintain any irregular spacing you might use.

ie:
Code:
<cmud>
  <trigger type="Command Input" priority="5000">
    <pattern>^br (*)$</pattern>
    <value>radmes = %1
radio center @freq
broad @radmes
rs</value>
  </trigger>
</cmud>
Reply with quote
ilhares
Newbie


Joined: 29 Apr 2011
Posts: 6

PostPosted: Sat Apr 30, 2011 3:19 am   
 
DraxDrax, thank you. I'm not accustom to punching them in via the XML, but once I figured out where my head was and pulled it out, this worked perfectly.
Reply with quote
DraxDrax
Apprentice


Joined: 22 Mar 2009
Posts: 149

PostPosted: Sat Apr 30, 2011 11:23 pm   
 
No problem. Glad I could help!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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