Difference between revisions of "GetItemAtSlot"

From UODemo Wiki
Jump to: navigation, search
m
m (Update URL's to point to UO98.org)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
object '''getItemAtSlot'''(object ''Mobile'', integer SlotNumber);<br>
 
object '''getItemAtSlot'''(object ''Mobile'', integer SlotNumber);<br>
  
If the given Mobile is not a valid mobile then [[NULL]] is returned.
+
If the given Mobile is not a valid mobile then [[NULL]] is returned.<br>
If the slot number is not between 1 or 30 then [[NULL]] is returned.
+
If the slot number is not between 1 or 30 then [[NULL]] is returned.<br>
 
Otherwise the [[Equipment|equipeded item]] at the specified index (''SlotNumber'') is returned.
 
Otherwise the [[Equipment|equipeded item]] at the specified index (''SlotNumber'') is returned.
  
Line 9: Line 9:
 
There is a bug in this function. 30 is not a valid slot, 29 is the last valid one.<br>
 
There is a bug in this function. 30 is not a valid slot, 29 is the last valid one.<br>
 
Due to the memory lay-out, the function will interprete the mobile's direction as if it were an object.<br>
 
Due to the memory lay-out, the function will interprete the mobile's direction as if it were an object.<br>
Thus calling ''getItemAtSlot(30)'' will crash the server. Also view the forums : [http://www.joinuo.com/forums/viewtopic.php?f=32&t=4146 Discussion of this bug]
+
Thus: calling ''getItemAtSlot(30)'' will crash the server if the mobile is not facing North.<br>
 +
Also view the forums : [http://forums.uo98.org/viewtopic.php?f=32&t=4146 Discussion of this bug]
  
  
 
Return to the [[Command List]].
 
Return to the [[Command List]].

Latest revision as of 18:58, 21 July 2016

object getItemAtSlot(object Mobile, integer SlotNumber);

If the given Mobile is not a valid mobile then NULL is returned.
If the slot number is not between 1 or 30 then NULL is returned.
Otherwise the equipeded item at the specified index (SlotNumber) is returned.

You can use getItemAtSlot(29) to get the bank object.

There is a bug in this function. 30 is not a valid slot, 29 is the last valid one.
Due to the memory lay-out, the function will interprete the mobile's direction as if it were an object.
Thus: calling getItemAtSlot(30) will crash the server if the mobile is not facing North.
Also view the forums : Discussion of this bug


Return to the Command List.