stutter script

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: stutter script

Post by tsuujin »

You've got the right idea at the start of the script. Tokenize the string with string.split, but then use that table instead of trying to modify the original message.

Here's a hacked out example:
Code: [show] | [select all] lua
function stutter(stChan, stTar, stMsg)
	local stChannels = {"say","shout","tell","whisper","yell"}

	local stStutters = {"th","ch","st","tr","bl","br","bl","sp","sc","t","h",
                    "g","i","c","l","j","y","d","n","w","f","a","s"}

	if not table.contains(stChannels,stChan) then return false end
	if stChan == "tell" then stMsg = string.format("%s %s",stTar,stMsg) end
	
	local tokens = string.split(stMsg, " ")

	for index,word in pairs(tokens) do
		for _,st in pairs(stStutters) do
			if string.starts(word,st) then
				tokens[index] = string.format("%s-%s-%s",st,st,word)
				break
			end
		end
	end
	display(table.concat(tokens, " "))
end
This way you're just working one word a time, like you should be.

You can test the function with:
Code: [show] | [select all] lua
stutter("say","dude","this is a test")
-- output: 'th-th-this i-i-is a-a-a t-t-test'
edit: I feel compelled to point out that I have always hated when people use speech impediments as a character mechanic. Yes, it offers a sense of realistic non-perfection... but it also offers a sense of hyper-realistic irritation to many players. I've found myself griefing several of them in the past and I'm honestly not a griefer.

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: stutter script

Post by Darmir »

Thanks for the help. I understand your grief with speech impediments like this, but I like it because I hate having to type it all the extra stuff and this is quicker.

User avatar
Rakon
Posts: 350
Joined: Tue Feb 16, 2010 7:41 pm
Contact:

Re: stutter script

Post by Rakon »

Darmir wrote:Thanks for the help. I understand your grief with speech impediments like this, but I like it because I hate having to type it all the extra stuff and this is quicker.
I don't think you quite addressed Tsuujin's complaint.

He's not upset that you're using a script to do the stuttering. He is saying, that character mechanics such as 'speech impediments' (like stuttering) are an irritation to players, not a character developing of intrigue.

I agree with Tsuujin.

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: stutter script

Post by Darmir »

Rakon wrote:
Darmir wrote:Thanks for the help. I understand your grief with speech impediments like this, but I like it because I hate having to type it all the extra stuff and this is quicker.
I don't think you quite addressed Tsuujin's complaint.

He's not upset that you're using a script to do the stuttering. He is saying, that character mechanics such as 'speech impediments' (like stuttering) are an irritation to players, not a character developing of intrigue.

I agree with Tsuujin.
LOL. Okay. I like them because they give the character more character. Some players have their characters walk with a limp, some are very beligerant.. This character has a speech impediment. ;)

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: stutter script

Post by tsuujin »

I'm just pointing out the fact that by using this script, you're very likely going to piss off a few players. Don't be surprised when you take verbal grief over using this script, and don't complain when other people go out of their way to grief your character.

If I were you I'd simply reduce the number of times you actually stutter dramatically. For example, cutting your stutterlist by three quarters.

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: stutter script

Post by Darmir »

tsuujin wrote:I'm just pointing out the fact that by using this script, you're very likely going to piss off a few players. Don't be surprised when you take verbal grief over using this script, and don't complain when other people go out of their way to grief your character.

If I were you I'd simply reduce the number of times you actually stutter dramatically. For example, cutting your stutterlist by three quarters.
I don't have it stutter on every word. I does a math.random on the words. The stutter Intensity can be changed with an alias. :D

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: stutter script

Post by Darmir »

Please remove

DevArrah
Posts: 51
Joined: Sat Oct 29, 2011 4:57 pm

Re: stutter script

Post by DevArrah »

what you want to do at a high level is split the string or do something like
Code: [show] | [select all] lua
(\s?(\S+))+?
then iterate over each word to see if starts with one of the stuttering patterns. Once the iteration is done, reassemble the string and send it.

Post Reply