How to make choices in quest?

it_master
08 Apr 2016, 08:45
I know someone opened that topic before, but I need a more simplified version on how to do this, something like this "choices that affect your story" that is shown in Minecraft: Story Mode, but I'm doing that kind of a mechanic for my own story.

Any help or suggestions would be appreciated.

Thanks in advance :)

HegemonKhan
08 Apr 2016, 09:46
Are you using, Game Book (GB) or Text Adventure (TA), Version?

the most simple way in TA, is to use the 'show menu' Script/Function, along with the 'switch' Script/Function:

in code:

<game name="whatever">
<attr name="start" type="script">
code_example_function
</attr>
</game>

<function name="code_example_function">
show menu ("your question/statement/message", split ("option/choice1; option/choice2; option/choice3; etc", ";"), false) {
switch (result) {
case ("option/choice1") {
// script(s)
}
case ("option/choice2") {
// script(s)
}
case ("option/choice3") {
// script(s)
}
case ("etc") {
// script(s)
}
default {
// your default (else) response 'msg' script/text
}
}
}
</function>


links/resources for you:

http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/guides/

specifically:

http://docs.textadventures.co.uk/quest/ ... ation.html
http://docs.textadventures.co.uk/quest/ ... _menu.html
http://docs.textadventures.co.uk/quest/ ... _menu.html
http://docs.textadventures.co.uk/quest/ ... wmenu.html
http://docs.textadventures.co.uk/quest/ ... witch.html
http://docs.textadventures.co.uk/quest/ ... _case.html
http://docs.textadventures.co.uk/quest/ ... tiple.html
http://docs.textadventures.co.uk/quest/ ... split.html

more advanced usage:

http://docs.textadventures.co.uk/quest/ ... lists.html
http://docs.textadventures.co.uk/quest/ ... aries.html

it_master
08 Apr 2016, 15:16
Another question, how to make someone remember something that you did or said?

And yes, I'm using Text Adventure for this one.

Thanks in advance.

XanMag
08 Apr 2016, 18:27
When you tell them something (or ask them), set a flag.

For example, if player types 'tell Jumbo about murder', print the message for a response, and set a flag (under variables in the pop-up) and name it something like murdertold. Then, when you talk to/ask questions about a topic, use an 'If' script to check to see if object Jumbo has flag name murdertold... Then print appropriate message. In the 'else' section of that script, print a message as Jumbo never heard about the murder.

On a related note, I think you should sample the tutorial game 'Quest - Templates and Tutorials'. It is meant to help with questions just like this. It's kind of a GUI-walkthrough on game creation. Good luck.

Let me know if this helps.

HegemonKhan
08 Apr 2016, 19:13
if you know algrebra (algebraic substitution):

programming Attributes (1 of 3 types of VARIABLES) hold/store data, just as VARIABLES do in math/algrebra:

math:

( equals operator/operation: '=' )

x = 10
y = x + 5
y = 15

programming:

( assignment operator/operation: '=' , it's not the same as math's equals operator/operation )

Object_name.Attribute_name = Value_or_Expression

player.strength = 100

player.strength = 100
player.weapon.damage = 75
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100

game.greeting = "Hi, my name is HK, what is your name?"

msg ("Strength: " + player.strength)
// outputs: Strength: 100

msg (player.strength + " STR")
// outputs: 100 STR

msg (player.strength)
// outputs: 100

msg (player.damage)
// 75 + 75 * 100 / 100 = 75 + 75 * 1 = 75 + 75 = 150
// outputs: 150

msg ("Damage: " + player.damage)
// outputs: Damage: 150

msg (player.damage + " DMG")
// outputs: Damage: 150 DMG

msg (game.greeting)
// outputs: Hi, my name is HK, what is your name?

--------

so, for example:

(concatenation operator/operation: '+', literally putting together, is unique to programming: "5" + "5" = "55", "Mama " + "5" + " Mia" = "Mama 5 Mia", "Mama" + "5" + "Mia" = "Mama5Mia". Anything surrounded by double quotes is a String Data Type, string: a sequence of characters/symbols, aka text)

(the '+' operator is also addition operator/operation too for; integer:non-decimal number: -1, 0, 1, etc / double:decimal number: 0.2, 0.04876, 0.0, -0.9, etc; data types)

<game name="whatever">
<attr name="start" type="script">
set_name_function
display_name_function
alias_variable = get_name_function
msg ("Hi, " + alias_variable + ", nice to meet you.")
//
// outputs:
//
// Your name is HK.
// Hi, HK, nice to meet you.
//
</attr>
</game>

<function name="set_name_function">
msg ("What is your name?")
// say I type in: HK
get input {
// quest automatically (hidden from you) sets the built-in variable: result = your_input
player.alias = ToString (result)
// player.alias = result = "HK"
// player.alias = "HK"
}
</function>

<function name="display_name_function">
msg ("Your name is " + player.alias + ".")
</function>

<function name="get_name_function" type="string">
return (player.alias)
</function>

it_master
11 Apr 2016, 15:02
Thanks for all the answers.