|
Addon to Display Current Index of Gearswap Matrices in UI
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-02 00:44:15
For my DRK I use a physical accuracy array, magical accuracy array, nuke arrays, and drain/aspir potency array. I was wondering if anyone knew a way to display these in a text box within the UI? Perhaps using the text add-on or creating something that could point to the matrix values in my GS?
Code --**** Arrays for various toggles *****--
--***** 3 Levels Of Accuracy Sets For TP/WS/Hybrid/Stun. *****--
AccIndex = 3
AccArray = {"LowACC","MidACC","HighACC"} --
--***** 3 Levels of Magic Acc for Hard Monsters. *****--
MaccIndex = 3
MaccArray = {"LowMACC", "MidMACC", "HighMACC"}
--***** 3 Levels of Drain Acc<==>Potency *****--
DrainIndex = 1
DrainArray = {"DrainLowMACC", "DrainMidMACC", "DrainHighMACC"}
--***** Weapon Array *****--
WeaponIndex = 1
WeaponArray = {"Liberator", "Apocalypse", "Ragnarok"}
--***** Idle Array *****--
IdleIndex = 3
IdleArray = {"Movement","Regen","Refresh"} -- Default Idle Set Is Refresh --
--***** Nuke Indexes for Nuke Toggles *****--
T1NukeIndex = 5
T1NukeArray ={"Stone", "Water", "Aero", "Fire" , "Blizzard", "Thunder"}
T2NukeIndex = 5
T2NukeArray ={"Stone II", "Water II", "Aero II", "Fire II" , "Blizzard II", "Thunder II"}
T3NukeIndex = 5
T3NukeArray ={"Stone III", "Water III", "Aero III", "Fire III" , "Blizzard III", "Thunder III"}
--****** Rune Indexes for Runes /RUN *****--
RuneIndex = 8
RuneArray = {"Tellus","Unda","Flabra","Ignis","Gelus","Sulpor","Lux","Tenebrae"}
The idea would be to be able to change the position of the box, customize the displayed toggles, and perhaps even change the color of the displayed options. This way it would be wasy to know which level of acc/macc/nuke/whatever you have a toggle for is currently on without having to cycle and have something added to chat.
I guess in my primitive understanding, I simply need an on screen text display of the current indexes in my GS. I am at a loss as to how to pass these values to an exiting add-on or the text add-on. (If that is even the most prudent course of action.)
However, if there is an easier/existing way to do this. . . I'd like to do that.
Server: Sylph
Game: FFXI
Posts: 184
By Sylph.Subadai 2015-10-02 11:59:49
This can probably be done through lua but I don't know how; you'd probably get someone to answer over on BG. I do use the Text addon for static strings... if you can figure out how to get lua to return a string value you can just add it to the Text command. Here are the commands I know of (some from the readme, some I got from Text.lua):
text <name> create "Text 1 2 3 4"
text <name> pos 1500 100
text <name> size 20
text <name> color 255 255 0
text <name> bold true
text <name> append "Text 1 2 3 4"
text <name> appendline "Text 5 6 7 8"
text <name> text "Text 1 2 3 4"
text <name> hide
text <name> show
text <name> clear
text <name> delete
Where <name> is any name you make up. The trick here is to get lua to return your arrays in a form usable by Windower and replace "Text 1 2 3 4" with whatever that expression is. Alternatively, write a lua script and do it all from there with lua commands. You could even insert it into your DRK lua or call your script from there.
By Rooks 2015-10-02 12:16:40
It would be pretty specific to the lua file being used, since people can implement those in different ways.
Lakshmi.Byrth
VIP
Server: Lakshmi
Game: FFXI
Posts: 6293
By Lakshmi.Byrth 2015-10-02 16:08:58
The texts library is exposed to user files, which is how you should do it. On my phone now, so not much I can do
Cerberus.Conagh
Server: Cerberus
Game: FFXI
Posts: 3189
By Cerberus.Conagh 2015-10-02 16:26:06
Well I used this which utilized a HUD, it doesn't do what you're asking but it does put onscreen data, you would just need to change the way it checks the data:
Here's the example (It's a live Onscreen parse and pDIF calculator but meh)
Code function variables()
attacks = 0
hits = 0
trend = {}
trend_write_pos = 0
define_user_functions()
options = { usePDT = false, meleeMode = 'DD', autopilot = false,
HUD = { x = 100, y = 100, visible = true, trendSize = 40 }
}
build_HUD()
end
function define_user_functions()
function swing(hit)
trend_write_pos = trend_write_pos + 1
if trend_write_pos > options.HUD.trendSize then
trend_write_pos = 1
end
if hit then
hits = hits + 1
attacks = attacks + 1
trend[trend_write_pos] = 1
else
attacks = attacks + 1
trend[trend_write_pos] = 0
end
local overall = math.floor(hits / attacks * 100 - .1)
local recent = math.floor(table.sum(trend) / #trend * 100 - .1)
windower.text.set_text(rtAcc, tostring(overall))
windower.text.set_text(rtTrend, tostring(recent))
if recent >= 92 then
windower.text.set_color(rtTrend, 255, 2, 255, 2)
elseif recent < 92 then
if recent < 79 then
windower.text.set_color(rtTrend, 255, 255, 2, 60)
else
windower.text.set_color(rtTrend, 255, 200, 100, 2)
end
end
end
windower.register_event('action',function (act)
if act.actor_id == windower.ffxi.get_player().id then
if act.category == 1 then
for i=1,act.targets[1].action_count do
if act.targets[1].actions[i].message == 1 or act.targets[1].actions[i].message == 67 then
swing(true)
else
swing(false)
end
end
end
end
end)
end
function build_HUD()
hudBord = 'blu_hud_border'
windower.prim.create(hudBord)
windower.prim.set_color(hudBord, 255, 2, 2, 2)
windower.prim.set_position(hudBord, options.HUD.x - 9, options.HUD.y-2)
windower.prim.set_size(hudBord, 140, 70)
windower.prim.set_visibility(hudBord, options.HUD.visible)
hudBG = 'blu_hud_background'
windower.prim.create(hudBG)
windower.prim.set_color(hudBG, 100, 40, 40, 100)
windower.prim.set_position(hudBG, options.HUD.x - 7, options.HUD.y)
windower.prim.set_size(hudBG, 135, 65)
windower.prim.set_visibility(hudBG, options.HUD.visible)
rtAcc = 'blu_realtime_accuracy_display'
windower.text.create(rtAcc)
windower.text.set_location(rtAcc, options.HUD.x, options.HUD.y)
windower.text.set_bg_color(rtAcc, 0, 0, 0, 0)
windower.text.set_color(rtAcc, 255, 255, 255, 255)
windower.text.set_font(rtAcc, 'Arial')
windower.text.set_font_size(rtAcc, 18)
windower.text.set_bold(rtAcc, false)
windower.text.set_italic(rtAcc, false)
windower.text.set_text(rtAcc, '--')
windower.text.set_bg_visibility(rtAcc, options.HUD.visible)
windower.text.set_visibility(rtAcc, options.HUD.visible)
rtTrend = 'blu_realtime_accuracy_trend_display'
windower.text.create(rtTrend)
windower.text.set_location(rtTrend, options.HUD.x + 40, options.HUD.y + 2)
windower.text.set_bg_color(rtTrend, 0, 0, 0, 0)
windower.text.set_color(rtTrend, 255, 255, 255, 255)
windower.text.set_font(rtTrend, 'Arial')
windower.text.set_font_size(rtTrend, 24)
windower.text.set_bold(rtTrend, false)
windower.text.set_italic(rtTrend, false)
windower.text.set_text(rtTrend, '--')
windower.text.set_bg_visibility(rtTrend, options.HUD.visible)
windower.text.set_visibility(rtTrend, options.HUD.visible)
gMode = 'blu_gear_mode_display'
windower.text.create(gMode)
windower.text.set_location(gMode, options.HUD.x + 40, options.HUD.y + 40)
windower.text.set_bg_color(gMode, 0, 0, 0, 0)
windower.text.set_color(gMode, 255, 255, 0, 0)
windower.text.set_font(gMode, 'Arial')
windower.text.set_font_size(gMode, 11)
windower.text.set_bold(gMode, true)
windower.text.set_italic(gMode, false)
windower.text.set_text(gMode, 'Recent')
windower.text.set_bg_visibility(gMode, options.HUD.visible)
windower.text.set_visibility(gMode, options.HUD.visible)
abText = 'blu_ability_availability_display'
windower.text.create(abText)
windower.text.set_location(abText, options.HUD.x-1, options.HUD.y - 12)
windower.text.set_bg_color(abText, 0, 0, 0, 0)
windower.text.set_color(abText, 255, 200, 180, 0)
windower.text.set_font(abText, 'Lucida Console')
windower.text.set_font_size(abText, 8)
windower.text.set_bold(abText, true)
windower.text.set_italic(abText, false)
windower.text.set_text(abText, '')
windower.text.set_bg_visibility(abText, options.HUD.visible)
windower.text.set_visibility(abText, options.HUD.visible)
end
function file_unload()
windower.prim.delete(hudBord or "")
windower.prim.delete(hudBG or "")
windower.text.delete(gMode or "")
windower.text.delete(rtTrend or "")
windower.text.delete(rtAcc or "")
windower.text.delete(abText or "")
end
pDIF = 0
total_damage = 0
total_damage_array = L{}
max_count = 15
max_acc_count = 10
total_crit = 0
windower.register_event('action',function (act)
local actor = act.actor_id
local category = act.category
local player = windower.ffxi.get_player()
if actor == player.id and category == 1 then
local round_hits = act.targets[1].action_count
for i = 1,round_hits do
if act.targets[1].actions[i].reaction == 8 then
if act.targets[1].actions[i].message ~= 67 then
total_damage_array:append(act.targets[1].actions[i].param)
end
end
end
approximate_pdif()
end
end)
function approximate_pdif()
local total_damage = 0
local total_hits = math.min(max_count,total_damage_array:length())
if total_damage_array:length() < 1 then
return
end
for i=1,total_hits do
local v = total_damage_array:last(i)
total_damage = total_damage+v
end
pDIF = ( (total_damage/total_hits) / (D + fSTR) )
end
It shows the code to create a HUD on your screen, although as said the referenced data is more based on lua catching your attacks and averaging them ~ to do this via onscreen displays for i.e What set am I in you would change the display to something like, the main file had this inside it ~
Code include('Cona-Include.lua')
-- Include local Variables --
-- Variables for pDIF you set these in your user file --
D = 132
fSTR = 30.25 -- An Approximated value from an iLVL 130 NM ~ Tojil --
-- Variables for the Accuracy Parser HUD --
attacks = 0
hits = 0
trend = {}
trend_write_pos = 0
define_user_functions()
options = { usePDT = false, meleeMode = 'DD', autopilot = false,
HUD = { x = 900, y = 100, visible = true, trendSize = 40 }
}
build_HUD()
This was more set up to Auto Amend sets based on Accuracy / Attack etc and damage being dealt. It wasn't finished so I can't remember if it said if you were in USE pdt / DD stance or Autopilot on screen as I don't play anymore can't check, but feel free to try and use this (I'm sure someone could scrap one together from this)
Edit: For clarity the link for my Gearswaps and how they're laid out in case I missed something can be found here
[+]
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-04 01:24:11
I'm having trouble reverse engineering the above, is there actually a possibility of such an add-on being developed?
Server: Asura
Game: FFXI
Posts: 363
By Asura.Vafruvant 2015-10-04 01:34:34
I'm having trouble reverse engineering the above, is there actually a possibility of such an add-on being developed? I doubt it would be an and-on and rather a GS-specific script. I spent about an hour last night before bed trying to figure it out, but I was too tired to debug it fully. I have a day off Monday so I plan to attempt to fine-tune it then.
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-04 02:09:57
Sweet.
By Aeyela 2015-10-04 02:12:15
After playing with Conagh's example, that's definitely what Urteil is looking for. Kudos.
[+]
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-04 04:22:31
I will get this to work.
Server: Asura
Game: FFXI
Posts: 363
By Asura.Vafruvant 2015-10-05 00:13:17
initialize(window, smn_info.box, 'window') This line throws an error, btw. Probably missed a segment in the paste here.
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-11 07:08:16
I still can't get this working. Did anyone else?
Server: Shiva
Game: FFXI
Posts: 29
By Shiva.Nitroustaru 2015-10-21 00:58:55
I just did something like this for my pld yesterday. It wasn't as in depth as you are asking for though. I can show you what i did i guess though. Put it in code tags below, took out basically everything except what's prudent to what you're asking. It basically just keeps track of what Armor set i have equipped (whether it be reraise, pdt, mdt, or dt-) my phalanx amount and which shield i have it equip. hope this helps somewhat
Code
include('organizer-lib')
text = require('texts')
remote = false
smdt = false
spdt = false
sshield = false
reraise = false
shybrid = false
shield = "Ochain"
armor = "Normal"
phalanx = 0
str = 'Shield: ${shield|Ochain}, Armor: ${armor|Normal}, Phalanx: ${phalanx|Off}'
display = text.new()
display:text(str)
display:font("Consolas")
display:size(10)
display:pos(400,880)
display:show()
function buff_change(status,gain)
if gain and (status == "Sleep" or status == "Terror" or status == "Stun") then
windower.send_command('@wait .1; gs c check')
end
if status == "Phalanx" then
if gain then
display.phalanx = 28 + math.floor((player.skills.enhancing_magic - 300.5)/28.5) + 4 + 3 + 4
--Weard Mantle 4, Yorium Cuirass 3, Souveran Handschuhs 4
else
display.phalanx = "Off"
end
end
end
function self_command(command)
---removed a lot of unimportant stuff here
if command == "shieldswap" then
if shield == "Ochain" then
equip({sub="Aegis"})
shield = "Aegis"
display.shield = "Aegis"
else
equip({sub="Ochain"})
shield = "Ochain"
display.shield = "Ochain"
end
add_to_chat(207,'Shield: '..shield)
elseif T{'pdt','mdt','reraise','hybrid'}:contains(command) then
if command == 'pdt' then
if spdt == false then
sets.aftercast_TP = sets.pdt
sets.aftercast_Idle = sets.pdt
spdt = true
smdt = false
sshield = false
shybrid = false
reraise = false
add_to_chat(207, 'Armor: PDT')
display.armor = "PDT"
else
sets.aftercast_TP = sets.TP_Normal
sets.aftercast_Idle = sets.Idle
spdt = false
add_to_chat(207, 'Armor: Normal')
display.armor = "Normal"
end
elseif command == 'mdt' then
if smdt == false then
sets.aftercast_TP = sets.mdt
sets.aftercast_Idle = sets.mdt
smdt = true
spdt = false
sshield = false
shybrid = false
reraise = false
add_to_chat(207, 'Armor: MDT')
display.armor = "MDT"
else
sets.aftercast_TP = sets.TP_Normal
sets.aftercast_Idle = sets.Idle
smdt = false
add_to_chat(207, 'Armor: Normal')
display.armor = "Normal"
end
elseif command == 'reraise' then
if reraise == false then
reraise = true
smdt = false
spdt = false
sshield = false
hybrid = false
sets.aftercast_TP = set_combine(sets.hybrid,sets.Reraise)
sets.aftercast_Idle = set_combine(sets.hybrid,sets.Reraise)
add_to_chat(207,"Armor: Reraise")
display.armor = "Reraise"
else
reraise = false
sets.aftercast_TP = sets.TP_Normal
sets.aftercast_Idle = sets.Idle
add_to_chat(207,"Armor: Normal")
display.armor = "Normal"
end
elseif command == 'hybrid' then
if shybrid == false then
sets.aftercast_TP = sets.hybrid
sets.aftercast_Idle = sets.hybrid
smdt = false
spdt = false
shybrid = true
reraise = false
add_to_chat(207, 'Armor: Hybrid')
display.armor = "DT-"
else
sets.aftercast_TP = sets.TP_Normal
sets.aftercast_Idle = sets.Idle
shybrid = false
add_to_chat(207, 'Armor: Normal')
display.armor = "Normal"
end
end
if player.status == "Engaged" then
equip(sets.aftercast_TP)
else
equip(sets.aftercast_Idle,sets.Movement)
end
end
end
I do a lot of stuff here that isn't really needed. But feel free to ask me here if you need help trying to figure this out... it basically puts a text box above my chat log that says Code Shield: Ochain, Armor: Normal, Phalanx: Off
until i change something via my macros. i.e. call shieldswap command and it'll change it to Aegis, or equip my dt- set and it'll change armor to say "DT-"
I do that via the variables you see in this line:
Code str = 'Shield: ${shield|Ochain}, Armor: ${armor|Normal}, Phalanx: ${phalanx|Off}'
As you can see ${shield|Ochain} written there makes a variable in the display text object called shield. Which i can change to what i want by changing the display.shield variable, but is defaulted to say "Ochain".
[+]
Phoenix.Urteil
Server: Phoenix
Game: FFXI
By Phoenix.Urteil 2015-10-24 04:30:38
I got the onscreen display to work. How do I pass the indexes from the matrices into it?
Server: Shiva
Game: FFXI
Posts: 29
By Shiva.Nitroustaru 2015-10-24 18:31:41
i would need to see your code to see how you did it to tell you that.
If you did it like mine then, from my example above
Index: $(variable|default)
You would do something like display.variable = index
Otherwise, to assist you further i will need to see how you set it up.
Also, i assume you use commands to change your variables. So you would need to just add, using your variable names from above: Code
if command = "change acc index command" then
if AccIndex = 3 then
AccIndex = 1
else
AccIndex = AccIndex + 1
end
display.AccIndex = AccIndex
end
For my DRK I use a physical accuracy array, magical accuracy array, nuke arrays, and drain/aspir potency array. I was wondering if anyone knew a way to display these in a text box within the UI? Perhaps using the text add-on or creating something that could point to the matrix values in my GS?
Code --**** Arrays for various toggles *****--
--***** 3 Levels Of Accuracy Sets For TP/WS/Hybrid/Stun. *****--
AccIndex = 3
AccArray = {"LowACC","MidACC","HighACC"} --
--***** 3 Levels of Magic Acc for Hard Monsters. *****--
MaccIndex = 3
MaccArray = {"LowMACC", "MidMACC", "HighMACC"}
--***** 3 Levels of Drain Acc<==>Potency *****--
DrainIndex = 1
DrainArray = {"DrainLowMACC", "DrainMidMACC", "DrainHighMACC"}
--***** Weapon Array *****--
WeaponIndex = 1
WeaponArray = {"Liberator", "Apocalypse", "Ragnarok"}
--***** Idle Array *****--
IdleIndex = 3
IdleArray = {"Movement","Regen","Refresh"} -- Default Idle Set Is Refresh --
--***** Nuke Indexes for Nuke Toggles *****--
T1NukeIndex = 5
T1NukeArray ={"Stone", "Water", "Aero", "Fire" , "Blizzard", "Thunder"}
T2NukeIndex = 5
T2NukeArray ={"Stone II", "Water II", "Aero II", "Fire II" , "Blizzard II", "Thunder II"}
T3NukeIndex = 5
T3NukeArray ={"Stone III", "Water III", "Aero III", "Fire III" , "Blizzard III", "Thunder III"}
--****** Rune Indexes for Runes /RUN *****--
RuneIndex = 8
RuneArray = {"Tellus","Unda","Flabra","Ignis","Gelus","Sulpor","Lux","Tenebrae"}
The idea would be to be able to change the position of the box, customize the displayed toggles, and perhaps even change the color of the displayed options. This way it would be wasy to know which level of acc/macc/nuke/whatever you have a toggle for is currently on without having to cycle and have something added to chat.
I guess in my primitive understanding, I simply need an on screen text display of the current indexes in my GS. I am at a loss as to how to pass these values to an exiting add-on or the text add-on. (If that is even the most prudent course of action.)
However, if there is an easier/existing way to do this. . . I'd like to do that.
|
|