Shattered Kingdoms

Where Roleplay and Tactics Collide
VOTE NOW!
It is currently Mon Apr 29, 2024 12:27 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Fri May 07, 2010 6:19 am 
Offline
Mortal

Joined: Thu Feb 28, 2002 4:00 pm
Posts: 677
Location: The great white north
Rennus_Dragonsbane wrote:
Now, I know a fair number of people are going to hate me for all the scottish dwarves that will suddenly appear (I used it to give one my characters an accent), but I have created a script that will allow the replacement of words.


Create a text file called wordchange.txt in your zMud root directory with the format:
Code:
oldword1,newword1
oldword2,newword2
oldword3,newword3
oldwordn,newwordn


And the script:
Code:
#ALIAS say {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~say @message;#close 1}
#ALIAS sayto {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-2") {word=%word( "%-2", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~sayto %1 @message;#close 1}
#ALIAS yell {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~yell @message;#close 1}
#ALIAS tell {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-2") {word=%word( "%-2", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~tell %1 @message;#close 1}
#ALIAS reply {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~reply @message;#close 1}
#ALIAS gt {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~gt @message;#close 1}
#TRIGGER {Opened wordchange.txt as file 1} {#gag (1)}
#TRIGGER {Closed wordchange.txt on file 1} {#gag (1)}
And just enter your command and poof! Ach! Ya got another scottish dwarf!


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Mon Oct 03, 2011 4:53 pm 
Offline
Newbie

Joined: Mon Oct 03, 2011 4:51 pm
Posts: 1
Hey, dunno if you still play mud or whatever, but I love this trigger thing you have set up. Now would you be able to alter it to look for capital letters and apostrophe's? That would be most epic of you. Thanks a million.


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Dec 30, 2012 9:06 am 
Offline
Mortal

Joined: Sun Nov 18, 2012 12:49 pm
Posts: 258
I may need some help here as I'm trying to use word replacement in Zmud but failing quiet miserably. Tried to do some #SUB but that wasn't working out and then I stumbled upon this. Followed the directions but nothing is changed. Help!


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Dec 30, 2012 11:11 am 
Offline
Mortal

Joined: Wed Apr 24, 2002 11:51 am
Posts: 1500
drexalv wrote:
I may need some help here as I'm trying to use word replacement in Zmud but failing quiet miserably. Tried to do some #SUB but that wasn't working out and then I stumbled upon this. Followed the directions but nothing is changed. Help!


You need to describe exactly what you did, since I tested this script and it works fine.

Are you using Windows 7?


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Jan 06, 2013 2:25 pm 
Offline
Mortal

Joined: Sun Nov 18, 2012 12:49 pm
Posts: 258
ok well now when i send tells, sayto, reply, etc it opens and closes word change but none of my words are changing. Do I have type the changes in the txt file and if so how would it look?


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Jan 06, 2013 7:36 pm 
Offline
Mortal

Joined: Wed Apr 24, 2002 11:51 am
Posts: 1500
Yeah, open a notepad and enter the words you want to change. For example, if you wanted "Yes" to be replaced by "Aye" then enter the following in the notepad:

Yes, Aye

Enter each word you wanted replaced on its own line and then save it as wordchange (the .txt extension should be automatic with notepad unless you have changed the file association). Drop the file in your zMUD folder and it should work.


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Mon Jan 07, 2013 5:29 am 
Offline
Mortal

Joined: Sun Nov 18, 2012 12:49 pm
Posts: 258
Thanks Finny, I got it now.


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Jan 13, 2013 4:35 pm 
Offline
Mortal

Joined: Sun Nov 18, 2012 12:49 pm
Posts: 258
How would you get this to work for cabal and prayers? Also, is it possible to do what Jeb asks?

Jebikoje wrote:
Hey, dunno if you still play mud or whatever, but I love this trigger thing you have set up. Now would you be able to alter it to look for capital letters and apostrophe's? That would be most epic of you. Thanks a million.


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Sun Jan 13, 2013 10:12 pm 
Offline
Mortal

Joined: Wed Apr 24, 2002 11:51 am
Posts: 1500
drexalv wrote:
How would you get this to work for cabal and prayers? Also, is it possible to do what Jeb asks?

Jebikoje wrote:
Hey, dunno if you still play mud or whatever, but I love this trigger thing you have set up. Now would you be able to alter it to look for capital letters and apostrophe's? That would be most epic of you. Thanks a million.



Should be simple for cabal and prayers (see below). Not quite sure what you want on the second request. It should already be able to do that via what you enter on the wordchange.txt file. Give me an example of what you want it to do that it doesn't already do.

Code:
#ALIAS cb {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~cb @message;#close 1}
#ALIAS pray {#file 1 wordchange.txt;message="";#LOOP 1,%numwords( "%-1") {word=%word( "%-1", %i);#IF (%pos( %rightback( @word, 1), ",.;:!?")) {punct=%rightback( @word, 1);word=%leftback( @word, 1)} {punct=""};oword=%grep( 1, %concat( "^", @word, ","));#IF (@oword) { #IF (%numitems( @oword)>1) {oword=@word} {oword=%word( @oword, 2, ",");#IF (%pos( " (or) ", @oword)) {oword=%word( @oword, %random( 1, %numwords( @oword, " (or) ")), " (or) ")}}} {oword=@word};message=%concat( @message, @oword, @punct, " ")};message=%leftback( @message, 1);~pray @message;#close 1}


Top
 Profile  
Reply with quote  
 Post subject: Re: (zMud) Word Replacement - By Rennus_Dragonsbane
PostPosted: Mon Jan 14, 2013 10:15 am 
Offline
Mortal

Joined: Sun Nov 18, 2012 12:49 pm
Posts: 258
It won't capitalize the start of sentences by itself and just doing it in word change would make it always capitalized...unless..can it tell the difference of capitalization on the oldword? Example would be the difference between My and my so it would do Ma and ma?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group