some mentoring (lua noob)
Hi, so im looking to make use of
GetPrimaryTalentTree(false,false) it will output 1 2 or 3. once i get the output from it i have something to use based off it. if cfg.playername == "Windblossom" and cfg.playerclass == "DRUID" and cfg.talentree == "3" then cfg.animhealth = 0 end cfg.talentree doesnt exist yet, its just a placeholder, where do i make GetPrimaryTalentTree(false,false) to run to give the cfg.talentree variable its output?. First off i just want it to load when you log in or enter world since thats what everything else does atm so that seems most doable. And later if i learn anything from this get it to recheck changed talent trees using another api thingy. this is from charspecific.lua from rothui. if you think i should read up on something specific please tell me. I have a very basic understanding atm. Thanks. |
Googled and found this @ http://www.wowinterface.com/forums/s...ad.php?t=38204
Quote:
Code:
local cfg.talenttree = GetPrimaryTalentTree() |
As to when you can utilise these functions the following page shows that both Player_Entering_World and Player_Alive events has access to the talents.
http://www.wowpedia.org/Events_that_...oading_Process |
thanks, after an hour of trying to figure out what im doing wrong, i found that the variable doesn't even get used at that time, which i thought i had checked before... sigh. Awell ill get there eventually =).
|
Quote:
edit: so charspecific.lua was commented out of the .toc thats why it didnt work :). |
Also, the return value of GetPrimaryTalentTree is a number, not a string, so that part of your check will fail:
Code:
if cfg.playername == "Windblossom" and cfg.playerclass == "DRUID" and cfg.talentree == "3" then |
yepp thanks that worked.
|
onload
--BLOOD
if cfg.playerclass == "DEATHKNIGHT" and GetPrimaryTalentTree(false,false) == 1 then cfg.animClassOverride = { ["DEATHKNIGHT"] = { enable = true, animhealth = 7, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true, }, } end --FROST 11 or 19 is good for health if cfg.playerclass == "DEATHKNIGHT" and GetPrimaryTalentTree(false,false) == 2 then cfg.animClassOverride = { ["DEATHKNIGHT"] = { enable = true, animhealth = 27, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true, }, } end --UNHOLY if cfg.playerclass == "DEATHKNIGHT" and GetPrimaryTalentTree(false,false) == 3 then cfg.animClassOverride = { ["DEATHKNIGHT"] = { enable = true, animhealth = 28, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = false, manadecreasealpha = true, }, } end --------------------------------------------------- So it works but i need to do an extra reload each time. When entering world, and after switching spec. on an off-topic matter, about ace3 profiles, im trying to tie various addons profiles to change with weakauras, the command is easy to issue in weakauras, i just take a random specspecific frame and add it in the actions tab onshow. But not all addons have specific profile switching commands, sofar i only have this one from ForteXorcist , FW:UseProfile(2); (tho that one isnt ace3, but the rest are). Some of them have the "dual spec" option, but that wont work for me since im making spec specific ties, 3 or more. I guess what im asking for is how do i change profiles via script on an ac3 addon that has profiles but doesnt have a /addon profile name, type switch. From what i read on acedb thingy, it should be some sort of short for the addon followed by :UseProfile("name?") or (number). tried other things likke :Profile(), SetProfile(), and others. no success. i know reflux can do this, but im heavily invested in weakauras already, so id rather have it there. on another random topic while im in the noob section ;), say i want to make slight modifications to some addon, like i donno scale, setpoints etc. Is it possible to add another lua or xml to like load after the original, if so what is possible and what isnt?. My learning process is slow :| feel free to rtfm me with directions ;P |
You can put the code that updates the talent information to run each time the events fire for entering world and talent changes: "PLAYER_ENTERING_WORLD" and "ACTIVE_TALENT_GROUP_CHANGED".
Note that the PLAYER_ENTERING_WORLD event will fire each time you get a loading screen, if you only need it to run once at login then you can use "PLAYER_LOGIN" instead but it's up to you, if the update function is so small it's not a performance impact at all I'd put it to run at entering world like suggested. ;) Just an example, haven't actually tried it: Code:
local class, primary, anim -- you can then use these anywhere in the file, think of them like "global variables" only for the file itself |
Quote:
thanks im gonna start tinkering!. |
local class, primary, anim, healthtexture, manatexture -- you can then use these anywhere in the file, think of them like "global variables" only for the file itself
local healthtexture = cfg.healthtexture local manatexture = cfg.manatexture local f = CreateFrame("Frame") f:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") f:RegisterEvent("PLAYER_ENTERING_WORLD") f:SetScript("OnEvent", function(f, event, ...) _, class = UnitClass("player") primary = GetPrimaryTalentTree(false, false) if class == "DEATHKNIGHT" then if primary == 1 then -- blood healthtexture = 15 manatexture = 15 anim = {enable = true, animhealth = 7, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true} elseif primary == 2 then --frost healthtexture = 16 manatexture = 14 anim = {enable = true, animhealth = 11, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 1, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true} else -- unholy healthtexture = 18 manatexture = 14 anim = {enable = true, animhealth = 2, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.4, manamultiplier = 0.8, healthdecreasealpha = true, manadecreasealpha = true} end end end) ----------------------- produces no errors, but also doesnt do anything, even after a reload. ---------------------------- also ---------- local class, primary, anim -- you can then use these anywhere in the file, think of them like "global variables" only for the file itself local f = CreateFrame("Frame") f:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") f:RegisterEvent("PLAYER_ENTERING_WORLD") f:SetScript("OnEvent", function(f, event, ...) _, class = UnitClass("player") primary = GetPrimaryTalentTree(false, false) if class == "DEATHKNIGHT" then if primary == 1 then -- blood anim = {enable = true, animhealth = 7, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true} elseif primary == 2 then --frost healthtexture = 16 manatexture = 14 anim = {enable = true, animhealth = 11, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 1, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true} else -- unholy anim = {enable = true, animhealth = 2, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.4, manamultiplier = 0.8, healthdecreasealpha = true, manadecreasealpha = true} end end end) -------------- produces no erros but doesnt do anything. -------------- could i not simply call whatever updates the orbs normally?. ------------------------ the more i look at it the more i get the feeling i have to go edit the original code in player.lua, but yeah donno. |
It was just an idea how you could do it, now, it does not do anything indeed, but what it does is it let's the rest of the addon code have access to for example "anim" that is a table with data, depending on the spec.
You can test this by adding at the end: function TEST() return anim end Then you can /dump TEST() and see the current table content that the addon uses, swap spec, try it again and see if it updated. :) The variables update each time you swap spec or see a loading screen, you need more code to do stuff from there and onward, now I haven't used rothui but no rothui user here to help us out what the next step is? :P I'd try find where the addon changes or uses this "anim" data then see if I can find a way to inject my own anim table into it, thus altering it. |
If the player has not selected any talents (new character under level 10, or during a respec) then GetPrimaryTalentTree() will return nil. Make sure you cater for this condition or you could get errors later on.
|
Quote:
|
Quote:
|
All times are GMT -6. The time now is 06:56 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI