General methods

Общие методы, доступные в скриптах

General Methods

Name Result Description Code Params Examples
Delay - Delay \ wait for a specified time
function Delay(ms: Cardinal): Boolean;

ms - time in ms (1 sec = 1000 ms)

while (User.Cast.EndTime <> 0) do Delay(100);   // Wait for cast ends
PlaySound - Play specified sound file
procedure PlaySound(const FileName: string; Loop: Boolean = false);

const FileName - path to a file
Loop - play sound in loop or not

if (User.Dead) then PlaySound(ExePath +'/Sounds/die.wav');   // Play sound if dead
StopSound - Stop playing sounds
procedure StopSound;
There are no arguments
StopSound;  // Stop playing sounds
ExePath - Returns path to bot directory
function ExePath: string;
There are no arguments
Script.Replace(ExePath +'/Scripts/SomeScript.txt'):   // Runs the script SomeScript.txt, from 'Scripts' folder in bot directory
CalcXYZ TXYZ Returns the coordinates of the point to which you need to move in order to run up to some coordinate \ object. In addition, the distance (along the radius) and the distance to be run
function CalcXYZ(XYZ, ToXYZ: TXYZ; Dist: Integer; SideDist: Integer = 0): TXYZ;
function CalcXYZ(Obj: TL2Spawn; ToXYZ: TXYZ; Dist: Integer; SideDist: Integer = 0): TXYZ;
function CalcXYZ(Obj, ToObj: TL2Spawn; Dist: Integer; SideDist: Integer = 0): TXYZ;
There are no arguments Examples not found
TimerEx - Pass-through timer
function TimerEx(var Value: Cardinal; Delay: Cardinal): Boolean;

var Value - variable that will change
Cardinal - frequency with which the function will be performed (ms)

while true do if TimerEx(T1, 1000) then print('Прошла 1 секунда');   // prints message every second
  • Examples found for this method:
GetHWID - Get unique PC code
function GetHWID: Cardinal;
There are no arguments
Print(GetHWID);   // prints PC's hwid
BotLoginID - Get a unique ID (hash) based on botlogin
function BotLoginID: Cardinal;
There are no arguments
Print(BotLoginID);
GetControl TL2Control Get control of another char (same PC)
function GetControl(Nick: String): TL2Control;

Nick - char nickname

GetControl('xxxNAGIBATORxxx').GoHome();   // will revive in town by another bot window with the specified nickname running on the same PC
  • Examples found for this method:
GetControlByIndex TL2Control Get control of another char by index in bot account manager
function GetControlByIndex(Index: Integer): TL2Control;

Index - account serial number (starting from 0)

GetControlByIndex(3).SetTarget(User);   // 4-th acc will target our current char
ShMem - Global array accessible to all accounts
ShMem: array[0..1000] of Integer;
There are no arguments
Print(IntToStr(ShMem[3]));
  • Examples found for this method:
LanguageID Integer Interface language (1-russian, 2-english)
function LanguageID: Integer;
There are no arguments Examples not found

Global settings

Name Result Description Code Params Examples
MinCapSize Integer Set minimal captcha picture size (default - 800)
property MinCapSize: Integer;
There are no arguments
MinCapSize:= 600;   // will catch captcha pictures with size > 600
СaptchaScan Boolean Activates an additional captcha scanner, if on the server the captcha package ID is changed to custom
property СaptchaScan: Boolean;
There are no arguments
СaptchaScan:= true;

Event Handlers

Name Result Description Code Params Examples
OnMoveEvent - Event handler while running (death \ disconnect \ mob attack)
procedure OnMoveEvent(Attacker: TLive; var BreakMove: Boolean);

Attacker - whos attacking

var BreakMove - stop movement or not

  • Examples found for this method:
OnEntry Boolean Function excited with Engine.Entry from another script
function OnEntry(var Param): Boolean;

var Param - passed parameter

  • Examples found for this method:
OnFree - Called upon completion of the script
procedure OnFree;
There are no arguments Examples not found
OnAction - Handler of game events from TL2Action
procedure OnAction(Action: TL2Action; P1, P2: Pointer);

