Attributes

So, what would be the easiest way to do this? I have the player who can choose a set of skills. I want to able to have them listed in the player status window, but only those skills he has chosen (not every skill available). I was thinking attributes but how do I tell the program not to display it unless the player has picked it?


to set the status attributes via scripting, an example:

(remember, you got to actually create/have-existing the stats/attributes, as the 'statusattributes' is just DISPLAYMENT, you can't display what doesn't exist. If you need help with creating the stats/attributes, selecting them, and/or want/need a better design, if not a coder, let me know)

generic (concept only) syntax:

set (NAME_OF_OBJECT, "NAME_OF_ATTRIBUTE", "DICTIONARY_ITEM'S_KEY_EQUALS_VALUE_EXPRESSION")
// or (if the above doesn't work):
set (NAME_OF_OBJECT, "NAME_OF_ATTRIBUTE", DICTIONARY_ITEM'S_KEY_EQUALS_VALUE_EXPRESSION)

// example syntax:

set (player, "statusattributes", "strength = Strength: !")
// or (if the above doesn't work):
set (player, "statusattributes", strength = Strength: !)

// example output/result/displayment:

status pane (right side):

Strength: 0 // it'll update as you change this stat during game play

// ------------------------------------

<object name="player">

  <attr name="strength" type="int">0</attr>
  <attr name="endurance" type="int">0</attr>
  
  <!--
  etc etc etc stats/attributes
  -->

</object>

as for only displaying (and setting) your stats (if they were chosen) via the status attributes:

the easiest design and scripting would be like this...

<game name="example_game">

  <attr name="start" type="script">

    // whatever your scripting for selecting your stats/attributes (if need help with this, let me know, and/or if you want to see a different/better design for doing it... if you're not a coder)

    do (example_object, "example_script_attribute")

  </attr>

</game>

<object name="room">
</object>

<object name="player">

  <attr name="parent" type="object">room</attr>

  <attr name="strength" type="int">0</attr>
  <attr name="endurance" type="int">0</attr>
  
  <!--
  etc etc etc stats/attributes
  -->

</object>

<object name="example_object">

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

    <value>strength</value>
    <value>endurance</value>

     <!--
    etc etc etc stats/attributes
    -->

  </attr>

  <attr name="example_script_attribute" type="script">
    foreach (stat_string_variable, example_object.example_stringlist_attribute) {
      if (HasAttribute (player, stat_string_variable)) {
        set (player, "statusattributes", "\" + stat_string_variable + " = " + CapFirst (stat_string_variable) + ": !\"")
        // or (if the above doesn't work):
        // set (player, "statusattributes", stat_string_variable + " = " + CapFirst (stat_string_variable) + ": !")
        // or (if the above doesn't work):
        // set (player, "statusattributes", stat_string_variable = CapFirst (stat_string_variable): !)
      }
    }
  </attr>

</object>

here's some guides as well:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help#37375
http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk


ask if you need help with anything and/or if it doesn't work


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

Support

Forums