Shattered Kingdoms https://shatteredkingdoms.org/forums/ |
|
(zMud) Word Replacement - By Rennus_Dragonsbane https://shatteredkingdoms.org/forums/viewtopic.php?f=42&t=20222 |
Page 1 of 2 |
Author: | Rennus_Dragonsbane [ Fri May 07, 2010 6:19 am ] |
Post subject: | (zMud) Word Replacement - By Rennus_Dragonsbane |
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} And just enter your command and poof! Ach! Ya got another scottish dwarf!
#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)} |
Author: | Jebikoje [ Mon Oct 03, 2011 4:53 pm ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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. |
Author: | drexalv [ Sun Dec 30, 2012 9:06 am ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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! |
Author: | FinneyOwnzU [ Sun Dec 30, 2012 11:11 am ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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? |
Author: | drexalv [ Sun Jan 06, 2013 2:25 pm ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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? |
Author: | FinneyOwnzU [ Sun Jan 06, 2013 7:36 pm ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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. |
Author: | drexalv [ Mon Jan 07, 2013 5:29 am ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
Thanks Finny, I got it now. |
Author: | drexalv [ Sun Jan 13, 2013 4:35 pm ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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.
|
Author: | FinneyOwnzU [ Sun Jan 13, 2013 10:12 pm ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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} |
Author: | drexalv [ Mon Jan 14, 2013 10:15 am ] |
Post subject: | Re: (zMud) Word Replacement - By Rennus_Dragonsbane |
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? |
Page 1 of 2 | All times are UTC - 8 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |