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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Mon Nov 17, 2008 4:23 pm   

Replacing carriage returns, maybe even tabs?
 
Like many MUSHes, the one that I've begun to play in addition to my MUD has the ability to put in line breaks with %r and tabs with %t. I was wondering if there was a way to make an oninput that searches any text I'm sending in and replaces line breaks with %r and maybe even tabs with %t?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Nov 18, 2008 5:28 pm   
 
I'm not quite clear on when you can use these codes on your mush. Surely you can't put linebreaks into your conversations, for instance? I'm guessing that this is used when creating new content within the mush, room descriptions and the like?

I don't think that cmud can replace line breaks on the command line with %r, because line breaks are how you tell cmud to send a line to the mud. Each line in the command line is parsed separately. And tabs don't work on the command line either, as far as I can tell. So I don't see any way to do what you are thinking. Any alternative method I can think of is no easier than simply typing %r or %t when you want to.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 18, 2008 11:40 pm   
 
Are you talking about the literal string "%r" or are you talking about the control code \0x0a?
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 12:45 am   
 
%r in most mushes creates a line break. The thing is, since %r and %t perform those particular operations, the only way you can have such things in notes or mail is to have everything on the same line with those put in. I just thought it would cool if I could write it like normal, then, when it's sent to the MUSH, have everything converted.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Nov 19, 2008 2:41 am   
 
But do you want to send the literal string or the control code?
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 12:35 pm   
 
Well the MUSH will see the literal string as the code, won't it?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Nov 19, 2008 2:05 pm   
 
No, the mush will probably see it as the literal string, and reformat it for display. And Tech is asking what you are trying to SEND, not how the mush will interpret it. I believe you are trying to send the literal string %r, correct?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Nov 19, 2008 2:54 pm   
 
I really don't kow. I've never played a MUSH so I don't have any frame of reference, that's why I'm trying to determine exactly what it is you want to send.
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Nov 19, 2008 3:09 pm   
 
Rahab wrote:
No, the mush will probably see it as the literal string, and reformat it for display. And Tech is asking what you are trying to SEND, not how the mush will interpret it. I believe you are trying to send the literal string %r, correct?


Right, that's what I'm saying. Literally sending %r to the MUSH should still be converted, so yes.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Nov 19, 2008 8:50 pm   
 
Here's a bit more detail on why I don't think a simple oninput trigger will work. Suppose you get something like the following onto the command line:
Quote:

This is a very long
set of sentences, all
on the command line

Here is my understanding of how it will work. When you hit return, it will try to parse "This is a very long", running it through triggers and aliases. After deciding it is not a cmud command, it will send it to the mush. Then it will do the same with "set of sentences, all", and finally with "on the command line". None of those strings contain a line break, so an oninput trigger cannot replace line breaks with "%r". As for tabs, you can't even put a tab on the command line.

There is one way I can think of to do something like what you want. Create an alias, say 'writemail', which activates a couple oninput triggers. One of the triggers, with a priority set so it goes first, looks for a line 'endmail', which causes it to deactivate both triggers and #send the contents of a variable @mailcontent. The second oninput trigger grabs everything you type and appends it to @mailcontent, followed by "%r". Maybe you could also have a macro keyed to TAB, which would do #sendraw "%t" or something like that, which could also be turned on and off with the oninput triggers. I haven't played with macros before, so I don't know whether you can do that part.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sun Nov 23, 2008 4:17 am   
 
Rahab is write... I've been experimenting with it. You can get the '\t' to '%t' conversion, but I haven't been able to figure out a way to get the '%r' from the carriage return. Especially if it's not fixed.

Assuming you want to send the '%r' on every line, this is the best I could come up with.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger type="Command Input" priority="20" trigontrig="false" regex="true" copy="yes">
    <pattern>^(.*)$</pattern>
    <value>#SHOW %concat(%subregex(%1,"\t","%t"),"%r")</value>
  </trigger>
</cmud>
_________________
Asati di tempari!
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sun Nov 23, 2008 1:59 pm   
 
*nods* Thanks for the help, it gives me stuff to consider. I wasn't certain it could be done, but I wanted to ask just in case.
_________________
Listen to my Guitar - If you like it, listen to more
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