How to make thingS happen after a taken action?

OK let's say in your game your about to fry a burger.
The stove is on preheating, (switched on) and as you put the burger on a pan that is on it, the burger starts cooking.

Uh sorry if it didn't sound right...


You're the one on the mobile device right?

You're probably going to have to do everything through scripting: run as script -> add new script -> 'WHATEVER' Script option

the two super scripts, which let's you do 90% of everything in your game (especially when used together) are:

  1. Attributes usage (creation/setting, re-setting/changing/altering/manipulating, and usage):

run as script -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = [EXPRESSION] VALUE_OR_EXPRESSION

You can use whatever specific '[XXX]' Script option as well (instead of the '[EXPRESSION]'), I just don't know them myself.

for some examples:

set variable game.state = [EXPRESSION] 0
set variable orc.dead = [EXPRESSION] false // the 'orc' is (MUST BE) an actual existing Object in your game
set variable player.strength = [EXPRESSION] 100
set variable player.alias = [EXPRESSION] "HK"
set variable player.weapon = [EXPRESSION] katana // the 'katana' is (MUST BE) an actual existing Object in your game
set variable katana.damage = [EXPRESSION] 50 // the 'katana' is (MUST BE) an actual existing Object in your game
set variable player.damage = [EXPRESSION] player.weapon.damage + player.weapon.damage * player.strength / 100

  1. the 'if' Script:

run as script -> add new script -> 'scripts' section/category -> 'if' Script -> (see below)

if [EXPRESSION] NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION
// or:
if [EXPRESSION] NAME_OF_OBJECT.NAME_OF_BOOLEAN_ATTRIBUTE // if (TRUE)

and the negations/complements ('not') (opposite: not equals to):

if [EXPRESSION] not NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION
// or:
if [EXPRESSION] NAME_OF_OBJECT.NAME_OF_ATTRIBUTE <> VALUE_OR_EXPRESSION
// or:
if [EXPRESSION] not NAME_OF_OBJECT.NAME_OF_BOOLEAN_ATTRIBUTE // if (FALSE)

-> then, -> (set it up)

and optionally:

add else if (as many as you want / repeat as needed) -> (set it up)

-> then, -> (set it up)

and optionally:

add else -> (set it up)

you can do whatever specific '[XXX]' too, instead of using the 'EXPRESSION]', but I just don't know them myself.


for some examples in code (it's slightly different format/syntax/style then using the GUI/Editor's 'run as script -> add new script' Script options), but hopefully it'll still make sense):

if (player.alias = "HK") {
  msg ("You're so awesome!")
} else {
  msg ("Oh, nice to meet you.")
}

if (orc.dead) {
  msg ("The orc is dead")
} else {
  msg ("The orc is alive")
}

if (test.score > 89) {
  test.grade = "A"
} else if (test.score > 79) {
  test.grade = "B"
} else if (test.score > 69) {
  test.grade = "C"
} else if (test.score > 59) {
  test.grade = "D"
} else {
  test.grade = "F"
}

see here for a more detailed guide on this stuff:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

ask if you need help with anything


If the above post helped, let us know. If not, let us know. =)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums