Adding/Manipulating attributes online

XanMag
09 Aug 2016, 16:34

Is it possible to alter/add attributes, like changing health from the built-in 100% to a point value, using the online version of Quest? If so, how would you do it?

I see you can add attributes to the player character. For Key, I typed HP and the value I set to 200. I only see the 200. How can I print the HP in the pane (HP = 200) and what script do I use for decreasing the 200? Remember, this is the online version. I can do it for the downloaded version.

Thanks!


hegemonkhan
09 Aug 2016, 23:01

here's a demo game guide on Status Attributes:

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help

here's a guide on Attributes:

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

Status Attributes (a built-in Stringdictionary Attribute --- only works/available for the 'game' Object and Player Objects):

key: NAME_OF_ATTRIBUTE
value: (see a bit further below)

example:

// in code scripting: player.hp = 500
// in code scripting: game.hp = 500

// in code 'creation' tag block:

<game name="xxx">
  <attr name="hp" type="int">500</attr>
</game>

<game name="xxx">
  <attr name="hp" type="int">500</attr>
</game>

Key (see above)
VALUE (from above):

HP: !
// outputs: HP: 500

! HP
// outputs: 500 HP

in code:

<game name="xxx">
  <attr name="statusattributes" type="simplestringdictionary">hp = HP: !</attr>
  // or:
  // <attr name="statusattributes" type="simplestringdictionary">hp = ! HP</attr>
</game>

<object name="player">
  <attr name="statusattributes" type="simplestringdictionary">hp = HP: !</attr>
  // or:
  // <attr name="statusattributes" type="simplestringdictionary">hp = ! HP</attr>
</object>

The Pixie
10 Aug 2016, 07:16

The way to set attributes in the on-line editor is in the start script on the game object. So to set HP to 200, just do this:

player.HP = 200

If you want that displayed as a status attribute, you need to play around with the player (or game) "statusattributes" attribute. This is a dictionary, with each key being the name of an attribute, and each value being how it is displayed. Again, you need to do this in the start script.

player.HP = 200
player.statusattributes = NewStringDictionary
dictionary add(player.statusattributes, "HP", "HP = !")

The exclamation mark stands in for the actual value. During play, you can change attributes just as you do off-line.