From Stealth Client

Jump to: navigation, search


C

CalcDir

function CalcDir(Xfrom, Yfrom, Xto, Yto:Integer):Byte

Returns the direction for the step from point(Xfrom, Yfrom) to the point(Xto, Yto). If Xfrom = Xto and Yfrom = Yto function will return 100.

Example 1:

Step(CalcDir(GetX(Self), GetY(Self), GetX(Self) +1, GetY(Self)), True);

CancelMenu

procedure CancelMenu

abolition of all traps set on the menu

CancelTarget

procedure CancelTarget

Resets the target. Example:

if targetpresent then
   begin
   canceltarget;
   end;

CancelTrade

procedure CancelTrade(TradeNum : Byte)

CancelWaitTarget

procedure CancelWaitTarget

Cancels trap on target. Not to be confused with CancelTarget.

See also: Doc:Api/CancelTarget

Cast

procedure Cast(Spell : String)

Besides the usual spells and spells can be cast from mystic-books:

  • nether bolt
  • healing stone
  • pure magic
  • enchant
  • sleep
  • eagle strike
  • animated weapon
  • stone form
  • spell trigger
  • mass sleep
  • cleansing winds
  • bombard
  • spell plague
  • hail storm
  • nether cyclone
  • rising colossus

Example:

Cast('Cure');

CastToObj

def CastToObj( SpellName : String, ObjectID : Integer ) -> Boolean

New in version 6.1.5.0

ChangeProfile

function ChangeProfile(ProfileName : String) : Integer

You can use this function to change the current profile to one of another character. For its success, note the following:

  • The current character must be disconnected
  • Only one script should be running
  • Specified profile must exist. Important - profile name is case sensitive.

If the profile is successful, the function returns 0, otherwise returns an error code:

  • -1 Internal error
  • -2 Char connected or is in the process of connecting
  • -3 More than one script is running
  • -4 The specified profile does not exist


CharName

function CharName():String

Returns the char - name(Name).

If there is no connection to the UO server - returns an empty string().

Example 1:

if(CharName = 'MyChar') then
begin
  '' Do something
end;

Example 2:

AddToSystemJournal('char name:' + CharName);


CharTitle

function CharTitle:string;

Returns the char - title.

Example:

  AddToSystemJournal(CharTitle);

CheckLOS

def CheckLOS(xf, yf, zf, xt, yt, zt, WorldNum : Integer) -> Boolean

CheckLag

function CheckLag(timeoutMS : Integer) : Boolean;

CheckLagBegin

procedure CheckLagBegin;

CheckLagEnd

function CheckLagEnd : Boolean;


ClearBadLocationList

procedure ClearBadLocationList

Clears the list of impassable points generated:

  • As a result of the function SetBadLocation
  • If three attempts to step on one and the same point - unsuccessful.


ClearBadObjectList

procedure ClearBadObjectList

Clears the list of impassable objects created by:

  • As a result of the function SetBadObject
  • If three attempts to step on one and the same point - unsuccessful.

ClearChatUserIgnore

procedure ClearChatUserIgnore(Str : String)

ClearContextMenu

procedure ClearContextMenu

Clears the contents of the context menu. After calling this procedure Doc:Api/GetContextMenu will return an empty TStringList, until a new menu.

ClearFigures

procedure ClearFigures;

Removes all previously added to the figure.

ClearGumpsIgnore

procedure ClearGumpsIgnore;

ClearInfoWindow

def ClearInfoWindow() -> None

New in version 6.1.5.0

ClearJournal

procedure ClearJournal

clear the log

ClearJournalIgnore

procedure ClearJournalIgnore

ClearShopList

procedure ClearShopList

ClearSystemJournal

procedure ClearSystemJournal

Clear the System Journal

New in version 6.1.5

ClickOnObject

procedure ClickOnObject(ObjectID:Cardinal)

A single click on the object.

Example:

ClickOnObject(FindType($ 0DE1, Ground));

ClientPrint

procedure ClientPrint(Text : String);

ClientPrintEx

procedure ClientPrintEx(SenderID : Cardinal; Color : Word; Font : Word; Text : String);

ClientRequestObjectTarget

Used before calling Doc:Api/ClientTargetResponse.

def ClientRequestObjectTarget() -> None

Requests a target cursor.

See also: Doc:Api/ClientTargetResponsePresent and Doc:Api/ClientTargetResponse

ClientRequestTileTarget

def ClientRequestTileTarget() -> None


See also: Doc:Api/ClientRequestObjectTarget, Doc:Api/ClientTargetResponsePresent and Doc:Api/ClientTargetResponse

ClientTargetResponse

Used after calling Doc:Api/ClientRequestObjectTarget.

def ClientTargetResponse() -> Dictionary

Returns a dictionary containing keys ['Tile', 'X', 'Z', 'Y', 'ID'].

See also: Doc:Api/ClientTargetResponsePresent

ClientTargetResponsePresent

def ClientTargetResponsePresent() -> Boolean

Returns False while cursor is a target cursor.

See also: Doc:Api/ClientTargetResponse


CloakLayer

function CloakLayer():Byte

Returns the layer number 0x14 - Cloak(Cloak).

Example 1:

if ObjAtLayer(CloakLayer) > 0 then 
  AddToSystemJournal('Cloak ID:' + IntToStr(ObjAtLayer(CloakLayer)));

Example 2:

{If there is something on a layer, then remove}
if ObjAtLayer(CloakLayer) <> 0 then
  begin
    unequip(CloakLayer);
    wait(1000);
  end;

