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
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Fri Apr 02, 2004 9:37 am   

Can someone tell me something?
 
Does #SUB actually replace the word for other people too? Or just for me? If only for me, what do I use to replace a word in the middle of a sentence so other people can see the change to, like if I was to say it or something. Example...

I type #ONINPUT {and} {#SUB 'n} it spits out the 'n everytime I type and. But will everyone else see that?

On a side note, what do I use to make letters capital if I type them that way, but not if I don't. Example...

I type #ONINPUT {%proper(greetings)} {#SUB %proper(greetin's)} it spits it out as capital no matter what... How do I make it so that if I myself don't type it as a capital letter, it stays lowercase. Thanks for all of the help.
Reply with quote
GooseFire
Novice


Joined: 08 Sep 2003
Posts: 32
Location: USA

PostPosted: Fri Apr 02, 2004 10:29 am   
 
Well, no one will see you sub'ing things because that's on your client. It doesnt effect the game in any way, just what you can see and do, like no one could effect the aliases you create on your client.

And, just change %proper with %lower and it'll make the first letter lowercase, I do believe.

#ONINPUT {%lower(greetings)} {#SUB %lower(greetin's)}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Apr 02, 2004 12:32 pm   
 
When using #SUB with #ONINPUT it replaces the text before it is sent. So it will do what you want.

For your greetings I would suggest either going more general:
#ONINPUT {ings} {#SUB {in's}}
or using a capture
#ONINPUT {(g)reetings} {#SUB {%1reetin's}}
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Fri Apr 02, 2004 5:31 pm   
 
Thanks guys.
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Fri Apr 02, 2004 5:54 pm   
 
Just to expand slightly on that... Is it possible to check for capitalization with a different letter? Say for instance I have:

#ONINPUT {(a)fter} {#SUB %1fter}

Is it possible to make the a a capital e? Thanks in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Apr 02, 2004 11:55 pm   
 
I guess you mean changing "after" to "efter" and "After" to "Efter". Quite easy:
#ONINPUT {(a)fter} {#SUB {%if(%isupper(%1),E,e)fter}}
Reply with quote
Ryntrax
Wanderer


Joined: 15 Mar 2004
Posts: 55
Location: USA

PostPosted: Sat Apr 03, 2004 1:51 am   
 
I have a script that needs to use a list to create #sub commands. basically #alias buildSubs {#forall @list {#sub <%i> {%ansi(color)<%i>}}} The script is working but I can not get the darn thing to create it in a specific class i have tried #sub %i {ansi} {subclassName} and it doesnt work like the #trig does. Any suggestions about how I can keep the <none> class from getting all cluttered up?
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Sat Apr 03, 2004 6:14 am   
 
Easy you say, but it doesn't work, it returns a capital E every time.

Please help.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Apr 03, 2004 10:42 am   
 
Hey Vijilante where is the help file for %isupper and %isproper are you inventing functions :P

TESTED AND WORKS
#ONINPUT {(a)fter} {#SUB {%if( %upper( %1)=%1, E, e)fter}}

Edit: Added this and more: For lack of a true/false function use a comparison or better yet make your own zmud function

#FUNC case {%if( %upper( %1)=%1, %upper(%1), %lower(%1))}

Example usage
#ONINPUT {(a)fter} {#SUB {@case(%1)fter}}
#ONINPUT {(y)ou} {#SUB {@case(%1)'all}}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Apr 03, 2004 5:10 pm   
 
Slightly simpler:
#ONIN {(a)fter} {#SUB {%if( %1 = A, E, e)fter}}
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Sun Apr 04, 2004 2:58 am   
 
Alright... I have a new one for you... With all of this that we have learned, is there also a way to make it so that it only replaces the one word, rather than letters in the middle of other words as well? Like for instance:

I have:
#ONINPUT {am} {#SUB beh}

I type:
say I am in Arkham.

It spits out:
You say 'I beh in Arkhbeh.'

Is there a way to make it so that it only reads that one full word?

Thanks for all of the help you've given me so far.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Apr 04, 2004 5:02 am   
 
Yes Include a space before and after the pattern

change this
#ONINPUT {am} {#sub bleh}

To this
#ONINPUT { am } {#sub bleh}
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Sun Apr 04, 2004 5:21 am   
 
Ah, that was too easy, thanks. Only one little correction that I found out. You need to spaces in the { am } part of things, otherwise it runs everything together. So just change { am } to { am }. Thanks a lot though.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Apr 04, 2004 5:47 am   
 
Nope just include the spaces in the #SUB *whaps himself for forgetting this*
#ONINPUT { am } {#sub { bleh }}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 04, 2004 6:02 pm   
 
There are two problems with that solution.
1. The word may be at the beginning of the line, in which case it won't have a space before it.
2. The word may be at the of the line, or have a punctuation mark following it, in which case it won't have a space after it.
The solution to these problems is to use the %q wildcard instead of a space.

%q = match any punctuation plus start and end of line

#ONIN {(%q)(a)m(%q)} {#SUB {%1%if( %2 = A, B, b)eh%3}}
Reply with quote
Jebikoje
Beginner


Joined: 07 Feb 2004
Posts: 10
Location: USA

PostPosted: Sun Apr 04, 2004 7:10 pm   
 
Rock on LightBulb, that would have been nice to know about four days ago. Thanks. Now I have everything working. I am gonna build a complete Dwarf Dictionary, with alias' and whatnot, and I'll post it on the Finished Scripts Forum. And it'll still run smoothly on zMUD 7.5.
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