pfw wrote:Thanks. Out of interest, why do they exist/ get removed?
The Pixie wrote:"pfw"
Thanks. Out of interest, why do they exist/ get removed?
This is a good question. I got caught with this once, and I see no reason for it. It is useful to know if something is a room, and this would be the best way.
The best alternative is probably to check if the object has any exits, and assume it is a room if it does.
<function name="IsRoom" parameters="obj" type="boolean"><![CDATA[
return (ListCount(ScopeExitsForRoom(obj)) > 0 or GetBoolean(obj, "thisisaroom"))
]]></function>
(I presume good coders prefer doing more with scripting, than with attributes)
<object name="global_data_object">
<attr name="attribute_stringlist" type="simplestringlist">strength;endurance;dexterity;agility;speed;luck</attr>
</object>
<object name="player">
</object>
<function name="function_1">
foreach (attribute_x, global_data_object.attribute_stringlist) {
if (not HasInt (player, attribute_x)) {
set (player, attribute_x, 0)
}
}
</function>
// since 'player' has none of the Attributes, the scripting will give the 'player' all of these Attributes with having the Value of 0:
// player.strength = 0
// player.endurance = 0
// player.dexterity = 0
// player.agility = 0
// player.speed = 0
// player.luck = 0
<object name="global_data_object">
<attr name="attribute_stringlist" type="simplestringlist">strength;endurance;dexterity;agility;speed;luck</attr>
</object>
<object name="player">
</object>
<object name="orc">
</object>
<function name="function_1" parameters="character_parameter">
foreach (attribute_x, global_data_object.attribute_stringlist) {
if (not HasInt (character_parameter, attribute_x)) {
if (character_parameter.name = "player") {
if (attribute_x.name = "strength" or attribute_x.name = "endurance" or attribute_x.name = "dexterity") {
set (character_parameter, attribute_x, 100)
} else if (attribute_x.name = "agility" or attribute_x.name = "speed" or attribute_x.name = "luck") {
set (character_parameter, attribute_x, 0)
}
} else if (character_parameter.name = "orc") {
if (attribute_x.name = "strength" or attribute_x.name = "endurance" or attribute_x.name = "dexterity") {
set (character_parameter, attribute_x, 0)
} else if (attribute_x.name = "agility" or attribute_x.name = "speed" or attribute_x.name = "luck") {
set (character_parameter, attribute_x, 100)
}
}
}
}
</function>
// player.strength = 100
// player.endurance = 100
// player.dexterity = 100
// player.agility = 0
// player.speed = 0
// player.luck = 0
// orc.strength = 0
// orc.endurance = 0
// orc.dexterity = 0
// orc.agility = 100
// orc.speed = 100
// orc.luck = 100