Dialogue with several different characters
Emerae
20 May 2012, 05:24I'm trying to create a string that will change dialogue depending on the character I'm addressing. For example: Say I have two characters in a room and I want to say "Hello" to each of them by typing something like "Say hello to _whateverthecharacter'snameis_" and have each character respond in a different way. Like this:
>say hello to mike
Mike says "Hi there."
and alternatively
>say hello to james
James says "Good morning."
Simple example, but I'm trying to achieve something like that. I've been able to change dialogue depending on which character is in the room by using the 'if' string, but when two characters are in a room at the same time it can't seem to distinguish which one I'm talking to no matter what I try. Is there a way to address characters individually that I'm just not seeing?
At present I have it set up as:
say #text# to #text_object# in the command pattern menu and am using a switch to denote the 'ifs" as in 'if a character is present in the room" but with more than one character present it just seems to get confused. Any help would be much appreciated.
>say hello to mike
Mike says "Hi there."
and alternatively
>say hello to james
James says "Good morning."
Simple example, but I'm trying to achieve something like that. I've been able to change dialogue depending on which character is in the room by using the 'if' string, but when two characters are in a room at the same time it can't seem to distinguish which one I'm talking to no matter what I try. Is there a way to address characters individually that I'm just not seeing?
At present I have it set up as:
say #text# to #text_object# in the command pattern menu and am using a switch to denote the 'ifs" as in 'if a character is present in the room" but with more than one character present it just seems to get confused. Any help would be much appreciated.
sonic102
20 May 2012, 05:57This one is easy. All you need to do is:
->Command pattern: say #text# to #object#
->Now in the script, put a 'switch' command.(It's in the 'Scripts' category)
1.There will be a input box above, put 'object'(without the quotation marks).
2.Now click 'add key'(below the input bar') and write the name of your character.(the name should be same as the name of the character object.)
3.For the Script Editor, write whatever happens when you speak to the character.
Here's the code:
Have fun Questing yourself and Questing your players!
->Command pattern: say #text# to #object#
->Now in the script, put a 'switch' command.(It's in the 'Scripts' category)
1.There will be a input box above, put 'object'(without the quotation marks).
2.Now click 'add key'(below the input bar') and write the name of your character.(the name should be same as the name of the character object.)
3.For the Script Editor, write whatever happens when you speak to the character.
Here's the code:
<command>
<pattern>say #text# to #object#</pattern>
<script>
switch (object) {
case (mike) {
msg ("Hi there.")
}
case (james) {
msg ("Good morning.")
}
}
</script>
</command>
Have fun Questing yourself and Questing your players!

Emerae
20 May 2012, 06:23Thank you!!!! I'll try this now. 

Emerae
20 May 2012, 06:28Well, that DID work, but what if I want to change the response based on what I type in the #text# field, while still addressing separate characters?
EDIT: Nevermind I think I figured it out. I just added another switch command for text as the string for the object switch. It seems to work so far. Is that correct?
EDIT: Nevermind I think I figured it out. I just added another switch command for text as the string for the object switch. It seems to work so far. Is that correct?
sonic102
20 May 2012, 07:54Yep. You have to make another text script. If you want diffrent characters to say diffrent things if you say diffrent texts, then here is what you need to do.
Suppose you say 'hello' to mike. He says 'Hi there'
Suppose you say 'what a nice weather'. He says 'I agree with you' if you put the text script inside the mike object script editor.
Remember to put text in "quotation marks"
Suppose you say 'hello' to mike. He says 'Hi there'
Suppose you say 'what a nice weather'. He says 'I agree with you' if you put the text script inside the mike object script editor.
Remember to put text in "quotation marks"
sgreig
20 May 2012, 12:56That method will certainly work, but in the interest of simplicity, you can also just add "talk" (it will autofill to Speak to; Speak; Talk to; Talk) under the character's Verb tab, and then just add the dialogue there.