Itemproperty

The itemproperty data type in NWScript is used to represent instances of item properties. As instances, variables of this type have the (unintuitive to some) characteristic that two itemproperty variables are only equal if both refer to the same instance of an item property; it is not sufficient for both variables to refer to the same kind of property. Thus, for example, it is possible for two itemproperty variables to both be assigned a haste item property, yet not have the variables be equal. Generally, two itemproperty variables are only equal if they were assigned the return value of the same, single function call. For example, the following script will cause the caller to say "The properties are not equal." and "The third equals the second."

void main {   itemproperty ipHaste1 = ItemPropertyHaste; itemproperty ipHaste2 = ItemPropertyHaste; itemproperty ipHaste3 = ipHaste2;

// Compare same kind of itemproperty, but different sources. if ( ipHaste1 == ipHaste2 ) SpeakString("Haste is haste."); else SpeakString("The properties are not equal.");

// Compare itemproperties from the same source. if ( ipHaste2 == ipHaste3 ) SpeakString("The third equals the second."); else SpeakString("The third haste was different."); }