-
Notifications
You must be signed in to change notification settings - Fork 52
Home
- FFXIVMinion Forums - Get in touch with our Community!
- MMOMinion Live Chat
- Lua Reference Manual
- Quick Guide to Lua
- Lua Style Guide
- Another Tutorial
- GW2Minion Lua API
- Existing Lua Modules
The goal for the new Lua library is to avoid copy/paste duplication of code and create a modular system that can be used to build the complex behavior required for dungeons and other content from a collection of general behavior modules.
The core behavior module is the task found in ml_task.lua. A new task should be created by inheriting from ml_task for any logically separable behavior in a sequence. By creating many of the general tasks (and possibly paramaterizing them) it will become very simple to create new behavior or modify old behavior without writing lots of new code or getting involved with complicated state configurations etc.
There is also a new lua file, ffxiv_helpers.lua, which will contain global helper functions to be used in the behavior library. There is no need to rewrite the same 7 lines of code over and over again to, for example, find the closest mob to the player. What should be done instead is a new global function, "FindNearestEntity(type)", should be added to ffxiv_helpers.lua and called when this calculation is necessary.
How do I know when to add a new task or function?
- If the logic being added results in some player action, add a task!
- If the logic being added simply performs a calculation, add a global function!
The ml_task:Process() function will use a cause/effect list similarly to the GW2 state machine, but rather than changing states or adding new tasks to a separate task manager the new system will simply add the appropriate subtask based on the results of the cause functions in the list. For performing game state calculations in the cause functions, add a global function for any commonly repeated checks (ie nearest entity as discussed above); local functions should only be used for task specific calculations.