msg ("'Hello. Can you help me young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("I am thirsty." , the old man says. "Bring me some water and I shall reveal to you bla bla bla...'")
}
else {
}
}
<object name="old_man">
<inherit name="editor_object" />
<attr name="socialize" type="script">
socialize_old_man_function // 'call function' Script
</attr>
<attr name="displayverbs" type="listextend">Socialize</attr>
</object>
<function name="socialize_old_man_function">
msg ("'Hello. Can you help me young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("I am thirsty." , the old man says. "Bring me some water and I shall reveal to you bla bla bla...'")
}
else {
msg ("Try rephrasing")
wait {
ClearScreen
socialize_old_man_function // 'call function' Script
}
}
}
</function>
HegemonKhan wrote:make the scripting that you want to repeat (aka 'loop~call upon~invoke'), as (within) a Function of it's own:<object name="old_man">
<inherit name="editor_object" />
<attr name="socialize" type="script">
socialize_old_man_function // 'call function' Script
</attr>
<attr name="displayverbs" type="listextend">Socialize</attr>
</object>
<function name="socialize_old_man_function">
msg ("'Hello. Can you help me young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("I am thirsty." , the old man says. "Bring me some water and I shall reveal to you bla bla bla...'")
}
else {
msg ("Try rephrasing")
wait {
ClearScreen
socialize_old_man_function // 'call function' Script
}
}
}
</function>
Mareus wrote:"HegemonKhan"
make the scripting that you want to repeat (aka 'loop~call upon~invoke'), as (within) a Function of it's own:
<object name="old_man">
<inherit name="editor_object" />
<attr name="socialize" type="script">
socialize_old_man_function // 'call function' Script
</attr>
<attr name="displayverbs" type="listextend">Socialize</attr>
</object>
<function name="socialize_old_man_function">
msg ("'Hello. Can you help me young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("I am thirsty." , the old man says. "Bring me some water and I shall reveal to you bla bla bla...'")
}
else {
msg ("Try rephrasing")
wait {
ClearScreen
socialize_old_man_function // 'call function' Script
}
}
}
</function>
Thanks for answering, but the script you made does not work.
1. There seems to be a red line that says:
Failed to load script:
msg ("I am thirsty." , the old man says. "Bring me some water and I shall reveal to you bla bla bla...'")
2. So I fixed this by deleting the red line and adding again a new message with the relevant text, but even though I don't see any errors - the script still does not seem to work. I cant find "old_man" within the game. So, assumed that it was because "old_man" was located within my "old man" object, so I moved him manually to my room. Now, I can see him in the game, but when I click on him there is no socialize command and manually typing socialize with old man does nothing either.
3. Other than that, I noticed also that you created a new function called "socialize_old_man_function" and a sub-object called "old_man" within my "old man" object. This sub-object has a new verb "socialize". The thing is that I want to be using the default command "speak to" because I think that is the first thing any player will try. If that doesn't work, I don't think anyone will even try to "socialize". So is there a way to make this run through the default "speak to/talk to/talk with" command that comes built in by default in quest?
4. I remembered this a bit later, but it would also be useful to have a way to exit the conversation by typing "bye" command.
Some final notes: Basically I want to be able to get to special screen that is only for the dialogue with the NPCs - something similar to the old Legend games. I will even add NPC's picture once you type in the "speak to" command, and I don't want the conversation to end just because you might do a typo or try something that is not handled by the script. And if I want to exit the dialogue screen, I want to be able to type "bye" command and that way end the conversation.
Anyway, thanks for trying to help.
jaynabonne wrote:I think the "old man" that HK included was meant to be an example. You don't need it as such if you already have your own. And make your "speak to" script just call the function he gave you (call it whatever you like if "socialize" isn't it).
The line you fixed did indeed have a problem with mis-quoted quotes, but that was a minor issue.
If you really do want to have some sort of special screen/place for doing conversation, one way to do it (untested) would be to move the participants to a special room where you can control things a bit. Then the "bye" input would simply be a command that takes the player back to where he/she was. And you wouldn't need a loop as such - you'd just be in the conversation as long as you're in the "conversing room".
Mareus wrote:"jaynabonne"
I think the "old man" that HK included was meant to be an example. You don't need it as such if you already have your own. And make your "speak to" script just call the function he gave you (call it whatever you like if "socialize" isn't it).
The line you fixed did indeed have a problem with mis-quoted quotes, but that was a minor issue.
If you really do want to have some sort of special screen/place for doing conversation, one way to do it (untested) would be to move the participants to a special room where you can control things a bit. Then the "bye" input would simply be a command that takes the player back to where he/she was. And you wouldn't need a loop as such - you'd just be in the conversation as long as you're in the "conversing room".
Sorry. I just don't get it. I spent around 5 hours yesterday trying to figure out what all of this means, and I cant seem to get it to work. Even when I made a completely new game and named every object and command like in the mentioned script, it still does absolutely nothing. Can you please try explaining it in more detail, cause I cant make any sense of this?
Specifically the script seems to come in 2 parts and I don't know how to combine them.
PS. I even tried using dialogue with menus as found here:
http://quest5.net/wiki/Conversations
But these scripts seem to have exactly the same problem. Once you choose an option, the menu disappears and you have to restart the whole conversation. So i have no idea how to fix this problem.
I also tried downloading Media:ConvTutorial.aslx from the page to get a better insight into the coding behind it, but I cant seem to download it. I just get "save target" when I right click on the link, instead of "save to". A total bummer...
jaynabonne wrote:If you really do want to have some sort of special screen/place for doing conversation, one way to do it (untested) would be to move the participants to a special room where you can control things a bit. Then the "bye" input would simply be a command that takes the player back to where he/she was. And you wouldn't need a loop as such - you'd just be in the conversation as long as you're in the "conversing room".
<!--Saved by Quest 5.5.5173.27901-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="dialogue">
<gameid>ce1669a0-d61a-46b0-8d67-ef160139974c</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="old man">
<inherit name="editor_object" />
<inherit name="male" />
<speak type="script">
speak_to_old_man
</speak>
</object>
</object>
<function name="speak_to_old_man">
msg ("'Hello. Can you help me, young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("\"I am thirsty.\" , the old man says. \"Bring me some water and I shall reveal to you bla bla bla...\"")
}
else {
msg ("Try rephrasing")
wait {
ClearScreen
speak_to_old_man
}
}
}
</function>
</asl>
jaynabonne wrote:Here's a complete game (both attached and inline).<!--Saved by Quest 5.5.5173.27901-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="dialogue">
<gameid>ce1669a0-d61a-46b0-8d67-ef160139974c</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="old man">
<inherit name="editor_object" />
<inherit name="male" />
<speak type="script">
speak_to_old_man
</speak>
</object>
</object>
<function name="speak_to_old_man">
msg ("'Hello. Can you help me, young man?'")
get input {
if (IsRegexMatch ("(yes|of course)", LCase (result))) {
msg ("\"I am thirsty.\" , the old man says. \"Bring me some water and I shall reveal to you bla bla bla...\"")
}
else {
msg ("Try rephrasing")
wait {
ClearScreen
speak_to_old_man
}
}
}
</function>
</asl>
<asl>your_entire_mass_of_game_coding</asl><asl>
your_entire_mass_of_game_coding
</asl>great grandfather (Root; DP of grandfather; IP of father, you, son, grandson, and great grandson)
grandfather (DC of great grandfather; DP of father; IP of you, son, grandson, and great grandson)
father (IC of great grandfather; DC of grand father; DP of you; IP of son, grandson, and great grandson)
you (you get the idea now)
son (you get the idea now)
grandson (you get the idea now)
great grandson (you get the idea now)
HK
pants with pockets
wallet
$ 1 bill
$ 5 bill
C://
programs
quest
Human Life Taxonomy (biology):
Life Taxonomy: Organic (carbon-based)
Domain Taxonomy: Eukarya (multi-cellular)
Kingdom Taxonomy: Animalia (animals, not: plants, fungus, bacteria, virus, protists)
Phylum Taxonomy: Chordata (symmetry, having a backbone~spine)
Class Taxonomy: Mammalia (having mammary glands; having breasts; milk prodution~secretion)
Order Taxonomy: Primate (Monkeys:tails and Apes:no_tails)
Family Taxonomy: Hominidae (Apes: Humans, Gorillas, Chimps, Orangutans, and Bonobos)
Tribe Taxonomy: Hominini (ape-human)
Genus Taxonomy: Homo (human)
Species Taxonomy: Homo sapien sapien (modern human)<asl>
<game>
<attr></attr>
<attr>
</attr>
</game>
<verb>
<attr></attr>
<attr>
</attr>
</verb>
<command>
<attr></attr>
<attr>
</attr>
</command>
<turnscript>
<attr></attr>
<attr>
</attr>
</turnscript>
<object>
<attr></attr>
<attr>
</attr>
<object>
<attr></attr>
<attr>
</attr>
</object>
</object>
</asl>I. Planets
A. Mercury
B. Venus
C. Earth
1. Continents
a. Asia
(1) Countries
(a) China
2. Oceans
D. Mars
E. Jupitur
F. Saturn
G. Uranus
H. Neptune
I. Pluto
II. Galaxies
A. Spiral Galaxies
1. Milky Way Galaxy<asl version="540">
// ~ <ref name="English.aslx" />
// ~ <ref name="Core.aslx" />
<game name="testing game stuff">
// attribute code lines
<start type="script">
character_creation_function
</start>
</game>
<object name="room">
<inherit name="editor_object" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<function name="character_creation_function">
msg ("what is your name?")
get input {
player.alias = result
msg ("What is your age?")
get input {
player.age_integer = result
if (player.age_integer >= 0 and player.age_integer < 4) {
player.age_string = "baby"
} else if (player.age_integer >= 4 and player.age_integer < 13) {
player.age_string = "child"
} else if (player.age_integer >= 13 and player.age_integer < 20) {
player.age_string = "teen"
} else if (player.age_integer >= 20) {
player.age_string = "adult"
}
show menu ("What is your gender?", split ("male;female", ";"), false) {
player.gender_string = result
show menu ("What is your race?", split ("human;dwarf;elf;gnome;halfing;giant", ";"), false) {
player.race = result
show menu ("What is your class?", split ("warrior;ranger;thief;cleric;mage", ";"), false) {
player.class = result
}
}
}
}
}
on ready {
ClearScreen
msg (player.alias + " is a " + player.age_integer + " year old " + player.age_string + " " + player.gender_string + " " + player.race + " " + player.class + ".")
if (player.class = "warrior") {
player.strength = 45
player.agility = 15
player.intelligence = 0
player.spirituality = 0
} else if (player.class = "ranger") {
player.strength = 30
player.agility = 30
player.intelligence = 0
player.spirituality = 0
} else if (player.class = "thief") {
player.strength = 15
player.agility = 45
player.intelligence = 0
player.spirituality = 0
} else if (player.class = "cleric") {
player.strength = 0
player.agility = 0
player.intelligence = 0
player.spirituality = 45
} else if (player.class = "mage") {
player.strength = 0
player.agility = 0
player.intelligence = 45
player.spirituality = 0
}
if (player.gender_string = "male") {
player.strength = player.strength + 5
player.intelligence = player.intelligence + 5
} else if (player.gender_string = "female") {
player.agility = player.agility + 5
player.spirituality = player.spirituality + 5
}
wait {
ClearScreen
msg ("Alias: " + player.alias)
msg ("Age: " + player.age_integer + " (" + player.age_string + ")")
// etc code lines
wait {
ClearScreen
}
}
}
</function>
</asl>