Skip to content
Nifim edited this page Oct 29, 2024 · 6 revisions

This page lists Windower-specific functions available through Lua. All of them are restricted to the windower table and will be accessed through it. The following is a listing for all available functions directly inside the windower table. For further nested packets, see one of these pages:

  • FFXI - FFXI-related functions
  • Text - Functions that create and modify text objects
  • Prim - Functions that create and modify image primitives
  • Packets - Functions that inject packets
  • Regex - Regex related functions
  • Console - Functions regarding the Windower console
  • Chat - Functions regarding the FFXI chat input

An honorable mention go to print, which is exposed globally. It's the same as Lua's internal print, but it will output to the Windower console.

Furthermore, two functions are added to the coroutine table:

coroutine.close(co)

  • co thread - Coroutine to be closed

This will close the provided coroutine co, preventing it from executing again. This is needed to terminate coroutine loops and is the only way to close them from outside the coroutine. A closed coroutine can not be resumed again.

coroutine.schedule(fn, time)

  • fn function - Function to be scheduled
  • time number - Time in seconds when fn is supposed to be run

Executes fn delayed by time seconds. Returns the scheduled coroutine.

coroutine.sleep(time)

  • time number - Time in seconds

Sleeps the current evaluation for the given period of time.


windower

This table contains all Windower-specific functions.

windower.add_to_chat(mode, msg)

  • mode integer - Chatmode to use.
  • msg string - Message to write. This function outputs to the chatlog. The chatmode argument roughly corresponds to color; take a look at the spellcast color test XML to see what these values look like.

windower.create_dir(path)

  • path string - The path to the folder Creates the final directory in the path. Will throw an error (return false and an error message) if one of the middle directories does not exist.

windower.convert_auto_trans(str)

  • str string - Input string optionally containing auto-translated blocks

Removes all auto-translate formatting, if present, from the input string.

windower.copy_to_clipboard(str)

  • str string - String to copy

Copies the provided string to the clipboard for use outside of FFXI (or to paste into the chatlog/console).

windower.debug(...)

  • ... any - Any number/type of arguments to be printed

Prints all its arguments to the debug lock, prepended by the thread ID and addon name.

windower.dir_exists(path)

  • path string - The path to the folder

Checks if the path is a valid directory address. Returns true or false.

windower.execute(file, arguments)

  • file string - The path to the file
  • arguments table - List of arguments to pass

Executes a file on the system. Activity remains on the current window.

windower.file_exists(path)

  • path string - The path to the file

Checks if the path is a valid file address. Returns true or false.

windower.format_variables(str)

  • str string - Input string optionally containing %-variables Takes a string and replaces all occurrences of %-variables (%area, %target, etc.).

windower.from_shift_jis(str)

  • str string - The string to convert

Converts a Shift_JIS (FFXI flavor) string to a UTF-8 string used by addons and Windower in general (including the provided resources). This will rarely need to be used, as text read from the chatlog is already translated to UTF-8 before being passed to the incoming and outgoing text events.

windower.get_dir(path)

  • path string - The path to the directory

Returns a table containing all files and directories within one directory.

windower.get_from_clipboard()

Returns a string containing the contents of the clipboard, if applicable, otherwise returns nil.

windower.get_chat_filters()

Returns the currently set ingame chat filters.

windower.get_windower_settings()

Returns a table of the user's Windower settings. The structure is as follows:

{  
    x_res: int  
    y_res: int  
    ui_x_res: int  
    ui_y_res: int  
    launcher_version: number  
    window_x_pos: int  
    window_y_pos: int  
}

windower.open_url(url)

  • url string - URL to open. This function opens a URL in the default browser. Similar to chatmon, it suffers the same limitation of some incompatibility, particularly with Firefox.

windower.play_sound(path)

  • path string - The path to the file Plays a sound at the specified file path. Currently, .wav is the only accepted format.

windower.register_event(name1, name2, [...], fn)

  • name*x* string - Event name
  • fn function - Function to execute whenever the event is triggered Registers a function to execute whenever an event triggers. If multiple names are provided, one function will be assigned to all those events.

Returns the IDs of registered functions, which can be used to unregister them again (see below).

windower.send_command(str)

  • str string - Command to send. This function is used to send a command to Windower. This command is treated as if it were entered into the windower console, so no // prefix is necessary.

windower.send_ipc_message(msg) =====

  • msg string - Message to send. This function sends an IPC message to all other Windower instances that have the same addon loaded. This message is handled by the ipc message event.

windower.set_mob_name(id, name)

  • id integer - ID of the mob
  • name string - New name to set for the mob This function changes the name of a mob to the string you specify. Can cause crashes. Beware.

windower.to_shift_jis(str)

  • str string - The string to convert

Converts a UTF-8 string (default assumed for all addon files) to a Shift_JIS (FFXI flavor) string used by FFXI. This should be used every time non-ASCII characters are supposed to be output to the chatlog.

windower.unregister_event(id1, id2, [...])

  • id*x* integer - ID of the event to unregister Stops a function from being executed by an event. The ID of the function is returned on registering the it with windower.register_event.

windower.wc_match(str, pattern)

  • str string - Input string to match
  • pattern string - Pattern to match against

Returns true if str matches pattern. Allowed tokens:

  • ? matches any one character
  • * matches arbitrary many characters
  • | alternation, matches either the left of it or the right of it

windower.has_focus()

Returns true if instance has focus, false if it does not.

windower.take_focus()

Takes the focus from any application, if instance already has focus does nothing.

Variables

This table also contains the following variables:

windower_path string

  • Path to the current Windower installation (includes final slash)

addon_path string

  • Path to the currently loaded addon directory (includes final slash)

pol_path string

  • Path to playonline and ffxi install directory (includes final slash)
Clone this wiki locally