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
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sat Apr 06, 2002 7:41 pm   

Possible Difficult Script - Please Read Need Help
 
hi,
I am trying to write a script that will make up to a ten letter word from every possible letter in the English alphabet.
Basically i want it to look like this
say a
say aa
say aaa
say aaaa
say aaaaa
say aaaaaa
say aaaaaaa
say up to 10 a's then continue
say ab
say aba
say abaa (etc)
say abb
say abba etc
say up to 10 z's

Is this even possible and if so how could i do it without doing it so fast it spams the mud and kicks me everytime i try it *snicker*

Reavor
Reply with quote
heidi
Newbie


Joined: 04 May 2002
Posts: 1

PostPosted: Sat Apr 06, 2002 9:55 pm   
 
Well, this isn't much of a task in a programming language that has allowances for recursive procedure calls. But, for zMud scripts this will be difficult. It's not impossible, but it makes far more sense to do the following:

1) Use another language to create a text file with the word list. This will be huge (26 ^ 10 characters for lowercase only).

2) Create an alias that will open this file and send each line to the mud with a suitable #Wait in each loop.

3) Prepare to have your IPAddress banned from that mud forever.

Enjoy,

El_Dickman
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Apr 06, 2002 11:15 pm   
 
Quite simple really. First off your specification does not mention case, so i will figure it to be irrelevant. I don't really see that the order in which the psuedo words is done to be important so I will write it to output them in the order that is easiest.

#CLASS WordMaker
#VAR CurrentWord {}
#VAR TempWord {}
#VAR BuildCounter {0}
#VAR CarryFlag {0}
#ALIAS StartMakingWords {CurrentWord="a";#ALARM "WordSendAlarm" {*1} {#IF (%trigger(WordMaker) {say @CurrentWord;UpdateWord} {#UNTRIGGER WordSendAlarm}}}
#ALIAS UpdateWord {BuildCounter=%len(@CurrentWord);TempWord="";CarryFlag=1;#WHILE (@BuildCounter) {#IF (%copy(@CurrentWord,@BuildCounter,1))="z") {#IF (@CarryFlag) {TempWord=%concat("a",@TempWord);CarryFlag=0} {TempWord=%concat(%copy(@CurrentWord,@BuildCounter,1),@TempWord)}} {#IF (@CarryFlag) {TempWord=%concat(%char(%eval(%ascii(%copy(@CurrentWord,@BuildCounter,1))+1)),@TempWord);CarryFlag=0} {TempWord=%concat(%copy(@CurrentWord,@BuildCounter,1),@TempWord)};#ADD BuildCounter -1};#IF (%len(@TempWord<11) {CurrentWord=@TempWord} {#T- WordMaker}}
#CLASS 0

That is off the top of my head so I haven't tested it. I may have made a few typos.
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 07, 2002 2:10 am   
 
hi,
Ok, im still working on this, but so far all it does is spam my screen even with triggers disabled with say a hehe, i prob didn't get something copied write so im trying to go through and see where i went wrong, but ill keep working on it.. thanks.

Reavor
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 07, 2002 2:28 am   
 
hehe,
I actually got this started and working, but something went hay wire on me here is what it did.

it started at a then b all through z then went aa bb cc etc till it got to yy and just stopped.

So me and my stupidity (and maybe not) i waited a few seconds and then started it again, to which it did one single say and then cut link... it looked something like this
say
azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz and continued for about 2-3 pages before it stopped. So i thought hmm maybe i screwed something up not sure so i reconnected to zmud and tried it again.. same result. it never stopped at 10 letters that is for sure, but it also went on for what would seem like forever with all z's but the first letter which was an a.

Anyhelp appreciated,

Reavor
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 07, 2002 2:45 am   
 
hi,
i noticed a couple other things as i tried to play with this.

1) if you reconnected to the mud it started at aa or bb (dont' remember which) and went to yy then it just didn't do anymore says. However i would click on currentword and tempword variables back and forth and watch it continue to grow and grow and grow until it reached some maxed variable lentgh or something and then it would spit the huge block of text into a say and kick me off the mud :)
Possibly getting stuck on loop that adds the z and it just keeps adding z z z zz over and over.

Reavor
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 07, 2002 11:06 am   
 
Quite a few typos, missing )'s and }'s, and some extras in the wrong spot. Also forgot one little #IF. I really hate trying to type code all on one line with the ;'s, anyhow got those things fixed up below. If it still doesn't work then your on your own.

#CLASS {WordMaker}
#ALIAS StartMakingWords {CurrentWord="a";#ALARM "WordSendAlarm" {*1} { #IF (%trigger(WordMaker)) {say @CurrentWord;UpdateWord} {#UNTRIGGER WordSendAlarm;#T+ WordMaker}}}
#ALIAS UpdateWord {BuildCounter=%len(@CurrentWord);TempWord="";CarryFlag=1;#WHILE (@BuildCounter) {#IF (%copy(@CurrentWord,@BuildCounter,1)="z") { #IF (@CarryFlag) {TempWord=%concat("a",@TempWord);CarryFlag=1} { TempWord=%concat(%copy(@CurrentWord,@BuildCounter,1),@TempWord)}} { #IF (@CarryFlag) {TempWord=%concat(%char(%eval(%ascii(%copy(@CurrentWord,@BuildCounter,1))+1)),@TempWord);CarryFlag=0} { TempWord=%concat(%copy(@CurrentWord,@BuildCounter,1),@TempWord)}};#ADD BuildCounter -1};#IF (@CarryFlag) {TempWord=%concat("a",@TempWord)};#IF (%len(@TempWord<11)) { CurrentWord=@TempWord} { #T- WordMaker}}
#VAR CurrentWord {}
#VAR TempWord {}
#VAR BuildCounter {0}
#VAR CarryFlag {0}
#CLASS 0

I tested it a bit this time.
Reply with quote
reavor
Novice


Joined: 31 Aug 2001
Posts: 48
Location: USA

PostPosted: Sun Apr 07, 2002 5:30 pm   
 
hi,
Thanks so much that worked perfectly. I appreciate the help on this very much :)

- Reavor
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