CastToObj

def CloseClientGump( ID : Integer) -> None

CloseClientUIWindow

procedure CloseClientUIWindow(UIWindowType : TUIWindowType; ID : Cardinal);
 
TUIWindowType = wtPaperdoll, wtStatus, wtCharProfile, wtContainer;
 
if UIWindowType = wtContainer then ID := Container Serial, Else ID := character serial

Used for client-side only gumps (i.e. not gumps sent by the server).

Example 1:

#Python
CloseClientUIWindow("wtPaperdoll", Self())

CloseMenu

def CloseMenu() -> None

CloseSimpleGump

procedure CloseSimpleGump(GumpIndex:Word)

Closes the "easy" to index Gump GumpIndex

Closes specials. way, without pressing any buttons on them - as it happens in the client when you press the right mouse button.

Example:

If IsGump then
  if IsGumpCanBeClosed(GetGumpsCount-1) then
    CloseSimpleGump(GetGumpsCount-1);


ColdResist

function ColdResist():Word

Returns the char - cold resistance(Cold Resist).

This only works from the client version Samurie Empire + on the server must be enabled advanced stats sent to the client, otherwise returns 0.

If there is no connection to the UO server - returns 0.

Example 1:

if ColdResist> 0 then
begin
  '' Do something, like go home, or drop, etc.''
end;

Example 2:

  AddToSystemJournal('Current Cold Resist:' + IntToStr(ColdResist))

ConfirmTrade

procedure ConfirmTrade(TradeNum : Byte)


Connect

procedure Connect

Connects the current char to the server

Example 1: {{page>:examples:connect&nofooter}}

See also


Connected

function Connected:boolean

The status of the connection with the UO server: 'True - charms attached, 'False - not connected

Example 1: {{page>:examples:connect&nofooter}}

See also


ConnectedTime

function ConnectedTime():TDateTime

Returns the char - The last time the server connection(ConnectedTime).

returns during the last successful connecting to the server.

If there is no connection to the UO server - return '30 .12.1899 'free time. in the format of the date it is equivalent to zero.

Example:

  AddToSystemJournal('Last Connect Time:' + DateTimeToStr(ConnectedTime))

ConsoleEntryReply

procedure ConsoleEntryReply(Text : String)

ConsoleEntryUnicodeReply

procedure ConsoleEntryUnicodeReply(Text : String)

This function is used for console output in UO Client. For example it can be used to rename Bulk Order Book (Python):

SetContextMenuHook(book_to_rename_ID, 0)  # set menu hook to autoselect "Name Book" entry
RequestContextMenu(book_to_rename_ID)     # activate book console menu
Wait(1500)                                # short delay
ConsoleEntryUnicodeReply(("New book name"+"\r")) # enter a new book name

Note! Don't forget to finish all output strings with CR string ("\r").

ConvertIntegerToFlags

Translate the numeric value of flags in the flags and takes two arguments:

  • Group that can be either:
    • 1 for land;
    • 2 for statics;
  • Value is the numeric value of flags.
function ConvertIntegerToFlags(Group : byte; Value : LongWord) : TTileDataFlagSet
 
TTileDataFlagSet:
TTileDataFlags = (
tsfBackground,
tsfWeapon,
tsfTransparent,
tsfTranslucent,
tsfWall,
tsfDamaging,
tsfImpassable,
tsfWet,
tsfUnknown,
tsfSurface,
tsfBridge,
tsfGeneric,
tsfWindow,
tsfNoShoot,
tsfPrefixA,
tsfPrefixAn,
tsfInternal,
tsfFoliage,
tsfPartialHue,
tsfUnknown1,
tsfMap,
tsfContainer,
tsfWearable,
tsfLightSource,
tsfAnimated,
tsfNoDiagonal,
tsfUnknown2,
tsfArmor,
tsfRoof,
tsfDoor,
tsfStairBack,
tsfStairRight,
tlfTranslucent,
tlfWall,
tlfDamaging,
tlfImpassable,
tlfWet,
tlfSurface,
tlfBridge,
tlfPrefixA,
tlfPrefixAn,
tlfInternal,
tlfMap,
tlfUnknown3);
TTileDataFlagSet = set of TTileDataFlags;

Here is a sample

Program New;
var   FlagSet: TTileDataFlagSet;
begin
// флаги, что соответствуют 67117569
// [tdfBackground,tdfSurface,tdfNoShoot,tdfUnknown2]
FlagSet:= ConvertIntegerToFlags(2, 67117569);
IF tdfSurface in FlagSet then
AddToSystemJournal('surface'); 
IF tdfImpassable in FlagSet then
AddToSystemJournal('impass'); 
end.


Count

function Count(ObjType:Word):Word

Looking for things in the backpack by type and by returning FindFullQuantity.


CountEx

function CountEx(ObjType, Color:Word; Container:Cardinal):Word

Looking for things in the container(Container) by type(ObjType) and color(Color). As a result FindFullQuantity return found items.


CountGround

function CountGround(ObjType:Word):Word

Looking for things on the earth according to the type and the resulting return FindFullQuantity.

PauseCurrentScript

function CurrentLine : Integer;

Returns the number of current script line

Example:

 if something_wrong_happens then
   AddToSystemJournal('Problem in line ' + CurrentLine.ToString);

CurrentScriptPath

function CurrentScriptPath: String;

Returns the path of the current running script.

Example:

AddToSystemJournal(CurrentScriptPath());

Result:

22:50:48:546 [CharName]: V:\Stealth Client\Scripts\