Thread Tools Display Modes
12/06/15, 04:33 AM   #1
Zerowalker
Join Date: Nov 2015
Posts: 20
Get Ability/Skill name from "EVENT_SKILL_RANK_UPDATE"?

Hi,

I am wondering if it's possible to retrieve the actual skill/ability name from the event which is fired when it levels up.

I think you can manually get it by outputing the info when you level up and write it down etc,
but i am assuming there must be some logic behind it.

The event gives 2 numbers that coordinate this, the "type" and "index".
EVENT_SKILL_RANK_UPDATE, function(eventCode, skillType, skillIndex, rank)

From my current assumption, on a Termplar at least, i think it's something like this for some skills.

//Copy pasting my code as i am lazy to rewrite, but should be clear enough.
//EDITED later on when i figured out how the Type/Indexing worked, probably*
Code:
if skillType == 1 and skillIndex == 1 then
type = "Aedric Spear"
elseif skillType == 1 and skillIndex == 2 then
type = "Dawn's Wrath"
elseif skillType == 1 and skillIndex == 3 then
type = "Restoration Light"
elseif skillType == 2 and skillIndex == 1 then
type = "Two Handed"
elseif skillType == 2 and skillIndex == 2 then
type = "One Hand and Shield"
elseif skillType == 2 and skillIndex == 3 then
type = "Dual Wield"
elseif skillType == 2 and skillIndex == 4 then
type = "Bow"
elseif skillType == 2 and skillIndex == 5 then
type = "Destruction Staff"
elseif skillType == 2 and skillIndex == 6 then
type = "Restoration Staff"
elseif skillType == 3 and skillIndex == 1 then
type = "Light Armor"
elseif skillType == 3 and skillIndex == 2 then
type = "Medium Armor"
elseif skillType == 3 and skillIndex == 3 then
type = "Heavy Armor"
elseif skillType == 4 and skillIndex == 1 then
type = "Legerdemain"
elseif skillType == 4 and skillIndex == 2 then
type = "Soul Magic"
end
This is just from me outputting the text when i level up and then assuming it stays that way.
Meaning, if i level up in restoration staff it would output "skillType 2 and skillIndex 6",
that way i can assume that those two number combined is Restoration Staff.

If there is a way to actually know this without doing it that way it would be nice though,
as it's kinda a pain;p

*EDIT:

After looking into it, it seems quite logical.

Type is the "Category", so Class is 1, Weapons is 2, Armor is 3.
Index is, well index in that Category.

I looked up the variables, and "SKILL_TYPE_ARMOR" has the value of 3, which is correct.
Now, if only one could reverse it, so knowing the numbers could retrieve the name of the skill.
Most of the skills i am sure remain constant, but Classes don't for example.

Last edited by Zerowalker : 12/06/15 at 05:17 AM.
  Reply With Quote
12/06/15, 02:51 PM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
This gives you the name:
Lua Code:
  1. local function SkillRankUpdate(eventCode, skillType, skillIndex, rank)
  2.     local skillName = GetSkillLineInfo(skillType, skillIndex)
  3. end
  4. EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_SKILL_RANK_UPDATE, SkillRankUpdate)
  Reply With Quote
12/06/15, 02:57 PM   #3
Zerowalker
Join Date: Nov 2015
Posts: 20
Are you kidding me, was it so simple, was looking for such a function but thought that it surely couldn't exist -_-!

Thanks


Also, got other questions, should i ask them here or create new threads?

One is if there is an event when skillpoint and skyshards are earned, can't find that.
Other is if there is a way to get the Center_Announcement text, all in the current queue i guess.
  Reply With Quote
12/08/15, 03:58 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Zerowalker View Post
Are you kidding me, was it so simple, was looking for such a function but thought that it surely couldn't exist -_-!

Thanks


Also, got other questions, should i ask them here or create new threads?

One is if there is an event when skillpoint and skyshards are earned, can't find that.
Other is if there is a way to get the Center_Announcement text, all in the current queue i guess.
Skill Points:
Lua Code:
  1. EVENT_SKILL_POINTS_CHANGED (integer eventCode, integer pointsBefore, integer pointsNow, integer partialPointsBefore, integer partialPointsNow)

SkyShards:
Same answer, EVENT_SKILL_POINTS_CHANGED
Lua Code:
  1. local function OnSkillPointsChanged(eventCode, pointsBefore, pointsNow, partialPointsBefore, partialPointsNow)
  2.     -- We don't need this here, but in case you need it somewhere else
  3.     -- local numSkyShards = GetNumSkyShards()
  4.     d(partialPointsNow)
  5. end
  6.  
  7. EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_SKILL_POINTS_CHANGED, OnSkillPointsChanged)


Center Screen Announcements:



This grabs the queued event to be displayed for the center screen announcements after all checks have been made, right before it gets displayed. This means some messages could be blocked (but they are supposed to be), like when your at the crafting station or duplicate messages that get sent to often to quickly.

Argument Indices:
Warning: Spoiler


Warning: Spoiler


Or if you want to grab all messages that are added, regardless of if they are blocked or not and handle the checks yourself you could do something like this:
Warning: Spoiler

Last edited by circonian : 12/08/15 at 04:31 PM.
  Reply With Quote
12/08/15, 08:10 PM   #5
Zerowalker
Join Date: Nov 2015
Posts: 20
Wow, and i have been looking all over the place, especially on the Center Announcement,
got into it a bit but had no idea how to grab anything.

Really grateful

Will have to play around with this.

I am assuming the Skyshard thing is supposed to work by checkning amount of them before and after,
and if it has increased you assume that you just gained your 3rd Skyshard?
  Reply With Quote
12/09/15, 07:37 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by Zerowalker View Post
I am assuming the Skyshard thing is supposed to work by checkning amount of them before and after,
and if it has increased you assume that you just gained your 3rd Skyshard?
If you want to know when you gain a skyshard, then yes just compare them. However, increasing does not mean you gained your "3rd" skyshard and it doesn't always increase when you gain a skyshard because the value is mod 3. Meaning you only ever have 0, 1, or 2 skyshards. If you have 0 skyshards and you gain one, the new value will be 1 (increased by 1). If you have 1 skyshard and gain one, the new value will be 2 (increased by 1). But if you have 2 skyshards and gain one, the new value will be 0 (decreased by 2).

Since you can't lose skyshards if the partial value changes then you gained one. You don't need to check if it increased. If you only want to know when you gained your "3rd" skyshard then see if the partial value changed and if the new value is 0:
Lua Code:
  1. if partialPointsBefore ~= partialPointsNow then
  2.    -- you gained a skyshard
  3.  
  4.    -- If you only want to know when you gained
  5.    -- your "3rd" skyshard then:
  6.    if partialPointsNow == 0 then
  7.       -- You gained your "3rd" skyshard
  8.    end
  9. end
  Reply With Quote
12/10/15, 12:48 AM   #7
Zerowalker
Join Date: Nov 2015
Posts: 20
Ah, easy enough, didn't think of that you could use the "partialPointsNow==0" as check for the skill point.

That's quite clever, thanks!
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Get Ability/Skill name from "EVENT_SKILL_RANK_UPDATE"?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off