Difference between revisions of "NULL"

From UODemo Wiki
Jump to: navigation, search
(Created page with '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 diff...')
 
m
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
<code><pre>// Example 1
 
<code><pre>// Example 1
if(getWeapon(this) == NULL () ) // Notice the () after NULL !!!
+
if( getWeapon(this) == NULL () ) // Notice the () after NULL !!!
 
{
 
{
 
   systemMessage(this, "I am unarmed!");
 
   systemMessage(this, "I am unarmed!");
Line 19: Line 19:
 
<code><pre>
 
<code><pre>
 
// Example 2
 
// Example 2
if(objtoint(getWeapon(this)) == 0)
+
if( objtoint(getWeapon(this)) == 0 )
 
{
 
{
 
   systemMessage(this, "I am unarmed!");
 
   systemMessage(this, "I am unarmed!");
Line 28: Line 28:
 
}
 
}
 
</pre></code>
 
</pre></code>
 +
 +
 +
Return to the [[Command List]].

Latest 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.