Texts Library Beginner's Guide?

Language: JP EN DE FR
New Items
users online
Forum » Windower » Support » Texts Library Beginner's Guide?
Texts Library Beginner's Guide?
By NiroAL 2018-12-03 01:34:57
Link | Quote | Reply
Hi everyone. I'm looking to try and start using the texts library to make some status displays in FFXI. I want to be able to track what ailments and buffs my character has in a seperate window. I know that there are addons or plugins that might have this functionality, but I'm interested in learning to do it myself.

However, my main problem is, as a total beginner to programming, I have no idea where to start. I've tried looking at other addons that utilize the texts library and reverse engineering their functionality, but most of the time I just end up confused. I also can't find very much documentation or any tutorials on how to use the library.

Are there any resources that anyone knows of that can help me out? Any help getting me started with the texts library would be greatly appreciated. Thank you so much!
Server: Bahamut
Game: FFXI
user: Shozokui
Posts: 69
By Bahamut.Shozokui 2018-12-03 07:37:30
Link | Quote | Reply
The texts library is simple. The place where you're going to get hung up if you're a "total beginner" is going to be enumerating your buffs and determining which are buffs/debuffs. Spoiler alert, the game just considers everything a buff.

Creating a new text box and showing it
settings = config.load('data\\settings.xml',default_settings)
box = texts.new('${current_string}', settings.text_box_settings, settings)
box.current_string = ''

Setting text of a specific box
box.current_string = txt

Storing your text box configuration in an xml file in data/settings.xml
<?xml version="1.1" ?>

By NiroAL 2018-12-04 00:49:57
Link | Quote | Reply
Thank you so much! This will be a great jumping off point for me. If it's not too much trouble, could you run me through your code and explain your syntax to me? Or is there some documentation for the texts library I can read somewhere?

Either way, thanks so much!
Server: Bismarck
Game: FFXI
user: Xurion
Posts: 140
By Bismarck.Xurion 2018-12-04 05:24:40
Link | Quote | Reply
I recommend looking into the Windower Github wiki: https://github.com/Windower/Lua/wiki. There's a lot of documentation available there.

Here's a brief line-by-line explanation of an addon example that creates a text box and displays your inventory space.
--The name of your addon
_addon.name = 'Inventory Space'
--You (any format you want for this - this is just what I put)
_addon.author = 'Dean James (Xurion of Bismarck)'
--Current version of this addon. If you want to version "properly", look up semantic versioning
_addon.version = '1.0.0'

--This library generates text boxes
texts = require('texts')
--This library handles loading/saving configuration (the XML file in data/settings.xml)
config = require('config')

--These are the default settings we want
default_settings = {
  bg = {
    alpha = 75
  padding = 3
--The first time we execute config.load, the data/settings.xml file is auto generated with the default_settings
settings = config.load(default_settings)
--Here we create a text box using the texts library. We tell it to use the settings that have been fetched or auto generated
--The texts library will now add additional configuration to the XML file
text_box = texts.new(settings)

--This is an event we tell Windower to execute at a certain point. In this case, it is when the addon loads
--There are a number of events that can be set. Check out: https://github.com/Windower/Lua/wiki/Events
windower.register_event('load', function()
  --Use windower.ffxi.get_items().inventory to get info about your inventory
  local inventory = windower.ffxi.get_items().inventory
  --Use the inventory info to generate text that will be soming like "64/80"
  local new_text = inventory.count .. '/' .. inventory.max
  --Use the :text function to set the text
  --Use the :visible function to set the text box to visible

I'll assume you know how to put this into your addons directory etc. and load it. When you do, it'll appear at the very top left of the UI because we haven't set it to be any different (most text-based addons do this).

You can now drag the text box around, and as you do, the texts library automatically saves the new position in the settings.xml file.
By NiroAL 2018-12-04 06:28:14
Link | Quote | Reply
Thank you so much! This is perfect. I'm going to mess with it later on.

I really appreciate the help!
Server: Bismarck
Game: FFXI
user: Xurion
Posts: 140
By Bismarck.Xurion 2018-12-04 07:08:51
Link | Quote | Reply
No worries. Another thing I forgot to mention is the texts library (as well as others) can be found in addons\libs\texts.lua.

You can browse all the functions available there. Good luck!
Log in to post.