|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Sat Oct 23, 2010 12:37 am
Function Parameters |
Having two issues:
I created a function which passes three parameters.
1) The last parameter is set by a button. For some reason the third parameter is being appended to my local variable called sentence.
2) The next problem is I have a switch that is calling the speech variable. I am having issues with the %replaceitem working in the switch for @speech=2 part.
The function is below:
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<func name="SpeechType">
<value><![CDATA[#local $matched $channel $input $person $sentence $emphasis $loopcount $s_word $speech
$channel = %1
$input = %params( 2)
$loopcount = 0
$speech = @speech
;Check to see if the channel is a member of the sayto list
#if (%ismember( $channel, @sayto)) {
;Assign person variable and remove person from input variable
$person = %concat( %word( $input, 1), " ")
$input = %remove( $person, $input)
}
;Check for a space a beginning of input and remove
$input = %trim( $input)
#print input: $input
;Next check for an emphasis
#if (%begins( $input, "(")) {
#call %match( $input, "(~(*~))(*)", $emphasis, $sentence)
;Remove space at beginning of sentence to prepare to change into string list
$sentence = %trim( $sentence)
} {$sentence = $input}
;Change sentence into string list
$sentence = %replace( $sentence, " ", "|")
;Now check the remaining input variable and make it stutter
#switch ($speech=1) {
#forall $sentence {
#add $loopcount 1
#if (%match( %i, %concat( "^({", @stutterlist, "})*"), $matched)) {
#if (%random( 1, @st_relay)=1) {
//Need to change intensity of the stutter when it is a question or exclamation point at the end of the sentence
$s_word = %concat( $matched, "-", $matched, "-", %i)
$sentence = %replaceitem( $s_word, $loopcount, $sentence)
}
}
}
} ($speech=2) {
#forall $sentence {
#add $loopcount 1
#if (%ismember(%i,@OldEnglish)) {
$sentence = %replaceitem(@OldEnglish.%i, $loopcount, $sentence)
}
}
}
;Replace pipe symbols with space to display remaining input
$sentence = %expandlist( $sentence, " ")
;********* Display the finished output ***********************
#if (($channel =~ "shout" || $channel =~ "yell") && ($emphasis))
{
#print <color red>You can't use emphasis with shout</color>
#return {$channel $sentence}
}
{#return {$channel $person %quote( $emphasis) $sentence}}]]></value>
<arglist>$channel,$input,$speech</arglist>
<notes>This function is used to create the type of speech impairment the player would like to use.</notes>
</func>
</cmud>
|
|
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
darmir Sorcerer
Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Sat Oct 23, 2010 2:12 am |
Nevermind. I figured it out. I needed need to pass the @speech variable through the function. I just referenced it.
|
|
_________________ Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian) |
|
|
|
|
|
|
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
|
|