Ashita v1.0.2.8 Released
Hello again everyone, another update to Ashita has been released.
This release includes the following:
Code: Select all
----------------------------------------------------------------------------------------------------
Ashita Version: 1.0.2.8
----------------------------------------------------------------------------------------------------
Fixed : [Core] Packet parsing methods not correctly handling some packets.
Fixed : [Core] Crash that could occur from a colored string from a Windower based application.
Added : [Extn] LuaCast: /luacast reload - Now able to fully reload LuaCast via command.
Added : [Extn] LuaCast: /luacast dostring "<lua text here>" - Able to parse chat log text as a Lua string.
Added : [Extn] LuaCast: recast, vanatime, weather helper files.
Added : [Extn] LuaCast: timer module for allowing timed events.
Fixed : [Core] Typos inside of the keymap file.
Fixed : [Core] Issue that prevented plugins from ever seeing a certain packet.
Added : [Core] IData::CommandType::ForceHandle - Causes commands passed to HandleCommand to be resent to extensions.
See previous change information in our release log here:
http://svn.ffevo.net/ashita/release/ChangeLog.txt
This update brought some bug fixes to the internal core of Ashita as well as some more LuaCast love.
LuaCast
The base folder structure of the LuaCast scripts has been adjusted, so with this update I recommend you delete your old folder and start fresh. The new layout is now as follows:
- \LuaCast\
- \LuaCast\extensions\
- math.lua
- string.lua
- table.lua
- timer.lua
- \LuaCast\ffxi\
- inventory.lua
- recast.lua
- vanatime.lua
- weather.lua
Commands
Two new commands have been added to LuaCast to allow for more things.
/luacast reload
- Allows users to fully reload the Lua state of LuaCast. (This will re-execute main.lua as if you just loaded the extension.) This is useful for developers working on scripts.
/luacast dostring "<script data here>"
- Allows users to execute a chunk of Lua code from the command line. This can be EXTREMELY powerful when used with macros as well as any fancy scripts you create. For example, you print hello world:
/luacast dostring "print( 'hello world' );"
Keep in mind with this function, you have to surround the function in quotes. You cannot use double quotes inside the script chunk you are executing either.
You can use this function to execute other Lua files as well using:
/luacast dostring "dofile( filename )"
This can process any valid Lua so use your imagination.
More Informational Helpers!
I have also coded a handful more helper Lua files.
timer.lua
Timers are based on how Garry's Mod implements Lua into his game. This allows for functions to be fired at a set interval for any amount of times you wish. You can also have a fire-once timer that is basically like a sleep allowing you to call a function in the future.
For example, we can setup a function to be called every 5 seconds, until we tell it to stop like this:
Code: Select all
timer.Create( 'myTimer', 5, 0, function()
print( 'Hello world!' );
end );
If you want to just have an event fire once, you can use the following instead:
Code: Select all
timer.Once( 5, function()
print( 'Hello world!' );
end );
The above would call the function once after 5 seconds has passed since we called the timer.Once command.
Please note:
Timers are fired during the rendering of the game. It is in your best interest to not do massively intensive operations in timers
recast.lua
As you can guess, recast.lua is a helper file that contains various functions to obtain recast data.
This is basically the entire Recast extension written in Lua.
Here is rundown of each of the functions this file has:
- Recast.GetAbilityRecastIds() - Returns a table of all current recast ability ids.
Recast.GetAbilityRecastIdFromIndex( index ) - Returns the recast ability id of the given index.
Recast.GetAbilityRecastByIndex( index ) - Returns the recast timer of the given ability index.
Recast.GetAbilityRecastById( id ) - Returns the ability recast timer for the given ability id.
Recast.GetSpellRecastByIndex( index ) - Returns the spell recast by the given spell index.
Recast.FormatTimestamp( timer ) - Formats a recast timer into a hh:mm:ss format.
These should be fairly straight forward to understand. Here's an example of a few of the functions:
Code: Select all
-- Print Two-Hour Recast Info
local Recast = require( "recast" );
local index = 0;
local timer = Recast.GetAbilityRecastByIndex( index );
local str = Recast.FormatTimestamp( timer );
print( string.format( 'Index: %d -- Recast: %d -- Timer String: %s', index, timer, str ) );
vanatime.lua
vanatime.lua is a helper file that contains functions for reading the Vanadiel time. This can be useful for getting the current time to check for day/night time, as well as checking moon phase etc.
Here is rundown of each of the functions this file has:
- VanaTime.GetRawTimestamp() - Returns the absolute raw timestamp from the game.
VanaTime.GetCurrentTimestamp() - Returns a formatted timestamp in the following format: hh:mm:ss
VanaTime.GetCurrentTime() - Returns a Time table object.
VanaTime.GetCurrentHour() - Returns the current in-game hour.
VanaTime.GetCurrentMinute() - Returns the current in-game minute.
VanaTime.GetCurrentSecond() - Returns the current in-game second.
VanaTime.GetCurrentDate() - Returns a Date table object.
GetCurrentTime() returns a Time table object. This table has the following properties:
- Hour - Current in-game hour.
Minutes - Current in-game minutes.
Seconds - Current in-game seconds.
GetCurrentDate() returns a Date table object. This table has the following properties:
- WeekDay - The current elemental day.
Day - Current Vanadiel day.
Month - Current Vanadiel month.
Year - Current Vanadiel year.
MoonPercent - Current moon percent.
MoonPhase - Current moon phase.
weather.lua
weather.lua is a simple helper that only exposes 1 function. To simply read the current in-game weather.
- Weather.GetCurrentWeather() - Returns the current weather type.
Information
Please note, inside each of these listed Lua files I mentioned you will find global data. Such as:
Code: Select all
WEATHER_CLEAR = 0;
WEATHER_SUNNY = 1;
WEATHER_CLOUDY = 2;
WEATHER_FOG = 3;
WEATHER_FIRE = 4;
These sets of data can be used anywhere as long as you have included the said Lua file. This should make your life a lot easier when comparing value and such.. For example:
Code: Select all
if (Weather.GetCurrentWeather() == WEATHER_ICE2) then
-- Send an equip command here..
end
Performance Warning!
Please also note the following:
- Each file found inside the 'ffxi' sub folder will more than likely do some sort of memory processing. Currently all the files listed here scan for patterns to locate their data. It is important that you only include these files once! Including them every time you need it will decrease your FPS and cause lag as the amount of unneeded rescanning for the data will occur.
Simply add the files to the top of your main.lua once and leave them there. Do everything else after them.