Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetDirection

Returns character direction(0-7) Total we have 8 directions in UO: North, NorthEast, East,SouthEast, South, SouthWest, West,NorthWest. NB: Keep in mind, than 0 can be real direction, but also can be default value for non-conected character

Pascal Syntax:

function GetDirection(ObjID : Cardinal) : Byte;

Pascal Example:

Procedure PreslPet;
Begin;
  DPet:=GetDirection(Pet);
  If Dpet=0 then newmoveXY((getX(Pet)+1),(gety(Pet)+1),True,1,True);
  If Dpet=1 then newmoveXY(getX(Pet),(gety(Pet)+1),True,1,True);
  If Dpet=2 then newmoveXY((getX(Pet)-1),(gety(Pet)+1),True,1,True);
  If Dpet=3 then newmoveXY((getX(Pet)-1),gety(Pet),True,1,True);
  If Dpet=4 then newmoveXY((getX(Pet)-1),(gety(Pet)-1),True,1,True);
  If Dpet=5 then newmoveXY(getX(Pet),(gety(Pet)-1),True,1,True);
  If Dpet=6 then newmoveXY((getX(Pet)+1),(gety(Pet)-1),True,1,True);
  If Dpet=7 then newmoveXY(getX(Pet),(gety(Pet)+1),True,1,True);  
end; 

Python Syntax:

def GetDirection(ObjID): --> ubyte