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
ArbiterOne
Newbie


Joined: 25 Nov 2004
Posts: 4

PostPosted: Tue Nov 01, 2005 1:39 pm   

Alias for capitalization and punctuation in says/tells/etc?
 
Is there a way to automatically capitalize sentences, and add punctuation if there isn't already (defaulting to a period)?

i.e.

say testing
You say, 'Testing.'
say testing!
You say, 'Testing!'
say Testing
You say, 'Testing.'

I've searched the forums and haven't found anything illuminating.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Nov 01, 2005 2:02 pm   
 
for the caps use the %proper() format.
But of course you'll have to do either as an oninput or an alias

#alias say {~say %proper(%1)}

typed: say test
result: You say 'Test'

so that works.

as for the punctuation, that's more like using %replace, but not sure how that would be done.
_________________
http://www.Aardwolf.com
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Tue Nov 01, 2005 6:47 pm   
 
well if aliasing, this could very easily be done as such
pattern: say
value #send {say %proper(%1).}

Tested and it works.
_________________


Look at me I've got zSKILLS
Reply with quote
ArbiterOne
Newbie


Joined: 25 Nov 2004
Posts: 4

PostPosted: Tue Nov 01, 2005 7:16 pm   
 
The point is, I would want to add punctuation only if there wasn't punctuation there already. What you propose would result in:

say what the heck?
You say, "What the heck?."

Also, for some reason using %proper removes commas. Is there a way to avoid this?
Reply with quote
Kiasyn
Apprentice


Joined: 05 Dec 2004
Posts: 196
Location: New Zealand

PostPosted: Tue Nov 01, 2005 9:01 pm   
 
#send {say %proper("%-1")%if(!%ismember(%rightback(%proper("%-1"),1),"?|.|!"))}
_________________
Kiasyn
Owner of Legends of Drazon
Coder on Dark Legacy
Check out Talon, an easy IMC connection.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Tue Nov 01, 2005 9:51 pm   
 
Or try this:
Code:
#ALIAS say {~say %proper( %1) %-2%if( !%match( %rightback( %-1, 1), "%p"), ., %null)}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Nov 01, 2005 10:01 pm   
 
If you only want to do it with 'say' this would work:
#ONINPUT {^say (*)$} {#IF (%match(%rightback("%1",1),"[.!?]")=0) {say %proper("%1").} {say %proper("%1")}}
If you want to cover more channels then this will do better:
#ONINPUT {^((?:say|tell \w+|ask)) (.*)$} {#IF (%match(%rightback("%2",1),"[.!?]")=0) {#SUB {%1 %proper("%2").}} {#SUB {%1 %proper("%2")}}} "" {regex}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ArbiterOne
Newbie


Joined: 25 Nov 2004
Posts: 4

PostPosted: Wed Nov 02, 2005 5:25 pm   
 
I ended up going with this, as %proper would lowercase the rest of my sentence- not what I wanted.

#ONINPUT {^((?:say*|te*l* \w+|ask|')) *(.)(.*)$} {#IF (%match( %rightback( "%3", 1), "[.!?]")=0) {#SUB {%1 %proper("%2")%3.}} {#SUB {%1 %proper("%2")%3}}} "" {regex}

(and for anyone searching: punctuation capitalization autopunctuate autopunctuation)

Thanks, everyone!
Reply with quote
OmegaDeus
Apprentice


Joined: 14 Sep 2005
Posts: 121

PostPosted: Wed Nov 02, 2005 8:34 pm   
 
well, that's the point of proper casing a sentence. Only the first word and proper nouns are supposed to be capitolized.
_________________


Look at me I've got zSKILLS
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