useful links:
http://docs.textadventures.co.uk/quest/http://docs.textadventures.co.uk/quest/functions/http://docs.textadventures.co.uk/quest/ ... tions.html (in alphabetical order)
Randomization:
GetRandomInt (min_value, max_value) ~ (
http://docs.textadventures.co.uk/quest/ ... omint.html )
GetRandomDouble () ~ (
http://docs.textadventures.co.uk/quest/ ... ouble.html )
RandomChance (0 to 100) ~ (
http://docs.textadventures.co.uk/quest/ ... hance.html )
DiceRoll (string dicetype*) ~ (
http://docs.textadventures.co.uk/quest/ ... eroll.html )
*Format dicetype: [number of dice]d[number of sides]
-------------
in the GUI~Editor:
run as script -> add a~new script -> scripts -> 'if' Script -> [EXPRESSION] -> (see above and~or below, lol)
and also (for the 'RollDice' Function)
run as script -> add a~new script -> variables -> 'set a variable or attribute' script -> (see below)
terminology in quest:
VARIABLES:
-> Variables
-> Attributes
Local Usage:
Variable: variable_string_name = DiceRoll ("#d#")
example1: result = DiceRoll ("1d6") ~ normal 1 dice (6 sided) roll
example2: value = DiceRoll ("1d6")
example3: y = DiceRoll ("1d6")
example4: dice_roll_result = DiceRoll ("1d6")
Global Usage (so long as the Object exists, of course):
Attribute: Object_name.Attribute_name = DiceRoll ("#d#")
example1: game.dice_roll_result = DiceRoll ("1d6")
example2: player.dice_roll_result = DiceRoll ("1d6")
example3: HK.dice_roll_result = DiceRoll ("1d6")
example4: orc.dice_roll_result = DiceRoll ("1d6")
-------------
for a 50% chance:
in code:
//simplified~shortened syntax:
if (RandomChance (50) ) {
-> Object_name.Boolean_Attribute_name = true
} else {
-> Object_name.Boolean_Attribute_name = false
}
or
if (GetRandomInt (0,1) = 0) {
-> Object_name.Boolean_Attribute_name = true
} else if (GetRandomInt (0,1) = 1) {
-> Object_name.Boolean_Attribute_name = false
}
or
if (GetRandomInt (1,2) = 1) {
-> Object_name.Boolean_Attribute_name = true
} else if (GetRandomInt (1,2) = 2) {
-> Object_name.Boolean_Attribute_name = false
}
or
if (GetRandomInt (99,100) = 99) {
-> Object_name.Boolean_Attribute_name = true
} else if (GetRandomInt (99,100) = 100) {
-> Object_name.Boolean_Attribute_name = false
}
or
result = DiceRoll ("1d2")
if (result = 1) {
-> Object_name.Boolean_Attribute_name = true
} else if (result = 2) {
-> Object_name.Boolean_Attribute_name = false