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
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sat Mar 21, 2009 7:18 pm   

How do I insert print an MXP type color through #print?
 
I was using %ansi, as in:

#print Color: %ansi(green) is color green

But when I started using different colors, %ansi will not work, ie:

#print Color: %ansi(lime) is color lime

What's the alternative for doing this with mxp colors? I've looked through the help and this is what I've found:

%color - Returns a color code (number)
#color - Changes the last line (Not what I need)
#cw - Used after a trigger (Not what I need)
#pcol - Used after a trigger (Not what I need)
#cw - Used after a trigger (Not what I need)
#mxp - Is this what I need?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Mar 21, 2009 7:36 pm   
 
Why not just use #PRINT "Color: <color green> is color green</color>"?
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sat Mar 21, 2009 7:57 pm   
 
I didn't know that syntax existed, but it's exactly what I need. This syntax was listed under the #MXP command so I thought I needed to somehow signal it was MXP before something like this would work.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Mar 21, 2009 8:16 pm   
 
I see. But there is a link from the #MXP command help article to another one: mxp All the details are there.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sun Mar 22, 2009 3:58 am   
 
Are there any methods of coloring text that can be passed returned through a function return, like this?

#return %ansi(blue)Text%ansi(default)
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sun Mar 22, 2009 9:05 am   
 
ReedN,

these <color></color> tags are just a plain text. You may concatenate them in any way you want and return them as text. They (the tags) will color your text only when a string with them will reach some text-printing zScript command.

I've carved up a piece of code from my old session as an example:
Code:

#WINDOW Errors %ansi(high,red)$strSource":: <color darkgoldenrod>"@expandColor($strMsg, "burlywood")"</color>";

=========================

<func name="expandColor" id="515">
  <value><![CDATA[#IF ($strParamColor == "")
{
  $strParamColor = "white";
}
#RETURN %replace(%replace($strSource, "<PS>", %concat("<color ", $strParamColor, ">")), "<PE>", %concat("</color>"));]]></value>
  <arglist>$strSource, $strParamColor</arglist>
  <notes><![CDATA[This function expands predefined color tags to proper mxp tags. The primary usage of this function is for reducing the length of strings passed to aliases or event handlers.
Known tag pairs are: <PS><PE> - parameter start and parameter end, will be replaced with color tags with $strParamColor color (if specified)
Usage: #SAY @expandColor("This is a <PS>great test!<PE>", "blue")]]></notes>
</func>


Beware though, being a plain text, tags change the length of a string.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sun Mar 22, 2009 2:58 pm   
 
Ah, perfect Arde.

I had actually tried using it this way yesterday, but since I didn't have the 'Force Remote MXP' option checked it wasn't working, but with your example to go by I tracked it back to that option.

Thanks for all your 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