====== Functions ====== The following page covers the functions that are built into Ashita's Addons.dll plugin. ---- ==== Global Functions ==== //void// **AddIncomingPacket**(packet, id, size); * **Parameters** * packet - The packet data. (Table) * id - The id of the packet being sent. * size - The size of the packet data to send. * **Returns** * //Function does not return a value.// //void// **AddOutgoingPacket**(packet, id, size); * **Parameters** * packet - The packet data. (Table) * id - The id of the packet being sent. * size - The size of the packet data to send. * **Returns** * //Function does not return a value.// //string// **ParseAutoTranslate**(str, addBrackets); * **Parameters** * str - The string to parse auto-translate strings from. * addBrackets - Flag to determine if brackets should be readded to the parsed string. * **Returns** * The parsed string. //object// **GetEntity**(index); * **Parameters** * index - The index of the entity to obtain. * **Returns** * The entity at the given index. //object// **GetPlayerEntity**(); * **Parameters** * //Function has no arguments.// * **Returns** * The current players entity. ---- ==== Bitpack Functions ==== //number// bitpack:unpackBitsBE(packet, bitOffset, bitLength); * **Parameters** * packet - The data to unpack values from. * bitOffset - The bit offset to start unpacking at. * bitLength - The number of bits to unpack. * **Returns** * The unpacked value. //number// bitpack:unpackBitsBE(packet, byteOffset, bitOffset, bitLength); * **Parameters** * packet - The data to unpack values from. * byteOffset - The byte offset within the data to unpack. * bitOffset - The bit offset to start unpacking at. * bitLength - The number of bits to unpack. * **Returns** * The unpacked value. //number// bitpack:unpackBitsLE(packet, bitOffset, bitLength); * **Parameters** * packet - The data to unpack values from. * bitOffset - The bit offset to start unpacking at. * bitLength - The number of bits to unpack. * **Returns** * The unpacked value. //number// bitpack:unpackBitsLE(packet, byteOffset, bitOffset, bitLength); * **Parameters** * packet - The data to unpack values from. * byteOffset - The byte offset within the data to unpack. * bitOffset - The bit offset to start unpacking at. * bitLength - The number of bits to unpack. * **Returns** * The unpacked value. ---- ==== Configuration Functions ==== //boolean// **config:load_config**(className); * **Parameters** * className - The name of the class to load. (Usually the same as the file name.) * **Returns** * True on success, false otherwise. //boolean// **config:load_config**(className, file); * **Parameters** * className - The name of the class to load. * file - The file to load the configuration from. * **Returns** * True on success, false otherwise. //void// **config:remove_config**(className); * **Parameters** * className - The name of the class to unload. * **Returns** * //Function has no return.// //boolean// **config:save_config**(className); * **Parameters** * className - The name of the class to save. * **Returns** * True on success, false otherwise. //string// **config:get_string**(className, name); * **Parameters** * className - The name of the class. * name - The name of the value to read. * **Returns** * The string value. //boolean// **config:get_bool**(className, name, defaultValue); * **Parameters** * className - The name of the class. * name - The name of the value to read. * defaultValue - The default value to use if reading fails. * **Returns** * The value that was read. //number// **config:get_int**(className, name, defaultValue); * **Parameters** * className - The name of the class. * name - The name of the value to read. * defaultValue - The default value to use if reading fails. * **Returns** * The value that was read. //number// **config:get_float**(className, name, defaultValue); * **Parameters** * className - The name of the class. * name - The name of the value to read. * defaultValue - The default value to use if reading fails. * **Returns** * The value that was read. //number// **config:get_double**(className, name, defaultValue); * **Parameters** * className - The name of the class. * name - The name of the value to read. * defaultValue - The default value to use if reading fails. * **Returns** * The value that was read. ---- ==== File Functions ==== //number// **file:create_dir**(path); * **Parameters** * path - The full path to create the directory of. (Will automatically create any missing sub-directories.) * **Returns** * 0 on success, otherwise the error code. //boolean// **file:dir_exists**(path); * **Parameters** * path - The full path to check. * **Returns** * True if exists, false otherwise. //boolean// **file:file_exists**(path); * **Parameters** * path - The full path to the file to check. * **Returns** * True if exists, false otherwise. //table// **file:get_dir**(path); * **Parameters** * path - The full path to get the contents of. * **Returns** * A table containing the files within the given path. //table// **file:get_dirs**(path); * **Parameters** * path - The full path to get the directories of. * **Returns** * A table containing the folders within the given path. //string// **file:get_install_dir**(languageId, installId); * **Parameters** * languageId - The language id to use while looking up the install path. * installId - The install id to lookup. * **Returns** * The installation path if it exists, empty string otherwise. Valid languageId's are the following: * 0 = English (Default) * 1 = Japanese * 2 = English * 3 = European * 4 = European Valid installId's are the following: * Final Fantasy XI = 0 * Tetra Master = 1 * Final Fantasy XI Test Client = 2 * PlayOnline = 3 ---- ==== Memory Functions ==== //number// **mem:GetBaseAddress**(modname); * **Parameters** * modname - The name of the module to get the address of. * **Returns** * The base address of the module. //boolean// **mem:UnprotectMemory**(addr, size); * **Parameters** * addr - The address of the memory to unprotect. * size - The size of the data to unprotect. * **Returns** * True on success, false otherwise. //number// **mem:FindPattern**(modname, bytetable, size, mask); * **Parameters** * modname - The name of the module to scan within. * bytetable - The table of bytes to scan for. * size - The size of the byte table. * mask - The mask to scan against. * **Returns** * The address where the pattern was found, 0 otherwise. //number// **mem:ReadUChar**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadChar**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadUShort**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadShort**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadULong**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadLong**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadULonglong**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadLonglong**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadFloat**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //number// **mem:ReadDouble**(addr); * **Parameters** * addr - The address to read from. * **Returns** * The value read from the given address. //table// **mem:ReadArray**(addr, size); * **Parameters** * addr - The address to read from. * size - The number of bytes to read. * **Returns** * A table containing the read data. //string// **mem:ReadString**(addr, size); * **Parameters** * addr - The address to read from. * size - The number of bytes to read. * **Returns** * A string from the read data. //void// **mem:WriteUChar**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteChar**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteUShort**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteShort**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteULong**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteLong**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteULonglong**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteLonglong**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteFloat**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteDouble**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteArray**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// //void// **mem:WriteString**(addr, val); * **Parameters** * addr - The address to write to. * val - The value to write. * **Returns** * //Function does not return a value.// ---- ==== Misc. Functions ==== //void// **misc:open_url**(url); * **Parameters** * url - The website url to open. * **Returns** * //Function returns no value.// ---- ==== Sound Functions ==== //void// **sound:playsound**(file); * **Parameters** * file - sound The file to play. * **Returns** * //Function returns no value.//