Torax
04-20-2010, 04:41 AM
Note: Addons will be available in the next patch.
Addons are written in the LUA programming language. Language reference can be found at http://www.lua.org/manual/5.1/. View the included dps.lua for an example script.
All addons are placed in the main/addons directory. Addons are a constant work in progress, developers please post requests for additional events and functions.
Reloading scripts while in-game:
Enter /reloadlua into the chat
COP Events:
onLoaded()
Called automatically when your character first spawns
onChatMessage(channel, text, senderName)
Channels
zone = 0;
group = 1;
raid = 2;
guild = 3;
say = 4;
emote = 5;
whisper = 6;
toWhisper = 7;
lootMessage = 8;
status = 9;
officers = 10;
system = 11;
combat = 12;
error = 13;
guildSystem = 14;
world = 15;
combatStatus = 16;
trade = 17;
onEnterCombat()
onExitCombat()
onKilled()
WhoListEntry(playerName, level, zone, guildName, isAFK)
onExpChange(currentExp, requiredExp)
onDamageTaken(damageDone, playerName, againstName, hitType, damageType)
onDamageDone(damageDone, againstName, playerName, hitType, damageType)
onHealingTaken(damageDone, playerName, againstName, hitType, damageType)
onHealingDone(damageDone, againstName, playerName, hitType, damageType)
Hit Types
miss = 0;
dodge = 1;
parry = 2;
block = 3;
resist = 4;
absorb = 5;
immune = 6;
dot = 20;
hit = 21;
crit = 22;
shared = 23;
neutral = 24;
damageType is the name of the damage/spell (swing, initiate heal, fireball, etc)
onExpGained(exp)
onInteractionStarted(time, barText, currentDuration)
barText is the caption displayed on the casting bar
time is the total time of interaction / cast
currentDuration is how much time has already elapsed
onEffectAdded(effectName, secondsRemaining)
onTargetSelected(targetname)
onTargetDeselected()
onGroupInvite(fromName)
onGroupJoin()
onGroupLeave()
LUA functions:
status("status text")
chatSay("message to send to say channel")
chatGuild("message to send to guild channel")
chatGroup("message to send to group channel")
chatWorld("message to send to world channel")
chatTrade("message to send to trade channel")
sendChatText("text")
Sends text to the current channel.
Example:
sendChatText("Hello") -- Sends "Hello" to the current channel
sendChatText("/dance") -- Starts dancing
cast("spell name")
Example:
cast("Blessing from Above")
addChatCommand("chat command")
Registers a chat command. When the chat command is used by the player, a function called chatcmd_[function] is called.
Example:
addChatCommand("testcommand")
function chatcmd_testcommand(args)
now doing /testcommand in game will execute the chatcmd_testcommand function. Any text added after the command will be passed as the first argument to the function.
playerInfo("type")
Returns information about the current player. Valid types:
name
level
isGrouped - returns "1" or "0" if the player is grouped
currentHealth
maxHealth
setTarget("target name")
Leave target name blank ("") to target self
checkSelfEffect("effect name")
checkTargetEffect("effect name")
Returns "1" if the effect exists on target, "0" if not
schedule("function", time in ms, args ...)
Example:
Cast Aegis after 1.5 seconds: schedule("cast", 1500, "aegis")
targetName() -- Returns the name of the current target
User Interface
GUI files should be placed inside the main/addons/ui folder.
Refer to the documents at http://docs.torquepowered.com/tge/official/index.html?content/documentation/Artists/GUI/Overview.html for help on creating a GUI.
You can download the free T3D demo at http://www.torquepowered.com/products/download/385 which has a built in GUI editor.
showDialog("dialog name")
hideDialog("dialog name")
Shows/hides a UI dialog. Dialog name is specified as the name of the first control inside the .gui file you want to show.
Example:
Inside your GUI file:
new GuiControl(MyAddonGui) {
Can be displayed by:
showDialog("MyAddonGui")
Common UIs:
GuiCTF - Capture the flag GUI
CharacterGui - Character stats/equipment GUI
GuildGui - Guild GUI
spellBookWindow - Spell Book GUI
setUiProperty("control", "field", "value")
Sets a field on a UI control to the specified value.
Example:
setUiProperty("myGuiButton", "text", "Click Me!")
will set the text field of button called myGuiButton to "Click Me!"
Calling LUA script functions from your GUI:
lua_event("FunctionName", args ...);
Example:
Button command: lua_event("DoSomething", "100", "player");
LUA: function DoSomething(myarg1, myarg2)
Addons are written in the LUA programming language. Language reference can be found at http://www.lua.org/manual/5.1/. View the included dps.lua for an example script.
All addons are placed in the main/addons directory. Addons are a constant work in progress, developers please post requests for additional events and functions.
Reloading scripts while in-game:
Enter /reloadlua into the chat
COP Events:
onLoaded()
Called automatically when your character first spawns
onChatMessage(channel, text, senderName)
Channels
zone = 0;
group = 1;
raid = 2;
guild = 3;
say = 4;
emote = 5;
whisper = 6;
toWhisper = 7;
lootMessage = 8;
status = 9;
officers = 10;
system = 11;
combat = 12;
error = 13;
guildSystem = 14;
world = 15;
combatStatus = 16;
trade = 17;
onEnterCombat()
onExitCombat()
onKilled()
WhoListEntry(playerName, level, zone, guildName, isAFK)
onExpChange(currentExp, requiredExp)
onDamageTaken(damageDone, playerName, againstName, hitType, damageType)
onDamageDone(damageDone, againstName, playerName, hitType, damageType)
onHealingTaken(damageDone, playerName, againstName, hitType, damageType)
onHealingDone(damageDone, againstName, playerName, hitType, damageType)
Hit Types
miss = 0;
dodge = 1;
parry = 2;
block = 3;
resist = 4;
absorb = 5;
immune = 6;
dot = 20;
hit = 21;
crit = 22;
shared = 23;
neutral = 24;
damageType is the name of the damage/spell (swing, initiate heal, fireball, etc)
onExpGained(exp)
onInteractionStarted(time, barText, currentDuration)
barText is the caption displayed on the casting bar
time is the total time of interaction / cast
currentDuration is how much time has already elapsed
onEffectAdded(effectName, secondsRemaining)
onTargetSelected(targetname)
onTargetDeselected()
onGroupInvite(fromName)
onGroupJoin()
onGroupLeave()
LUA functions:
status("status text")
chatSay("message to send to say channel")
chatGuild("message to send to guild channel")
chatGroup("message to send to group channel")
chatWorld("message to send to world channel")
chatTrade("message to send to trade channel")
sendChatText("text")
Sends text to the current channel.
Example:
sendChatText("Hello") -- Sends "Hello" to the current channel
sendChatText("/dance") -- Starts dancing
cast("spell name")
Example:
cast("Blessing from Above")
addChatCommand("chat command")
Registers a chat command. When the chat command is used by the player, a function called chatcmd_[function] is called.
Example:
addChatCommand("testcommand")
function chatcmd_testcommand(args)
now doing /testcommand in game will execute the chatcmd_testcommand function. Any text added after the command will be passed as the first argument to the function.
playerInfo("type")
Returns information about the current player. Valid types:
name
level
isGrouped - returns "1" or "0" if the player is grouped
currentHealth
maxHealth
setTarget("target name")
Leave target name blank ("") to target self
checkSelfEffect("effect name")
checkTargetEffect("effect name")
Returns "1" if the effect exists on target, "0" if not
schedule("function", time in ms, args ...)
Example:
Cast Aegis after 1.5 seconds: schedule("cast", 1500, "aegis")
targetName() -- Returns the name of the current target
User Interface
GUI files should be placed inside the main/addons/ui folder.
Refer to the documents at http://docs.torquepowered.com/tge/official/index.html?content/documentation/Artists/GUI/Overview.html for help on creating a GUI.
You can download the free T3D demo at http://www.torquepowered.com/products/download/385 which has a built in GUI editor.
showDialog("dialog name")
hideDialog("dialog name")
Shows/hides a UI dialog. Dialog name is specified as the name of the first control inside the .gui file you want to show.
Example:
Inside your GUI file:
new GuiControl(MyAddonGui) {
Can be displayed by:
showDialog("MyAddonGui")
Common UIs:
GuiCTF - Capture the flag GUI
CharacterGui - Character stats/equipment GUI
GuildGui - Guild GUI
spellBookWindow - Spell Book GUI
setUiProperty("control", "field", "value")
Sets a field on a UI control to the specified value.
Example:
setUiProperty("myGuiButton", "text", "Click Me!")
will set the text field of button called myGuiButton to "Click Me!"
Calling LUA script functions from your GUI:
lua_event("FunctionName", args ...);
Example:
Button command: lua_event("DoSomething", "100", "player");
LUA: function DoSomething(myarg1, myarg2)