|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Mon Jun 14, 2004 6:49 pm
Stutter script - Problem rewrite |
Hey everyone. I have been playing for awhile and just tried my stuttering script by Iljhar. I was using v6.40 but now I am using v7.05 and my script isn't parsing correctly.
Let's say I have in my stutter list s,m,w, and i.
When a say something like:
stutter say My god this is weird.
It comes out like:
say My god this is..is..is weird...weird...weird.
The script is making the whole word stutter instead of the letter.
Please help.
To see the script go here.
http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=3293
Thanks
Darmir |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Jun 15, 2004 4:44 pm |
I decided to try to re-write this script a little differently but I am having a few problems. When it loops through the forall I get the word more than once.
Example: stutter say My god who do you think you are my friend?
Output: say My My My god god god who who who do do do you you you think think th..th..think you you you are are are m..m..my my my friend? friend? friend?
I haven't put a random function into the stutter yet, to check for a capital letter at beginning of sentence, or check for multiple sentences.
Just trying to get basic stutter to work.
Here is the script:
#variable sttuterlist: m|i|th
alias: stutter
#VARIABLE channel {%1}
#VARIABLE input {%-2}
#VARIABLE found 0
#VARIABLE whole ""
#VARIABLE input %replace( @input, " ", "|")
#SHOW @input
#SHOW @channel
#FORALL @input {
#FORALL @stutterlist {
#IF %begins( %i, %j) {
#SHOW Yes: %i begins with %j
@s_word = %concat( %j, "..", %j, "..", %i)
@whole = %concat( @whole, " ", @s_word)
; #SHOW newlist: @whole
} {
@word = %i
@whole = %concat( @whole, " ", @word)
; #SHOW No: %i doesn't begin with %j
}
}
}
#SHOW @channel @whole |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Jun 15, 2004 4:59 pm |
EDIT: Oops, you posted while I was writing my reply. This is based on the NEW AND IMPROVED version from your original post in the Finished MUD Scripts forum.
This would certainly be a lot easier if we didn't have to open up another window to look at the script. I'm assuming you haven't made any changes to the script itself, but only to the stutterlist variable.
The problem appears to be fairly simple. When this script was written, around June to September 2001, the public version was 6.16 and there was no beta version. One of the improvements since version 6.16 is the use of %j, %k, etc. to reference loop variables in nested loops. This is required in version 6.56 and later.
#AL stutter {
#VARIABLE input {%-1}
#VARIABLE found 0
#VARIABLE cap 1
#VARIABLE found 0
#VARIABLE whole ""
#VARIABLE channel %word( @input, 1)
#VARIABLE input %replace( %replace( %right( @input, %pos( " ", @input)), " ", " "), " ", "|")
#FORALL @input {
#VARIABLE temp2 %i
#IF (%random( 1, 3)=1) {
#FORALL @stutterlist {
#IF (!@found) {
#IF (%begins( %lower( @temp2), %j)) {
#VARIABLE whole %concat( @whole, %if( @cap, %proper( %j), %j), "..", %if( @cap, %proper( %j), %j), "..")
#VARIABLE found 1
}}}}
#VARIABLE whole %concat( @whole, %if( @cap, %proper( @temp2), @temp2), " ")
#VARIABLE found 0
#VARIABLE cap 0
#IF (%ends( @temp2, ".")) {#VARIABLE cap 1}
}
#VARIABLE temp2 %proper( %left( %trim( @whole), 3))
#VARIABLE whole %right( %trim( @whole), 3)
#IF (%begins( @whole, ".")) {
#VARIABLE temp2 %concat( @temp2, %left( @whole, 1))
#VARIABLE whole %right( @whole, 1)
}
@channel %concat( @temp2, %if( %pos( ".", @temp2), %concat( %upper( %left( @whole, 1)), %right( @whole, 1)), @whole))
}
Didn't test it, but this should fix the problem. |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Tue Jun 15, 2004 5:16 pm |
Lightbulb,
That fixed it. The only thing is if you have a capitalized "I" it won't capitalize the stutter.
Example: My god who do you think you are m..m..my friend? i..i..It's going to be alright.
Example 2: Go ahead, i..i..I will need some help
Also can you help me with the script to notice if you have a tell.
This way it will recognize the person right after the tell command.
Example: stutter tell Lightbuld Here we go again.
Another thing is the mud I play lets you change a tell descriptively by doing the following, I want to be able to do this also.
Example: tell man (while looking down at the ground) Do you need farm hands still?
Output You ask a rough-looking man with large arms in Westron, while looking down at the ground, "Do you need farm hands still?"
Any ideas? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Jun 16, 2004 6:47 pm |
Sorry, I'm not really interested in stuttering (or other speech-modification) scripts and don't want to spend much time on this.
Instead of trying to cram everything into one alias, just do another alias to stutter over tells and a third one for your fancier tells. The stutter script itself should be pretty much just a copy of the one you already have.
#AL tellstutter {tell %1 script for stuttered version of %-2}
#AL fancytellstutter {tell %1 %2 script for stuttered version of %-3} |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Jun 16, 2004 9:28 pm |
Well, I decided I would try to rewrite it the script.
I am having problem with some pattern matching.
I want to see the first value of the varible:
#var input (while|smiling)|Hello|Tommy.|How|are|you|today?
Now if I list the list is shows from a forall loop:
The input in the forall loop: while|smiling
The input in the forall loop: Hello
The input in the forall loop: Tommy.
The input in the forall loop: How
The input in the forall loop: are
The input in the forall loop: you
The input in the forall loop: today?
I want to check to see if the first value in the list has the | symbol in it.
Any help... Also the parser is removing the ()'s. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Jun 16, 2004 10:29 pm |
Sure both are solved by simple logic and your pick of functions. The ones that come to mind are %pos and %numitems. Simply knowing there are multiple items within the item is enough to know that it needs parenthesis added back on and shouldn't be stuttered. Simply add an #IF before the first loop to check the first item in @input for one of those conditions. Then %pop and set whole accordingly.
|
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
|
|
|
DSL_Character Beginner
Joined: 18 Aug 2010 Posts: 13
|
|
|
|
|
|
|
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
|
|