Scripting guide for
Lineage 2
Adrenaline
Questions related to program activation (key purchase):
Skype:natherlog
by Novikov
Localization is made
by natherlog
Contents
Class hierarchy ......................................................................................................................................................................................................................................................... ..... 2
TL2Control = class .......................................................................................................................................................................................................................................................... 3
TL2Object = class ........................................................................................................................................................................................................................................................... 5
TL2Spawn = class(TL2Object); ....................................................................................................................................................................................................................................... 5
TL2Drop = class(TL2Spawn); .......................................................................................................................................................................................................................................... 6
TL2Npc = class(TL2Live); ................................................................................................................................................................................................................................................ 6
TL2Pet = class(TL2Npc); ................................................................................................................................................................................................................................................. 6
TL2Char = class(TL2Live); ............................................................................................................................................................................................................................................... 6
TL2User = class(TL2Char); .............................................................................................................................................................................................................................................. 6
TL2Effect = class(TL2Object); ......................................................................................................................................................................................................................................... 6
TL2Buff = class(TL2Effect); ............................................................................................................................................................................................................................................. 6
TL2Live = class(TL2Spawn); ............................................................................................................................................................................................................................................ 7
TL2Skill = class(TL2Effect); ............................................................................................................................................................................................................................................. 8
TL2Item = class(TL2Object); ........................................................................................................................................................................................................................................... 8
TL2List = class;................................................................................................................................................................................................................................................................ 8
TSpawnList = class(TL2List); ........................................................................................................................................................................................................................................... 9
TNpcList = class(TL2List); ............................................................................................................................................................................................................................................... 9
TPetList = class(TL2List); ................................................................................................................................................................................................................................................ 9
TCharList = class(TL2List); .............................................................................................................................................................................................................................................. 9
TDropList = class(TL2List); .............................................................................................................................................................................................................................................. 9
TSkillList = class(TL2List); ............................................................................................................................................................................................................................................... 9
TBuffList = class(TL2List); ............................................................................................................................................................................................................................................... 9
TItemList = class(TL2List); .............................................................................................................................................................................................................................................. 9
TParty = class; ..............................................................................................................................................................................................................................................................10
TInventory = class; .......................................................................................................................................................................................................................................................10
TL2Script = class; ..........................................................................................................................................................................................................................................................10
TConfirmDlg = class......................................................................................................................................................................................................................................................10
Functions: ....................................................................................................................................................................................................................................................................10
ChatMessage ...............................................................................................................................................................................................................................................................10
Enumeration types ......................................................................................................................................................................................................................................................11
Examples......................................................................................................................................................................................................................................................................13
Class hierarchy
TL2Item
TL2Control
TL2Drop
TL2Spawn
TL2Object
TL2Char
TL2User
TL2Npc
TL2Pet
TL2Live
TParty
TL2Skill
TL2Effect
TInventory
TL2Buff
TSpawnList
TL2Script
TNpcList
TConfirmDlg
TPetList
TCharList
TL2List
TDropList
TSkillList
TBuffList
TItemList
TL2Control = class
TL2Control = class
General class of bot control. Available in the scripts
functions by name Engine. Can be received from
another account engine with the help of
GetControl(const Name: string): TL2Control;
Assist(const Name: string): Boolean;
Assists the target (e.g Engine.Assist(name))
Attack(TimeOut: Cardinal = 2000; Ctrl:
Boolean = false): Boolean;
Attack. TimeOut - delay (ms); Ctrl - force attack
AutoSoulShot(const Name: string; Active:
Boolean): Boolean;
Enable/disable automatical soulshot use. Name soulshot name; Active - on/off
AutoTarget(Range: Cardinal = 2000; ZRange:
Cardinal = 300; NotBusy: Boolean = true):
Boolean;
Target autoselection in radius Range. NotBusy - selects
only "free target" (not targeted by anyone). Considers
map zones and objects added to the IgnoreList
Blinks on the taskbar. If GameWindow - true then blinks
game window, otherwise blinks bot window
Get HWND of lineage 2 window (Bot window)
BlinkWindow(GameWindow: Boolean): Boolean;
BotWindow: Cardinal;
ByPassToServer(const S : String) : Boolean;
CancelTarget: Boolean;
ClearIgnore;
ClearZone;
CrystalItem(ID : Cardinal) : Boolean;
ConfirmDialog(Accept: Boolean): Boolean;
ConfirmDlg : TConfirmDlg;
DestroyItem(const Name: string; Count:
Cardinal): Boolean;
DismissParty(const Name: string): Boolean;
DismissPet: Boolean;
DismissSum: Boolean;
Dispel(const Name: string): Boolean;
DlgOpen: Boolean;
Cancel the target
Clear the ignore list
Clear all zones on the map
Crystallize the item
Confirm any dialogue in the game (Yes/No)
Receive class TConfirmDlg
DlgSel(const Txt: string): Boolean; overload;
Select string by Text (e.g Engine.DlgSel('Quest.'))
DlgSel(Index: integer): Boolean; overload;
Select string by Index (e.g Engine.DlgSel(1))
DlgText: string;
DMoveTo(x, y, z : Integer) : Boolean;
DUseSkill(id : Cardinal; ctrl, Shift :
Boolean) : Boolean;
Contains full text of the current dialogue
Move to the set point without waiting for a finish
Use skill by ID without cooldown check and MP amount.
Entry(var Param): Boolean;
EnterText(const Txt: string): Boolean;
Equipped(const Name: string): Integer;
FaceControl(ID: Integer; Active: Boolean):
Boolean;
FindEnemy(var Enemy: TL2Live; Obj: TL2Live;
Range: Cardinal = 2000; ZRange: Cardinal =
300): Boolean;
GameClose: Boolean;
GameStart(CharIndex: Integer): Boolean;
GameWindow : Cardinal;
GetUser: TL2User;
GetParty: TParty;
GetSkillList: TSkillList;
GetInventory: TInventory;
GetDropList: TDropList;
GetNpcList: TNpcList;
GetCharList: TCharList;
GetPetList: TPetList;
GoHome(ResType: TRestartType = rtTown) :
Boolean;
Ignore(Obj: TL2Spawn);
Destroy item with Name at the rate of Count
Expell player with Name from group
Unsummon pet (if any)
Unsummon summon (if any)
Dispell buff with the Name
Start dialogue with NPC
Function activation in the script of another account. Activating
function should look like - function OnEntry(var Param):
Boolean; Param - any transmissive parameter.
Press Enter, write Txt, press Enter.
Equipment check
On/off interface button.
Search an "enemy" for the object Obj in the set Radius
(regarding to object Obj). If function result - true, then found
"enemy" will be written to Enemy variable.
Close the game (L2 client)
Start the game by CharIndex (characters should be
on the character selection screen)
Get HWND of lineage 2 window (Game Window)
Getting user object (TL2User) from another account
Return character back to village after death
Add an object to the ignore list. AutoTarget and AutoPick up
methods skip such objects.
InviteParty(const Name: string; Loot:
TLootType = ldLooter): Boolean;
InZone(X, Y, Z: Integer): Boolean; overload;
InZone(Obj: TL2Spawn): Boolean; overload;
IsBusy(Obj: TL2Npc): Boolean;
IsDay: Boolean;
JoinParty(Join: Boolean): Boolean;
LearnSkill(ID: Cardinal): Boolean;
LeaveParty: Boolean;
LoadZone(const Name: string): Boolean;
LoadConfig(const Name: string): Boolean;
MakeItem(Index : Cardinal) : Boolean;
MoveItem(const Name: string; Count: Cardinal;
ToPet: Boolean): Boolean;
Invite player by Name. Loot - looting rules
If there is the point in zone
If there is an object in zone
Check object if it is targeted or not by another players
Day in the game
Accept/refuse party invitation
Learn skill by ID. Character should be near the skill
master in the HighFive or older chronicles.
Load zone on the map from the file.
Load the confing by Name from the Settings folder (by
default); can be full path as well.
Craft an item by index (Index - list of crafting recipes)
Move/take the item with Name from pet in number Count
MoveTo(ToX: integer; ToY: integer; ToZ:
integer): Boolean; overload;
Move to point
MoveTo(Obj: TL2Spawn; Dist: Integer):
Boolean; overload;
Move to the object Obj at a distance of Dist
MoveToTarget(Dist: Integer = -100): Boolean;
Move to the target (Dist should be negative number)
(e.g Engine.MoveTo(-75));
OpenQuestion: Boolean;
Write system message in the bot window with the
different colors.
NPC exchange. ID - id of item which should be received,
Count - in what amount.
Trade with NPC. Sell - purchase/sell. Items - massive of
items for purchase sell. Massive should consist of pairs (ID,
Count) and should be 2-fold
Click question mark (needed for specific quests)
Pickup(Range: Cardinal = 250; ZRange:
Cardinal = 150; OnlyMy: Boolean = false; Pet:
Boolean = false): Integer; overload;
AutoPickup of all drop in the radius Range. OnlyMy - only
mine. Pet - pick up by pet
MSG(Who, What : String; Color : Integer);
NpcExchange(ID: Cardinal; Count: Cardinal):
Boolean;
NpcTrade(Sell: Boolean; items: array of
Cardinal): Boolean;
Pickup(Obj: TL2Drop; Pet: Boolean = false):
Boolean; overload;
QuestStatus(QuestID: Cardinal; Step:
Integer): Boolean;
Restart: Boolean;
Say(const Text: string; ChatType: Cardinal =
0; const Nick: string = ''): Boolean;
SendMail(const Recipient: string; const
Theme: string; const Content: string; Items:
array of Cardinal; Price: Cardinal = 0):
Boolean;
Pick up object Obj. Pet - pick up by pet
Quest status check. Step - quest step
Go back to character selection screen (character should
be out of fight)
Say in chat
Mail sending. Recipient - addressee; Theme - theme;
Content - content; Items - list (massive) of attached items
(ID/amount); Price - price (if you set any price it will be
"Payment request" otherwise "Regular mail"). If there is no
item with set ID, it will be automatically excluded from the
mail (sending will not be canceled). If the amount of any
item is more than real, it will be automatically changed
ServerTime: Cardinal;
GameTime: Cardinal;
SetPartyLeader(const Name: string): Boolean;
SetTarget(ID: Cardinal): Boolean; overload;
SetTarget(const Name: string): Boolean;
overload;
SetTarget(Obj: TL2Live): Boolean; overload;
Sit: Boolean;
Stand: Boolean;
StopCasting : Boolean;
Status: TL2Status;
Unstuck : Boolean;
Change party leader with the Name (your character should
be party leader)
Set target by ID
Set target by name
Set object Obj as target
Sit
Stand
Stop skill cast
Current account status
Unstuck;
UpdateSkillList: Boolean;
UseAction(ID: Cardinal; Ctrl: Boolean =
false; Shift: Boolean = false): Boolean;
Open skill list (for Interlude servers)
Use ingame action
UseItem(ID: Cardinal; Pet: Boolean = false):
Boolean; overload;
Use item by ID. Pet - used by pet
UseItem(const Name: string; Pet: Boolean =
false): Boolean; overload;
Use item by Name. Pet - used by pet
UseItem(Obj: TL2Item; Pet: Boolean = false):
Boolean; overload;
Use item Obj. Pet - used by pet
UseKey(Key: Word; Ctrl: Boolean = False;
Shift: Boolean = False): Boolean; overload;
Press key. Hold Shift, Ctrl
UseKey(const Key: string; Ctrl: Boolean =
False; Shift: Boolean = False): Boolean;
overload;
UseSkill(ID: Cardinal; Ctrl: Boolean = false;
Shift: Boolean = false): Boolean; overload;
UseSkill(const Name: string; Ctrl: Boolean =
false; Shift: Boolean = false): Boolean;
overload;
WaitAction(Actions: TL2Actions; var P1; var
P2; TimeOut: Cardinal = INFINITE):
TL2Action;
Use skill by ID
Use skill by name
Wait for event or group of events
TL2Object = class
ID: Cardinal;
Name: String;
OID: Cardinal;
Basic class for all ingame objects
Object ID
Object Name
Unique identifier for any object in the game
Valid: Boolean;
Check object for validity in the game
SetVar(Value: Cardinal);
GetVar: Cardinal;
L2Class: TL2Class;
Set variable for Object
Get value of variable
Find out the class which current object belongs to
TL2Object = class
TL2Spawn = class(TL2Object);
TL2Spawn = class(TL2Object);
All objects around the character
DistTo(X: Integer; Y: Integer; Z: Integer):
Cardinal; overload;
Return the distance to the set point
DistTo(Obj: TL2Spawn): Cardinal; overload;
Return the distance to the object Obj
InRange(X: Integer; Y: Integer; Z: Integer;
Range: Cardinal; ZRange: Cardinal = 250):
Boolean;
Check if the point is in the Range (regarding to the
Object) in the set radius
InZone: Boolean;
SpawnTime: Cardinal;
Check if the object is in the zone (hunting zone)
X: Integer;
Object spawn time
Coordinates of the object
Y: Integer;
Coordinates of the object
Z: Integer;
Coordinates of the object
TL2Drop = class(TL2Spawn);
TL2Drop = class(TL2Spawn);
Count: int64;
IsMy: Boolean;
Stackable: Boolean;
Drop in the game
Amount
Check if drop is mine (mine - dropped by our character,
pet or our party)
Stackable or no
TL2Npc = class(TL2Live);
TL2Npc = class(TL2Live);
IsPet: Boolean;
PetType: Cardinal;
Basic class for all NPC
Pet or no
Pet type (summon or no)
TL2Pet = class(TL2Npc);
TL2Pet = class(TL2Npc);
Fed: Cardinal;
Class describing our pets/summons
Food (only in %)
TL2Char = class(TL2Live);
TL2Char = class(TL2Live);
CP
: Cardinal;
CurCP
: Cardinal;
MaxCP
: Cardinal;
Hero
: Boolean;
Noble
: Boolean;
ClassID : Cardinal;
MainClass: Cardinal;
MountType: Byte;
StoreType: Byte;
Sex
: Cardinal;
Race
: Cardinal;
CubicCount: Cardinal;
Recom: Cardinal;
Premium
: Boolean;
Basic class for all characters
Mount type
0 male 1 female
TL2User = class(TL2Char);
TL2User = class(TL2Char);
CanCryst: Boolean;
Charges: Cardinal;
WeightPenalty: Cardinal;
WeapPenalty: Cardinal;
ArmorPenalty: Cardinal;
DeathPenalty: Cardinal;
Souls: Cardinal;
Class describing our character
Can our character crystallize items or no
Charges for Duelists
Souls for Kamaels
TL2Effect = class(TL2Object);
TL2Effect = class(TL2Object);
Level: Cardinal;
EndTime: Cardinal;
Basic class for all magic skills
Skill level
Cooldown
TL2Buff = class(TL2Effect);
TL2Buff = class(TL2Effect);
Class describing buffs
TL2Live = class(TL2Spawn);
TL2Live = class(TL2Spawn);
AbnormalID : Cardinal;
Abnormals : TBuffList;
Ally: string;
AllyID: Cardinal;
Attackable: Boolean;
AtkOID: Cardinal;
AtkTime: Cardinal;
Buffs: TBuffList;
Cast: TL2Cast;
Clan: string;
ClanID: Cardinal;
CurHP: Cardinal;
CurMP: Cardinal;
Dead: boolean;
Dropped: Boolean;
Exp: Int64;
Basic class of "alive" objects in the game (player, npc,
pet etc)
ID of visual effect.
available in the GoD+ chronicles or above
Alliance name
Alliance ID of the object
Attackable (not force attack)
OID of the object which is attacking
The time object has started to attack
Buffs of the object (available for our character,
party members and pets)
Skill of the object which is casted in the current moment.
Actual if Cast.EndTime > 0, otherwise object is not currently
casting.
Clan name
Clan ID of the object
Current amount of Health Points
Current amount of Mana Points
Dead or alive
Object has dropped or hasn't dropped an item (Dead
parameter must be True)
Experience
EXP2: Int64;
Fishing: Integer;
Fly: Boolean;
If the object has flying or non-flying status
HP: Cardinal;
Current amount of HP (%)
InCombat: Boolean;
In chaotic stance (in fight)
IsMember: Boolean;
Object is member of party
Karma: Integer;
Karma (in GoD+ chronicles can be positive as well)
Level: Byte;
Load: Cardinal;
Weight (%) (available for our character and pet)
MaxHP: Cardinal;
MaxMP: Cardinal;
Maximal HP amount
MP: Cardinal;
Current amount of MP (%)
MyAtkTime: Cardinal;
PK: Boolean;
When I attacked the object.
Player Killer
PvP: Boolean;
The object is in PvP mode
Running: Boolean;
Sitting: Boolean;
The object is moving or jogging
SP: Cardinal;
Speed: Double;
Sweepable: Boolean;
Target: TL2Live;
Team: Byte;
TeleportDist: Cardinal;
TeleportTime: Cardinal;
Title: string;
ToX: Integer;
ToY: Integer;
ToZ: Integer;
Sitting?
Skill Points (SP)
Sweepable
The target of an object
For PvP servers (blue/red type of monsters), as well as
"champion" monsters
The distance of the last teleport
The time of the last teleport
Object title
The coordinates where object moved
TL2Skill = class(TL2Effect);
TL2Skill = class(TL2Effect);
Disabled: Boolean;
Enchanted: Boolean;
Passive: Boolean;
Skill class
Skill is not available
This is Enchanted, a member of class TL2Skill.
Skill is passive
TL2Item = class(TL2Object);
TL2Item = class(TL2Object);
Count: Int64;
Equipped: Boolean;
EnchantLevel: Word;
ItemType : Cardinal;
Grade: Cardinal;
GradeName: string;
Inventory items class
Amount (if stackable)
Equipped or no
This is EnchantLevel, a member of class TL2Item.
0 weapon; 1 armor; 2 jewelry; 5 resources and all other items
('NG', 'D', 'C', 'B', 'A', 'S', 'S80', 'S84', 'R', 'R95', 'R99');
TL2List = class;
TL2List = class;
ByID(ID: Cardinal; var Obj): Boolean;
ByName(const Name: string; var Obj): Boolean;
Count: integer;
Items(Index: integer): TL2Object;
All the lists of the objects in bot are inherited
from this class, lists: buffs, NPC, chars, drops,
items.
Search for an object in the list by ID. If the object is
found, it is moved in the Obj variable.
Search for an object in the list by name. If the object is
found, it is moved in the Obj variable.
Amount of the objects in the list
Allows you to access the object in the list by index
TSpawnList = class(TL2List);
TSpawnList = class(TL2List);
Items(Index: integer): TL2Spawn;
List of all the objects that have coordinates.
Allows you to access the object in the list by index
TNpcList = class(TL2List);
TNpcList = class(TL2List);
Items(Index: integer): TL2Npc;
List of the surrounding NPC. In the scripts available
as NpcList
Allows you to access the object in the list by index
TPetList = class(TL2List);
TPetList = class(TL2List);
Items(Index: integer): TL2Pet;
List of pets. In the scripts available as PetList
Allows you to access the object in the list by index
TCharList = class(TL2List);
TCharList = class(TL2List);
Items(Index: integer): TL2Char;
List of all surrounding players. In the scripts
available as CharList
Allows you to access the object in the list by index
TDropList = class(TL2List);
TDropList = class(TL2List);
Items(Index: integer): TL2Drop;
List of all drop around us. In the scripts
available as DropList
Allows you to access the object in the list by index
TSkillList = class(TL2List);
TSkillList = class(TL2List);
Items(Index: integer): TL2Skill;
List of the current skills of the character. In the
scripts available as SkillList
Allows you to access the object in the list by index
TBuffList = class(TL2List);
TBuffList = class(TL2List);
Items(Index: integer): TL2Buff;
Object buffs list.
Allows you to access the object in the list by index
TItemList = class(TL2List);
TItemList = class(TL2List);
Items(Index: integer): TL2Item;
Inventory list.
Allows you to access the object in the list by index
TParty = class;
TParty = class;
Pets: TNpcList;
Chars: TCharList;
LootType: TLootType;
Leader: TL2Char;
Party class. In the scripts available
as Party.
List of pets in the party
List of characters in the party
Looting rules (types)
Party leader
TInventory = class;
TInventory = class;
Pet: TItemList;
User: TItemList;
Quest: TItemList;
Inventory class. In the scripts available as
Inventory.
Pet inventory
Character inventory
Character inventory (quest)
TL2Script = class;
TL2Script = class;
MainProc(Proc: Pointer);
NewThread(Proc: TThreadFunc; Parameter: Pointer =
nil);
Script class
Call up the procedure of the main thread of the
program. Proc - pointer on the thread procedure;
Parameter - any transferable parameter (not
necessary)
Create new script thread. Proc - pointer on the
thread procedure (procedure
MyTHread(Prm.Pointer)) Parameter - any
transferable parameter (not necessary)
Path: String;
Full path to the directory of script
Resume;
Resume script
Suspend;
Pause script
TConfirmDlg = class
TConfirmDlg = class
MsgID : Cardinal;
ReqID : Cardinal;
Sender: string;
EndTime: Cardinal;
Valid : Boolean;
Dialogue class
:
:
StopSound;
Only forending the script. The body of the
procedure must be created by yourself.
wave
(.wav). Loop - .
Stop sound
Delay(ms: Cardinal): Boolean;
Delay for script (ms)
OnFree;
PlaySound(const FileName: string; Loop: Boolean);
ExePath: string;
GetControl(const Name: string): TL2Control;
BotLoginID: Cardinal;
Returns the path of root folder of the bot
Get the Engine object of another character.
Name - the name of character.
Receive uniquie ID (hash) based on bot-login.
ChatMessage
ChatMessage
ChatMessage.unread: boolean;
ChatMessage.sender: string;
ChatMessage.text: string;
ChatMessage.chattype: TMessageType;
Chat managing object
Unread message
Sender of chat message
Text of sender
Type of sent message
.
Enum values
TL2Status = (
lsOff,
lsOnline,
lsOffline
);
Disconnected
Online
Offline
TL2Race = (
rtHuman,
rtElf,
rtDarkelf,
rtOrc,
rtDwarf,
rtKamael
);
TLootType = (
ldLooter
ldRandom
ldRandomSpoil
ldOrder
ldOrderSpoil
);
Finder Keepers
Random
Random including Spoil
By turn
By turn including Spoil
TStoreType = (
stNone,
stSell,
stPrepare,
stBuy,
stUnknown2,
stManufacture,
stUnknown6,
stObservingGames,
stSellPackage
);
Store type
TL2Action = (
laSpawn,
laDelete,
laPetSpawn,
laPetDelete,
laInvite,
laDie,
laRevive,
laTarget,
laUnTarget,
laBuffs,
laSkills,
laDlg,
laConfirmDlg,
laStop,
laStartAttack,
laStopAttack,
laCast,
laCancelCast,
laTeleport,
laAutoSoulShot,
laNpcTrade,
laSysMsg,
laChat,
laKey
);
Enumeration type for WaitAction
p1 : TConfirmDlg
p1 = id of system message
not usable, use ChatMessage
p1 = id of button
TRestartType = (
rtTown,
rtClanHoll,
rtCastle,
rtFort,
rtFlags
);
TMessageType = (
mtSystem,
mtAll,
mtPrivate,
mtParty,
mtClan,
mtFriend,
mtShout
);
TL2Class = (
lcError,
lcDrop,
lcNpc,
lcPet,
lcChar,
lcUser,
lcBuff,
lcSkill,
lcItem
);
ChatMessage
var
Obj: Tl2Live;
begin
while True do
begin
if ChatMessage.Unread and (ChatMessage.Time < 3000) then
begin
if CharList.ByName(ChatMessage.sender, Obj) and not Obj.IsMember then
if Obj.InZone then
begin
print(ChatMessage.sender);
print(ChatMessage.text);
print(ChatMessage.Time);
print(ChatMessage.ChatType);
end;
end;
Delay(111);
end;
end.
Type in the system tab (window) of bot, the message of player, which is in zone and not your party member.
Function TL2Live.AbnormalID
Function IsUD(actor : TL2Live) : Boolean;
begin
Result := actor.AbnormalId and $8000000 = $8000000;
end;
//Target in UD?
begin
if isUD(User.target) then
print('Yes, in UD');
end.
Check if target has UD or no. Value $8000000 - it is one of bites of variable for AbnormalID, designative the
effect of UD.
Some other effects:
bleeding = $1;
poison = $2;
redcircle = $4;
ice = $8;
function TL2Control.GetSkillList
For current script, TL2Control is available by name Engine as well as list of skills available by variable SkillList.
From another TL2Control skill list can be received with the help of GetSkillList.
Function GetSkill(const Control : String; const ID : Cardinal) : TL2Skill;
var
NovObj : TL2Skill;
NovEngine : TL2Control;
begin
NovEngine := GetControl(control);
if Assigned(NovEngine) and NovEngine.GetSkillList.ByID(ID, NovObj) then
Result := NovObj;
end;
begin
if Assigned(GetSkill('MyBuffer',1255)) then
GetControl('MyBuffer').UseSkill(1255) //Recall
Else
Engine.UseItem(736); //
end.
If our buffer with nickname 'MyBuffer' has skill Party Recall, then we use it.
In other case, we use Scroll of Escape (SoE).
function TL2Control. GameWindow
What do we need this game window HWND for?
For example, you can use WinApi functions in the script.
function SetForegroundWindow(hwnd: integer) : Boolean; stdcall;
external 'user32.dll';
begin
While Engine.Delay(5000) then
if User.dead then
SetForegroundWindow(Engine.GameWindow);
end.
Scroll up game window, if character is dead.
procedure TL2Control.MSG(Who, What : String; Color : Integer);
If you want to paint system chat, you can use this method. The color can be
set by any values which are situated below:
clBlack = 0; //Black
clMaroon = 128; //Maroon
clGreen = 32768; //Green
clOlive = 32896; //Olive
clNavy = 8388608; //Navy
clPurple = 8388736; //Purple
clTeal = 8421376; //Teal
clGray = 8421504; //Gray
clSilver = 12632256; //Silver
clRed = 255; //Red
clLime = 65280; //Lime
clYellow = 65535; //Yellow
clBlue = 16711680; //Blue
clFuchsia = 16711935; Fuchsia
clAqua = 16776960; //Aqua
clWhite = 16777215; //White
TL2Live.Teleport...
Be familiar with information of any object, when teleported and how far including information about myself.
begin
While Engine.Delay(1000) do
if (GettickCount - User.TeleportTime < 5000) and (User.TeleportDist < 2000) and
(User.TeleportDist > 10) then
//Teleport was done 5 seconds ago
begin
print('Teleported!');
PlaySound(exepath + '\sounds\' + 'dc' + '.wav', False);
end;
end.
If teleported, play sound dc.wav from the bot folder (bot/sounds)