Skip to content
Stjepan Bakrac edited this page Nov 3, 2024 · 11 revisions

This page describes the process of registering an event to execute, as well as provide a full list of all available events.

An event is in this case simply an in-game event. This can range from logging in, to an incoming tell, to losing or gaining HP during battle. There are various events all of which can be reacted to.

All events are registered with windower.register_event(name, fn), where name is the event to register and fn is the function to execute.

Examples

function print_values(new, old)
    print(new, old)
end

windower.register_event('status change', print_values)

This can usually be simplified by just dropping the function into the definition:

windower.register_event('status change', function(new, old)
    print(new, old)
end)

Sometimes (such as in this case) this can be further shortened to the following:

windower.register_event('status change', print)

This will have the same effect since print takes an arbitrary number of arguments, so it will simply print out all arguments the event provides.


Event list

The following is a list of all available events, as well as the arguments they provide. Some of them will take return values to modify their content.

Name Arguments Return Description
action See details None ⚠️ Deprecated! Use incoming chunk with ID 0x028.
General Action Event
action message See details None ⚠️ Deprecated! Use incoming chunk with ID 0x029.
General Action Message Event
load None None Triggers on addon load.
unload None None Triggers on addon unload.
login string name None Triggers on login.
logout string name None Triggers on logout.
gain focus None None Triggers on receiving focus.
lose focus None None Triggers on losing focus.
gain buff number buff_id None Triggers on receiving a buff or debuff.
lose buff number buff_id None Triggers on losing a buff or debuff.
gain experience number amount
number chain_number
bool limit
None Triggers on gaining any experience. limit is true, if the EXP gained were limit points.
lose experience number amount None Triggers on losing any experience.
level up number level None Triggers on gaining a level.
level down number level None Triggers on losing a level.
job change number main_job_id
number main_job_level
number sub_job_id
number sub_job_level
None Triggers on job change. This will trigger on both main and sub job change.
target change number index None Triggers on target change.
weather change number weather_id None Triggers on weather change.
status change number new_status_id
number old_status_id
None Triggers on player status change. This only triggers for the following statuses:
Idle, Engaged, Resting, Dead, Zoning
hp change number new_hp
number old_hp
None Triggers on HP change.
mp change number new_mp
number old_mp
None Triggers on MP change.
tp change number new_tp
number old_tp
None Triggers on TP change.
hpp change number new_hpp
number old_hpp
None Triggers on HP% change.
mpp change number new_mpp
number old_mpp
None Triggers on MP% change.
hpmax change number new_hp_max
number old_hp_max
None Triggers on maximum HP change.
mpmax change number new_mp_max
number old_mp_max
None Triggers on maximum MP change.
chat message string message
string sender
number mode
bool gm
None Triggers on any chat message. This only includes FFXI chat messages and will therefor not work with Windower-based chat events, like FFOChat.
emote number emote_id
number sender_id
number target_id
bool motion
None Triggers on any player doing an emote. motion is true if it's only motioned without text.
party invite string sender
number sender_id
None Triggers on receiving a party or alliance invite.
examined string name
number sender_index
None Triggers on being examined. name is the name of the person to examine you.
time change number new
number old
None Triggers on time change. This only triggers when the displayed in-game time actually changes. Both arguments are the number of minutes since the beginning of the in-game day.
day change number new_day
number old_day
None Triggers on day change.
moon change string new_moon
string old_moon
None Triggers on moon type change. This means Full Moon, Waning Gibbous, etc.
linkshell change string new_ls
string old_ls
None Triggers on changing linkshells.
zone change number new_id
number old_id
None Fires whenever the player is zoning. This includes logging in and logging out.
add item number bag
number index
number id
number count
None Triggers whenever an item enters a bag (through trade, dropping from the treasure pool, NPC reward, moving it from another bag, etc.).
remove item number bag
number index
number id
number count
None Triggers whenever an item leaves a bag (through trade, dropping it, usage, etc.).
incoming text string original
string modified
number original_mode
number modified_mode
bool blocked
string
number
bool
incoming chunk number id
string original
string modified
bool injected
bool blocked
string
bool
outgoing text string original
string modified
bool blocked
string
bool
outgoing chunk number id
string original
string modified
bool injected
bool blocked
string
bool
mouse number type
number x
number y
number delta
number blocked
bool Triggers on any mouse action, including movement. Optionally returns a bool indicating whether or not the mouse action has been caught. If true, it will not be passed on to the next stage, so the mouse action would never reach the game.
keyboard number dik
bool pressed
number flags
bool blocked
bool Triggers on any keyboard action, including release of a button. Optionally returns a bool indicating whether or not the keyboard action has been caught. If true, it will not be passed on to the next stage, so the keyboard action would never reach the game.
ipc message string message None Triggers on an incoming IPC message.
addon command string* ... None Triggers on passing an addon command, which is any command of the form lua c <name>, where name is the addon name. (Everything after the command is passed to the function, not the command itself.)
unhandled command string* ... None Triggers on Windower commands that weren't processed by any other plugin. (The entire line is passed to the function, including the command.)
pipe message string* message None Triggers upon receiving a message from the named pipe reader \\.\pipe\luaReader.
prerender None None Triggers before every rendering tick.
postrender None None Triggers after every rendering tick.