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>