Difference between revisions of "NULL"

From UODemo Wiki
Jump to: navigation, search
m (Protected "NULL" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
Line 28: Line 28:
 
}
 
}
 
</pre></code>
 
</pre></code>
 +
 +
 +
Return to the [[Command List]].

Revision as of 10:26, 25 January 2010

object NULL(void);

This returns an object with a fixed serial of 0. It is important to note that this is a function so you must use it with round brackets (). This is different from the C language!


Therefor the following 2 code examples are equal:

// Example 1
if(getWeapon(this) == NULL () ) // Notice the () after NULL !!!
{
  systemMessage(this, "I am unarmed!");
}
else
{
  systemMessage(this, "I am armed!");
}
// Example 2
if(objtoint(getWeapon(this)) == 0)
{
  systemMessage(this, "I am unarmed!");
}
else
{
  systemMessage(this, "I am armed!");
}


Return to the Command List.