Attribute

Hey, I was working on my game, and I had a question about attributes.
So, whenever you play a game, you know how you can see your character's score and health? I wanted to add one of those called "Tiredness."
So I added an attribute and, for the beginning of the game, I set it at 0%
However, when I played the game, it only showed the value: it didn't say what the value was representing.
Also, how would I make that value increase as the game goes on?

Did you read this? http://quest5.net/wiki/Status_Attributes
You can increase/decrease this attribute by script then

Just a quick recommendation:

I suggest calling it "stamina" rather than "tiredness". Or at least change it to something other than "tiredness".

(I don't know how to work with percents, but here's otherwise how to create and work with attributes and status attributes)

an example:

using the GUI~Editor:

creating the attribute:

"Player" (the default POV Object, left pane, the "tree of stuff", click on "Player" so that it is highlighted) -> Attribute (Tab, click on it, right pane) -> Attributes (the bottom box, right pane) -> Add ->

name: tiredness
type (select from the small box's drop down menu, it appears after creating its name): integer
value (appears after you changed the type to: integer): 0

creating the status attribute (this is the displayment of what you want, it shows up in the status pane on the right side):

"Player" (the default POV Object, left pane, the "tree of stuff", click on "Player" so that it is highlighted) -> Attribute (Tab, click on it, right pane) -> Status Attribute (the top box, right pane) -> Add ->

name~key: tiredness
format string~value: (leave blank)

-------------

for a bit more complexity:

let's say you wanted a "percent-like" display, such as:

Tiredness: (current_tiredness) (out of) (maximum_tiredness)
Tiredness: 999 / 999

*********
the more common examples are:

HP: 999 / 999
MP: 999 / 999

*********

do the same as the above, but you got additional steps to do:

create two more ATTRIBUTES (do NOT create status attributes for these two attributes):

"Player" (the default POV Object, left pane, the "tree of stuff", click on "Player" so that it is highlighted) -> Attribute (Tab, click on it, right pane) -> Attributes (the bottom box, right pane) -> Add ->

name: current_tiredness
type (select from the small box's drop down menu, it appears after creating its name): integer
value (appears after you changed the type to: integer): 0

name: maximum_tiredness
type (select from the small box's drop down menu, it appears after creating its name): integer
value (appears after you changed the type to: integer): 0

and then you got to create the turn script for changing the status attribute display:

Object (left pane, the "tree of stuff", click on "Object" so that it is highlighted) -> now, at the very top of the screen, there's a bar that goes across with "File ~ Edit ~ Add ~ Tools ~ Help", choose "Add", and then select "Turn Script" ->

it should now look like this in the right pane:

Turn Script
Turn Script
Name:
[] Enable when the game begins
Script (the small script tool box)
->Add new script

do this:

Turn Script
Turn Script
Name: (whatever you want to call it, for this example, let's call it: status_attribute_display_expanded_turnscript)
[X] Enable when the game begins
Script (the small script tool box)
->Add new script ->

Variables -> Set a variable or attribute ->

Set variable player.tiredness = [EXPRESSION] player.current_tiredness + " / " + player.maximum_tiredness

----------

you should also make a turn counter too, if you want help, then ask, though it's the same steps as shown here if you can get it.

---------

as for increasing and decreasing it:

just plug these into where ever (whatever script or code block wherever) you want them to go:

A. increasing your current_tiredness

Variables -> Set a variable or attribute ->

Set variable player.current_tiredness = [EXPRESSION] player.current_tiredness + your_amount
Set variable player.current_tiredness = [EXPRESSION] player.current_tiredness + 50

B. decreasing your current_tiredness

Variables -> Set a variable or attribute ->

Set variable player.current_tiredness = [EXPRESSION] player.current_tiredness - your_amount
Set variable player.current_tiredness = [EXPRESSION] player.current_tiredness - 50

C. increasing your maximum_tiredness

Variables -> Set a variable or attribute ->

Set variable player.maximum_tiredness = [EXPRESSION] player.maximum_tiredness + your_amount
Set variable player.maximum_tiredness = [EXPRESSION] player.maximum_tiredness + 50

D. decreasing you maximum_tiredness

Variables -> Set a variable or attribute ->

Set variable player.maximum_tiredness = [EXPRESSION] player.maximum_tiredness - your_amount
Set variable player.maximum_tiredness = [EXPRESSION] player.maximum_tiredness - 50

E. increasing your tiredness (if you don't want to have~use a current and maximum tiredness structure, this means you didn't create that turn script):

Variables -> Set a variable or attribute ->

Set variable player.tiredness = [EXPRESSION] player.tiredness + your_amount
Set variable player.tiredness = [EXPRESSION] player.tiredness + 50

F. decreasing your tiredness (if you don't want to have~use a current and maximum tiredness structure, this means you didn't create that turn script):

Variables -> Set a variable or attribute ->

Set variable player.tiredness = [EXPRESSION] player.tiredness - your_amount
Set variable player.tiredness = [EXPRESSION] player.tiredness - 50

----------------------

and here's an example of how it would look in Code:

(do note that this is an old file, from v5.2)

<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = ;hp = </statusattributes>
<curhp type="int">250</curhp>
<maxhp type="int">500</maxhp>
<hp>0 / 0</hp>
</object>
</object>
<turnscript name="game_turns_turnscript">
<enabled />
<script>
player.hp = player.curhp + " / " + player.maxhp
player.turns = player.turns + 1
</script>
</turnscript>
</asl>


--------------------------

oops...

if you want the "tiredness" value to increase with (time or turns), here's the tutorial for it:

http://quest5.net/wiki/Using_timers_and_turn_scripts

and here's how it could be done with the turn script:

<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>cd102f9d-370a-4bda-b6ea-ca42288f619c</gameid>
<version>1.0</version>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = ;tiredness = </statusattributes>
<current_tiredness type="int">0</current_tiredness>
<maximum_tiredness type="int">500</maximum_tiredness>
<tiredness>0 / 0</tiredness>
<turn_adder type="int">1</turn_adder>
</object>
</object>
<turnscript name="game_turns_turnscript">
<enabled />
<script>
if (player.turns = player.turn_adder * 5) {
player.current_tiredness = player.current_tiredness + 10
player.turn_adder = player.turn_adder + 1
}
player.tiredness = player.current_tiredness + " / " + player.maximum_tiredness
player.turns = player.turns + 1
</script>
</turnscript>
</asl>


ach, that took me awhile to figure out, math equations... not easy to do, when you haven't taken math for 10+ years, lol.