Change a command's script during play?

K.V.
23 Aug 2017, 10:11

I know you can change (or add) a verb's script during play:

box.push => {
  msg ("This is what happens when you push the box now!")
  MoveObject (box, AnotherRoom)
}
box.generatedverbslist = Split("Push", ";")

//NOTE: This wouldn't work if 'push' wasn't set up as a command or verb (or if it wasn't a default command or verb).
//  I.e., if I were to try do this with 'box.flip', the parser wouldn't understand my command.
//   It knows not of 'flip'.

Is there a way to do this with commands?


SIDE-QUESTION:

Can you not write a script 'in-line'?

E.g., this doesn't work:

if (HasAttribute(box, "push")) {msg ("You push it. You push it real good.");MoveObject (box, AnotherRoom)}


The Pixie
23 Aug 2017, 11:14

Yes you can (I would assume) but why would you want to? It would be better to di if/else because in two months time you will be able to look at it and know what is happening.


K.V.
23 Aug 2017, 11:53

Yes you can (I would assume) but why would you want to?

[Laughing maniacally.]

It's the shards, Pixie!

(They tell me to do CRAZY things sometimes.)


I could sort of pull off what I'm after with conditional statements, but if a command's script could actually be altered this way...

Well...

if (not KV.has_to_use_IF_THEN) {
  player.in_metaphorical_box = false
}
if (not player.in_metaphorical_box) {
  game.will_be_more_awesome = true
}