This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
lua_tutorial [2023/04/25 14:24] – [Getting Started] kali | lua_tutorial [2023/04/29 07:52] (current) – kali | ||
---|---|---|---|
Line 11: | Line 11: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
- | There are other options out there, most people tend to go with VSCode or Notepad++. I personally prefer IntelliJ but the most important thing is that you know how to use it comfortably because you don't want to have to end up learning how to write Lua on top of how to install and use the software. | + | There are other options out there, most people tend to go with VSCode or Notepad++. I personally prefer IntelliJ but the most important thing is that you know how to use it comfortably because you don't want to have to end up learning how to write Lua on top of how to install and use the software. This guide will assume you use VSCode and any references I make will refer to that software. |
Next are online resources, use these to look up standard Lua functions. Minion uses a modified version of Lua 5.1 with some standard functions removed/ | Next are online resources, use these to look up standard Lua functions. Minion uses a modified version of Lua 5.1 with some standard functions removed/ | ||
Line 18: | Line 18: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
{{ :: | {{ :: | ||
The console is one of your most important tools when developing, debugging, or even reporting an issue to other developers. At first glance it might seem like a bunch of nonsense, but everything in the console has been determined by that developer that it is important information and to output it into the console. The reason for this is if that information is not correct or not intended that we have a record of what Minion' | The console is one of your most important tools when developing, debugging, or even reporting an issue to other developers. At first glance it might seem like a bunch of nonsense, but everything in the console has been determined by that developer that it is important information and to output it into the console. The reason for this is if that information is not correct or not intended that we have a record of what Minion' | ||
- | Now with Minion' | + | Now with Minion' |
+ | |||
+ | {{: | ||
d(" | d(" | ||
- | {{ ::tutorial_hello_world.png?nolink |}} | + | ===== Dev Tools and Lua Source Files ===== |
+ | {{ ::tutorial_dev_tools.png? | ||
+ | |||
+ | To show this off target something like a minion or any NPC, then in Dev-Tools expand the Target tree and expand Core Data and Position Data. Lets go over what this information means. | ||
+ | |||
+ | {{: | ||
+ | * Ignore **Ptr**, this information is only used by developers reversing the game to update minion for new patches. | ||
+ | * **ID**, not to be confused with ContentID, is an identifier generated by the servers so the client knows what entity is what. Imagine if you had 5 Ifrit' | ||
+ | * **Name** is entity name, character name, etc. | ||
+ | * **Content ID** is an identifier given to each model. Where 5 Ifrit' | ||
+ | * **Type** is [[https:// | ||
+ | * **Status** is server status, it is mainly used only for the Player and in niche cases as well. It's good to know this information is here but you may never use it. | ||
+ | * **ChocoboState** is the Player' | ||
+ | * **CharType** is [[https:// | ||
+ | * **TargetID** is the ID of the target that entity is currently targeting, in this case a minion doesn' | ||
+ | * **OwnerID** is used for entities like your companion chocobo, egi's and pets, sadly not minions. | ||
+ | * **Claimed By ID** is pretty useful when you want to know who claimed an enemy, even if that player isn't the enemy' | ||
+ | * **Fate ID** only applies to FATE enemies, and will let you know what fate ID that entity is apart of. | ||
+ | * **Icon ID** is the icon above NPCs, like quest icons. | ||
+ | * **Position** is the position that entity is in the world, different from MeshPosition. | ||
+ | * **Radius** is the size of the ring when you target them. For example all Players have a radius of 0.5 yalms, while large bosses will have huge rings to accommodate for melee jobs doing mechanics while still being in attack range. | ||
+ | * **Distance** is the distance between you, and in this case, your target. This is exact distance between two points in a 3D space. | ||
+ | * **Distance2D** is the distance between two points in a 2D space, removing height from the equation and removing the Player' | ||
+ | * **PathDistance** is a calculated distance used by the Navigation Manager, aka the distance it would take to travel from your position to, in this case, your target' | ||
+ | * **LoS** and **LoS2**, aka Line of Sight, are used to calculate if the los between two positions is clear or blocked by something. Sometimes can be unreliable/ | ||
+ | * **OnMesh** is determined by the Navigation Manager if the entity is on the navigation mesh or not. | ||
+ | * **IsReachable** is determined by the Navigation Manager if the entity can be reached by the Player or not. | ||
+ | * **MeshPosition** is the position on the mesh, not the same as game position. | ||
+ | //*Deep Breath*//, now that was a lot of information wasn't it? And to imagine that's not even 1% of all the information Minion provides about the game. That might sound intimidating, | ||
+ | |||
+ | {{ :: | ||
+ | ..\MINIONAPP\Bots\FFXIVMinion64\LuaMods\Dev | ||
+ | The LuaMods folder contains every Lua script that runs with Minion including addons from the store. When you begin making your own modules, which is very soon, you'll maintain all your projects within LuaMods. Now open the Dev folder and open **dev.lua** in the text editor you chose to use. From this point forward I'm going to assume you are using VSCode, so I'll be referencing how to do things from there this point forward. | ||
+ | |||
+ | {{: | ||
+ | Now there is a lot of information that we aren't ready to talk about in this file, so press **CTRL+F** to search for **Core Data**, there will only be one entry in the file so it will take you right to it. | ||
+ | |||
+ | This is the same thing you interacted with before in Dev Tools, just the source of it. We're just going to borrow some information from this to help demonstrate how you can use this information in the future, but also it helps you get use to using these files to learn from them. In this image on line 2459 for **Name**, at the very end of the line you see '' | ||
+ | |||
+ | {{ :: | ||
+ | |||
+ | local c = Player: | ||
+ | Lets break this line down, **local c** is making **c** a local variable, which we'll talk about later, **c = Player: | ||
+ | |||
+ | We'll talk about all that and more later, but we just need to use **Player: | ||
+ | |||
+ | {{:: | ||
+ | In this example we have 5 Striking Dummies, you can target any entity for this but for this example I'll be targeting these. Target something and in your console, execute this: | ||
+ | |||
+ | {{ : | ||
+ | d(Player: | ||
+ | Now as you rotate between different targets execute it again to have it print the target' | ||
+ | |||
+ | {{ :: | ||
+ | |||
+ | local target = Player: | ||
+ | |||
+ | Now what did I do there? I simply utilized the information we learned with 3 variables and [[https:// | ||
+ | ===== Introducing Basic Lua Terms ===== | ||
+ | |||
+ | - explain what a variable is | ||
+ | - comments | ||
+ | - identifiers, | ||
+ | - the 21 reserved keywords | ||
+ | - whitespace and readability | ||
+ | - variable definition, lists, and declaration | ||
+ | - the 8 " | ||
+ | - nil, boolean, number, string, function, userdata, thread, and table | ||
+ | - the type function | ||
+ | - arithmetic operators | ||
+ | - relational operators | ||
+ | - logical operators | ||
+ | - miscellaneous operators | ||
+ | - operator precedence | ||
+ | - loops, break, and infinite loops | ||
+ | - if statements | ||
+ | - functions | ||
+ | - defining | ||
+ | - arguments | ||
+ | - calling | ||
+ | - assigning and passing | ||
+ | - variable arguments | ||
+ | - strings and string manipulation | ||
+ | - replacing a substring, find and match | ||
+ | - string formatting | ||
+ | - character and byte representation | ||
+ | - arrays and multi-dimensional arrays | ||
+ | - iterators | ||
+ | - tables and table manipulation | ||
+ | |||
+ | ===== Making our First Module ===== | ||
+ | |||
+ | ===== Common Functions and Standard Libraries ===== | ||
+ | |||
+ | ===== Error Handling and Debugging ===== | ||
+ | |||
+ | ===== Garbage Collection and Performance Impact ===== | ||
+ | |||
+ | ===== Object Oriented and Inheritance ===== |