Player Attributes

Can you have a player attribute be a list of values? Say I have a player and I want them to choose a set of skills. I would like it to show on the status box to the right as:

Skills:
Alchemy
Brawling
Endurance


I faced this same problem before and i found it would be solved using a 'List'. However, i found the 'List' thing so complicated i decided aborting this approach and turn into another. I hope you get better understanding about the list thing than i had.


not sure if or how (if it can be done) to be done with the status attributes...

but 'Lists' (arrays) are a Data Type in quest, there's two types of Lists: String Lists and Object Lists

to do a string list in scripting, you got two methods, examples for them (as Attributes):

  1. quick/easy method: using the 'split' Script/Function:

game.race_stringlist_attribute = split ("human;dwarf;elf;gnome;halfling;giant", ";")

  1. "normal" method:

game.race_stringlist_attribute = NewStringList ()
list add (game.race_stringlist_attribute, "dwarf")
list add (game.race_stringlist_attribute, "elf")
list add (game.race_stringlist_attribute, "gnome")
list add (game.race_stringlist_attribute, "halfling")
list add (game.race_stringlist_attribute, "giant")

and how it looks in code (as the code tag blocks):

(this is a way of creating Lists too, but it's compile-time/game-initialization-start-up only, not dynamic-in-game scripting operations/events, you need to use the 2 scripting methods for that)

<game name="example_game">

  <attr name="race_stringlist_attribute" type="stringlist">

    <value>human</value>
    <value>dwarf</value>
    <value>elf</value>
    <value>gnome</value>
    <value>halfling</value>
    <value>giant</value>

  </attr>

  <!--
  or this syntax instead (this is ONLY for String Lists):

  <attr name="race_stringlist_attribute" type="simplestringlist">human;dwarf;elf;gnome;halfling;giant</attr>

  -->

</game>

and Object Lists can only be created via using the 'normal' scripting method (or within in-code as the tag blocks), and also, not sure if pixie updated quest, but in older versions of quest, there's no way of creating an Object List via the GUI/Editor's options (you can through the GUI/Editor's scripting options, using the '[EXPRESSION]' scripting option to write/code in what you want):

  1. "normal" method only:

// remember that an Object List's items, must be actual existing Objects:
// create ("human")
// create ("dwarf")
// create ("elf")
// create ("gnome")
// create ("halfling")
// create ("giant")

game.race_objectlist_attribute = NewObjectList ()
list add (game.race_stringlist_attribute, dwarf)
list add (game.race_stringlist_attribute, elf)
list add (game.race_stringlist_attribute, gnome)
list add (game.race_stringlist_attribute, halfling)
list add (game.race_stringlist_attribute, giant)

and how it looks in code (as the code tag blocks):

(this is a way of creating Lists too, but it's compile-time/game-initialization-start-up only, not dynamic-in-game scripting operations/events, you need to use the 2 scripting methods for that)

<game name="example_game">

  <attr name="race_objectlist_attribute" type="objectlist">

    <value>human</value>
    <value>dwarf</value>
    <value>elf</value>
    <value>gnome</value>
    <value>halfling</value>
    <value>giant</value>

  </attr>

  <!--
  or this syntax instead (this is ONLY for Object Lists):

  <attr name="race_objectlist_attribute" type="objectlist">human;dwarf;elf;gnome;halfling;giant</attr>

  -->

</game>

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

Support

Forums