attribute not recognised

arnisd
09 Dec 2013, 19:04
So i've got this problem where i want to have a flexible description of the player, as for example he would eat to much and becomes fat.
I figured the best way to do this would be having several attributes with string values and then when the player uses a certain object, the turn script would pick up the item use and change the attribute value of the player.
To make a turn script pick this up, i created a used attribute with value unused in the object, but for some reason something doesn't link up, i get an error when using the object. quest doesn't recognise the attribute i created for the object.
While it does notice the attribute i created for the player.

The Pixie
09 Dec 2013, 22:15
I think a turnscript is overkill.

I would either:

1. Change the use script on the certain object to change the look attribute of the player. This is the simpler option, but the description would only reflect the last change.

2. Change the use script on the certain object to change a certain attribute of the player (eg increase a foodeaten attribute). Then have a look script that gives a message based on those attribute (if foodeaten is greater than five, say he is putting on weight).

arnisd
10 Dec 2013, 17:28
Ty for your help, the first option isn't really what i'm looking for, the second helped. But the problem actually was me screwing up in the scripts with expressions and such, so quest couldn't find anything. :lol:
Though i think using a turn script to edit the values of the attributes or a look script that gives a certain message as an attribute reaches a certain value, will come down to the same thing. Although with your idea of the look script sounds nice. In the end i'll see what i'll do.^^

and ty for your help

HegemonKhan
15 Dec 2013, 07:32
Using the "Changed" Script:

<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<body_weight_string type="string">normal</body_weight_string>
<body_weight_integer type="int">0</body_weight_integer>
<changedbody_weight_integer type="script"><![CDATA[
if (player.body_weight_integer < 0) {
player.body_weight_string = "skinny"
} else if (player.body_weight_integer > 0) {
player.body_weight_string = "fat"
} else if (player.body_weight_integer > 0) {
player.body_weight_string = "normal"
}
]]></changedbody_weight_integer>
<statusattributes type="simplestringdictionary">body_weight_integer = Body Weight: !;body_weight_string = Body Weight: !</statusattributes>
</object>

<object name="global_data_object">
<inherit name="editor_object" />
<body_weight_string_list type="simplestringlist">skinny;normal;fat</body_weight_string_list>
</object>

<object name="hamburger">
<inherit name="editor_object" />
<eat type="script">
msg ("You eat the hamburger, gaining 100 more lbs")
player.body_weight_integer = player.body_weight_integer + 100
</eat>
<displayverbs type="simplestringlist">Eat</displayverbs>
<displayinventory type="simplestringlist">Eat</displayinventory>
</object>

<object name="treadmill">
<inherit name="editor_object" />
<exercise type="script">
msg ("You run on the treadmill, burning off 100 less lbs")
player.body_weight_integer = player.body_weight_integer - 100
</eat>
<displayverbs type="simplestringlist">Exercise</displayverbs>
<displayinventory type="simplestringlist">Exercise</displayinventory>
</object>

<function name="body_weight_string_character_creation_function">
show menu ("What is your body weight?", global_data_object.body_weight_string_list, false) {
player.body_weight_string = result
msg ("You have a" + player.body_weight_string + "body weight.")
}
</function>

<function name="body_weight_integer_character_creation_function">
msg ("What is your body weight?")
get input {
if (IsInt (result)) {
player.body_weight_integer = ToInt (result)
} else {
body_weight_integer_character_creation_function
}
msg ("Your body weight is" + player.body_weight_integer + "lbs.")
}
</function>


Using a Turnscript:

<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<body_weight_string type="string">normal</body_weight_string>
<body_weight_integer type="int">0</body_weight_integer>
<statusattributes type="simplestringdictionary">body_weight_integer = Body Weight: !;body_weight_string = Body Weight: !</statusattributes>
</object>

<turnscript name="body_weight_global_turnscript">
<enabled />
<script><![CDATA[
if (player.body_weight_integer < 0) {
player.body_weight_string = "skinny"
} else if (player.body_weight_integer > 0) {
player.body_weight_string = "fat"
} else if (player.body_weight_integer > 0) {
player.body_weight_string = "normal"
}
]]></script>
</turnscript>

<object name="global_data_object">
<inherit name="editor_object" />
<body_weight_string_list type="simplestringlist">skinny;normal;fat</body_weight_string_list>
</object>

<object name="hamburger">
<inherit name="editor_object" />
<eat type="script">
msg ("You eat the hamburger, gaining 100 more lbs")
player.body_weight_integer = player.body_weight_integer + 100
</eat>
<displayverbs type="simplestringlist">Eat</displayverbs>
<displayinventory type="simplestringlist">Eat</displayinventory>
</object>

<object name="treadmill">
<inherit name="editor_object" />
<exercise type="script">
msg ("You run on the treadmill, burning off 100 less lbs")
player.body_weight_integer = player.body_weight_integer - 100
</eat>
<displayverbs type="simplestringlist">Exercise</displayverbs>
<displayinventory type="simplestringlist">Exercise</displayinventory>
</object>

<function name="body_weight_string_character_creation_function">
show menu ("What is your body weight?", global_data_object.body_weight_string_list, false) {
player.body_weight_string = result
msg ("You have a" + player.body_weight_string + "body weight.")
}
</function>

<function name="body_weight_integer_character_creation_function">
msg ("What is your body weight?")
get input {
if (IsInt (result)) {
player.body_weight_integer = ToInt (result)
} else {
body_weight_integer_character_creation_function
}
msg ("Your body weight is" + player.body_weight_integer + "lbs.")
}
</function>