Action - event
P1, P2 - parameters for each event have their own values

Examples not found
OnPacket - Packet handler S > C
procedure OnPacket(ID1, ID2: Cardinal; Data: Pointer; Size: Word);
There are no arguments Examples not found
OnCliPacket - Packet handler C > S
procedure OnCliPacket(ID1, ID2: Cardinal; Data: Pointer; Size: Word);
There are no arguments Examples not found

Converting Data Types

Name Result Description Code Params Examples
MemToHex String Converts memory to hex string
function MemToHex(const dt; size: Word; sep: char = #0): String; overload;
function MemToHex(const Mem: AnsiString): String; overload;

const dt - data (array or string)
size - data size
sep - separator (empty by default)
const Mem - line

Print(MemToHex(User.OID, 3));   // prints our OID
HexToMem Cardinal \ AnsiString Converts hex string to memory
function HexToMem(const Hex: string; var Buf): Cardinal; overload;
function HexToMem(const Hex: string): AnsiString; overload;

const Hex - hex string
var Buf - container for recording

Examples not found
FToStr String Converts Float / Single to string
function FToStr(Value: Single): string;

Value - floating point number

Print(FToStr(33/100));

Obtaining data from the database

Name Result Description Code Params Examples
BaseItemByID String Get item name via ID
function BaseItemByID(ID: Cardinal; RuDB: Boolean): String;

ID - item id
RuDB - use russian DB (true) / english DB (false)

Print(BaseItemByID(736, false));
BaseNpcByID String Get NPC name via ID
function BaseNpcByID(ID: Cardinal; RuDB: Boolean): String;

ID - npc id
RuDB - use russian DB (true) / english DB (false)

Print(BaseNpcByID(User.Target.ID, false));
BaseSkillByID String Get skill name via ID
function BaseSkillByID(ID: Cardinal; RuDB: Boolean): String;

ID - skill id
RuDB - use russian DB (true) / english DB (false)

Print(BaseSkillByID(User.Cast.ID, false));
BaseNpcStrById String
function BaseNpcStrById(ID: Cardinal; RuDB: Boolean): String;
There are no arguments Examples not found
BaseItemIconByID Pointer
function BaseItemIconByID(ID: Cardinal; RuDB: Boolean; Data: Pointer): Pointer;
There are no arguments Examples not found
BaseSkillIconByID Pointer
function BaseSkillIconByID(ID: Cardinal; RuDB: Boolean; Data: Pointer): Pointer;
There are no arguments Examples not found
BaseNpcByName Cardinal
function BaseNpcByName(const Name: string; RuDB: Boolean): Cardinal;
There are no arguments Examples not found
GetBaseSkill TBaseSkill
function GetBaseSkill(Index: Integer; RuDB: Boolean): TBaseSkill;
There are no arguments Examples not found
GetBaseBuff TBaseBuff
function GetBaseBuff(Index: Integer; RuDB: Boolean): TBaseBuff;
There are no arguments Examples not found
GetL2ClassInfo String Get information via ClassID
function GetL2ClassInfo(ClassID, InfoType: Integer): String;

ClassID - ID char's class
InfoType - type of information, which we want to get (0..4)

Print(GetL2ClassInfo(User.ClassID, 1));   // will print name of our profession
GetBaseNpc Boolean Get information about NPC from game client
function GetBaseNpc(ID: Cardinal; var Name: string; var Spd1, Spd2: Integer): Boolean;

ID - индентификатор
Name - имя NPC
Spd1
Spd2

Examples not found
GetBaseItem Boolean Get info about item from game client
function GetBaseItem(ID: Cardinal; var Name: string): Boolean;

ID - индентификатор
Name - название предмета

Examples not found
GetBaseSkill Boolean Get info from about skill from game client
function GetBaseSkill(ID, LVL: Cardinal; var Name, ICOName: string; var R, MP, OP: Integer): Boolean;

ID - идентивифактор 
LVL - уровень навыка
var Name - буфер, куда будет помещено название скила
var ICOName - 
var R - 
var MP - 
var OP - 

Examples not found