The only person who would be experienced enough to answer your questions concerning an action bar add-on would be Peryl.
He maintains the PAB add-on.
Thanks, though I haven't really been "maintaining" it much any more, just marked it as a release version and left it in its current state.
Anyhoo, lets see if I can help out here.
I've been poking around trying to figure out how to make an addon that would save the contents of the standard actionbars and allow you to switch configurations easily. I want to make this because I like playing sort of random combinations of my six classes depending on my mood, so I need six different configurations instead of the two (maybe three?) they give you!
Not a bad idea for an add-on actually. Even with DIYCE stuff, this could allow several sets of bar configs. For example, grinding dailies, raiding, PvP, questing, etc. Maybe allow user to attach a name and a description to each config. That kind of thing.
Though I have a basic familiarity with several programming languages, this is my first foray into any sort of Lua project, so any random advice you might feel like giving is invaluable.
Lua is really easy to pick up if you've got programming skills already. There are a couple of oddities though if you are familiar with Python, then you've got a leg up on those too. Conversely, if you don't know Python, then Lua can give you a leg up on learning Python

. Some of the concepts are similar in both languages though Python is the more complicated one (and complete).
The biggest hurdle in my way right now is the apparent lack of complete documentation on ROM's API. I've scoured the list at
http://www.theromwiki.com/List_of_Functions but it seems woefully out of date (it says the version the list was taken from was 3.0.0.2149). The explanations given for functions that do have a page associated with them are lacking as well. I've attempted to find better documentation elsewhere but haven't found anything solid.
Therefore, I ask the modding veterans: Is there better documentation on the ROM functions out there, or have you all been working your magic with just that page?
A) Is there better documentation out there than the above function list?
Yeah, the docs are a little scarce, but it's what we got. I have added some info, but it isn't exactly an exciting thing to do.
Anyway as to figuring out more API stuff, and at the risk of being frowned at by the Frogster folk, you'll need an FDB extractor (I used Terestria's) and will want to extract the files in
interface.fdb (put the extracted data somewhere outside the game folder so as not to interfere with it). This way, you can do a Find in Files on all the .lua and .xml files for example usage of functions, or just to find how some of the interface is actually implemented.
We aren't supposed to provide a link to the extractor so I won't give you one.
*cough* *cough* *RoMWiki* *cough*
Finally, don't neglect looking through the widget methods.
In order to save a hotbar configuration, I have to know what skills are on the hotbar. Items and macros too, but I'll deal with those after I've dealt with the skills, as they're the important part. I had a bit of trouble with the fact that skills in the skillbook are only referenced in lua by position on the pages, not names, but I've thought of a way around that - IF the function I need exists.
Problem is, it seems like you can't just ask a hotbar slot what it has in it by name. The closest I've been able to come to getting unique identification from a slot is getting the filename of the icon associated with the skill using GetActionInfo().
...snip...
I even thought of trying to get the skill name by using PickupAction, trying to maybe get a separate bit of data from the skill now on the cursor, and then put the action back down in the slot. Unfortunately, there are only two functions I know of that let you get data about the cursor item - GetCursorItemInfo() and CursorItemType(). The former only does anything useful for bag items (tells you what position the item is in the bag) and the latter doesn't have anything to do with actual names.
I know this has been a bit of a long post, but I wanted to make sure I gave adequate info to let you all know where I'm coming from and where I'm heading so that you don't have to try to do much guesswork. I've seen too many threads out there where the post is just a single 'how do i make a mod' sort of line and no one knows where to start with the guy. I don't want to be that guy. XD
B) Is there a way to directly get a skill name from an action bar slot?
C) Is there a way to directly get a skill name from an item attached to the cursor?
There is no direct way that I know of (Note that it's been an awfully long time since I played around with those functions, so there might be a thing or two I'm forgetting).
The PickupAction trick is useful for getting some of the needed info (as in what's in this bar button anyway), but you need to be
extremely careful with it or you may end up trashing an item by accident (in the case where there was already something on the cursor). The safe way to ensure that the cursor itself is empty is by calling
ItemClipboard_Clear(). This should empty the cursor without deleting any item being held in it.
Anyway, check to ensure that there aren't more than one return value for GetCursorItemInfo. In the case of a skill, this could return the page and index for the skill in question. I just can't quite remember and the RoMWiki descriptions aren't always complete. Keep playing around with those functions and get creative.
Another avenue to investigate is to set a custom tooltip for the action button in question, then parse through the text description of this tooltip. You'll need to test where it puts the desired information and how to extract it from the generated strings, but here's some old code I had hanging around that might get you started in the right direction (it was for a cooldown bar add-on that I was planning).
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--[[
This was done elsewhere in the code, just wanted to show where
the table comes from
--]]
-- create a reverse lookup table for item categories
PerylCooldowns.Categories = {};
for j = 0, 28 do
PerylCooldowns.Categories[TEXT(string.format('SYS_ITEMTYPE_%[i][/i]02d",j))] = j;
end
--[[
This chunk of code parses through the tooltip text to extract
a category name. It eventually gives an index for a category
name, but that was what I actually ended up wanting.
--]]
-- Clear the first 10 lines or so of the hyperlink tooltip
-- so we know where to end early if needed.
for i = 1, 10 do
TooltipHLText[i]:SetText("**");
end
-- Set a gametooltip to this link, so it sets the text, then make sure it is hidden
GameTooltipHyperLink:SetHyperLink(link);
GameTooltipHyperLink:Hide();
-- Scan through the tooltip text to find the item category name
for i = 1, 10 do -- just look at the first 10 lines (max)
local text = TooltipHLText[i]:GetText();
if(text == "**") then
category = 0;
break;
end
-- Do a reverse lookup on the string to see if it is a category.
local checkcat = PerylCooldowns.Categories[text];
if(checkcat) then
category = checkcat;
break;
end
end
|
Edit:
Forgot to mention where I get the "link" variable from. Basically, I had a bag slot ID which I turned into an bag inventory index via
GetBagItemInfo and then turned
that into a hyperlink via
GetBagItemLink (The complete function does some other funky stuff, but that wasn't relevant to what you wanted).