You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Friday, March 16th 2012, 4:31pm

Researching for Action Bar Saver

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!

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.

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?

--

Documentation aside, someone out there might know an immediate way around the next hurdle in the project. All I need is ooooone little function, but I don't know if it exists...

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(). While I could match up filenames with a table of skills, it's not really an elegant way to do it; there is at least one icon out there used by two different skills, meaning I'd have to ask the game what class the character currently is to know which skill the icon is referencing. While that in itself isn't too much of a problem, my primary worry is the possibility of icon filenames changing in the future or even more skills sharing the same icon.

Ideally, there would be a function built in the ROM API that would allow me to look at a hotbar slot and say 'what is the name of the skill in this slot?' and it would directly return 'Slash' or whatever.

Having scoured the internet looking for a way to do this, I've come up with nothing. 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

So, to recap, here are the three questions this all boils down to:

A) Is there better documentation out there than the above function list?
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?

Any help is greatly appreciated. Thanks, all!

- Jen

Posts: 262

Location: The Ocean?

  • Send private message

2

Friday, March 16th 2012, 4:34pm

Hello Jenataur,

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.

As for the better documentations, I honestly ... have not found a better source then the romwikia.

-TunaShake

Edit: If you are willing jenataur, what you can do instead of making an add-on for different combinations is to make 6 different combos using DIYCE 2.0 and you will only need 2 - 4 buttons.

RoMage

rustyx is lame rogue

Posts: 2,694

Location: web

Occupation: DB Admin

Mood: Unsure

  • Send private message

3

Friday, March 16th 2012, 4:35pm

Disable in game bars and install add-on. It will recognize every class combination separately, thus give you option to save different configuration. Main bar you can keep for common staff if you want.

4

Friday, March 16th 2012, 5:14pm

Ooh, I didn't expect replies in the addon forum so fast! Thanks! :D

Quoted from "TunaShake"

... have not found a better source then the romwikia.


I haz a sad. :(

Quoted from "TunaShake"

... make 6 different combos using DIYCE 2.0 and you will only need 2 - 4 buttons.


That's an interesting idea! Ideally I'm wanting to make a small standalone mod that does one thing and one thing only, but it's looking like what I want to do may not be possible.

Quoted from "RoMage"

Disable in game bars and install add-on.


I tried that; there was some weirdness with the addon I tried (ExtraActionBars) where it wasn't saving configurations properly and there was some pretty heinous video lag when it tried to display cooldown timers. I may try other addons of the same type though.

5

Friday, March 16th 2012, 9:56pm

Edit: Ah nvm OP tried EAB
Ameri.Amare
Druid.70/Warrior.67/Scout.67
Govinda/Ragequit <3

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

6

Saturday, March 17th 2012, 12:07am

Quoted from "TunaShake;517418"

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.

Quoted from "jenataur;517415"

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.

Quoted from "jenataur;517415"

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).

Quoted from "jenataur;517415"

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.


Quoted from "jenataur;517415"

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).
2013... The year from hell....

7

Saturday, March 17th 2012, 12:45am

Thanks for all this info, Peryl! I hadn't thought about putting in the ability to attach a description to a configuration - if I do manage to make a releasable product, I'll credit you for that idea. ;)

I'm especially grateful for the bit about being careful to not accidentally delete an item. I didn't even think about the possibility of it doing that. o_O I didn't really think a script could trash an item, I guess, but now that I think about it - yeah.

I think I need to play around with the functions some more, too, although it's hard to know where to start when tinkering with under-documented stuff. If I could get the page/index from it, though, that would be beyond perfect.

The advice is much appreciated. Looks like I'm gonna have to get my hands a little dirtier than I expected, but that's half the fun...

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

8

Saturday, March 17th 2012, 1:10am

Weeell.... Now that I think about it, there is probably a much easier way to do this.

Since the goal of this thing is to create action bar configurations and set them, there really is no specific reason (apart from convenience) to just create a configuration screen where you set the actions/skills/items you want on a fake bar(s) and save that.

This way all required information is set exactly how you want/need it and all you then need to do is have code to set the real action bars from this data.

The disadvantage to this is that first time users will have to redo all their current bars in your config or you could end up overwriting their action bars.

The advantage is that you could do the configs on a per-bar basis, allowing mix and matching bars they want per bar set (just a thought really ;) )

Edit
Going hog-wild with this idea, you could actually roll your own action bars. Then the entire problem just goes away and sulks in a corner with the real action bars :D
2013... The year from hell....

Shadowkuna

Trainee

Posts: 123

Location: Varanass

Occupation: Performer

Mood: Love

  • Send private message

9

Saturday, March 17th 2012, 1:10am

Plz plz plz post when you release this amazing product :d ty!!!
Reni:
Kallic Mage/Druid/Rogue 57/38/27 Phoenix (RETIRED)

Artemis:
Genicarus Priest/Warrior 15/15 Orion
:dash:
Me when I wonder why the hell I decided to play a BattleMonk

~Just returning after a long time away~

10

Tuesday, March 27th 2012, 9:13am

http://bit.ly/GWpGoH - this is code for saving and restoring skills at actionbar. With small changes it can be pasted at any addon.