You are not logged in.

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


/!\ We have moved to a new board. Come join us. This board is now in "archive" (read-only mode). /!\

Dear visitor, welcome to Runes of Magic US / AU. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, May 9th 2015, 3:39pm

RoM Resources

Does anyone have any good links/books websites for learning the RoM specific Lua interfaces?
By good I don't mean RomWiki I am not looking for just a list of functions. Functions lists are not very useful without context examples.

While I am looking at addons examples, once again without some knowledge base of RoM's interface its mostly just gobbly guke.
That and the fact I am C++ << hardcore here. Having some wtf are you mad issues just accepting some of the Lua idioms here but working on it.
Any useful links or beginning samples would be helpful.
At the moment I cant even access a simple chat frame to make everyones favorite beginning program printf("hello world"");

2

Saturday, May 9th 2015, 4:23pm

Actually, I think the RomWiki pages are the most up-to-date ones and also the ones with the most effort to provide any major context information at all :/ If you're through the tutorials there you really shouldn't have that much of a problem with "hello world" like addons xD

Other that that, you might want to take a look at other addons or even the default interface files of RoM. But be aware! Quirky behavior awaits in every corner ;)

If you have specific questions, you can ask me directly ^^

PS: hello world should be

Source code

1
print("hello world")
- just might not work if executed too early (before the chat frames are created)
Mithrandir - Warden/Warrior/Scout/Druid 95/95/95/87 (Dochas) - yes, I'm german :P
Creator of RaidHeal (Curse)

3

Saturday, May 9th 2015, 4:35pm

Looking at the examples I have seen this is what I get for a hello world

local Flecia = {}
_G.Flecia = Flecia

SLASH_Flecia = "/fle"
SlashCmdList["Flecia"] = function(editBox, msg)
DEFAULT_CHAT_FRAME:AddMessage("Hello World")
end


but it doesn't work so I don't know if DEFAULT_CHAT_FRAME is a rom interface or programmed locally in a library by the example. Nor do I know for sure that the code above is doing anything. Its just from mimicking other samples I have seen. The whole SLASH thing I assume is a RoM specific functionality. Bare with me also I am a nub with Lua.

4

Saturday, May 9th 2015, 5:02pm

Source code

1
2
3
4
5
6
7
local Flecia = {}
_G.Flecia = Flecia

SLASH_Flecia1 = "/fle"
SlashCmdList["Flecia"] = function(editBox, msg)
    DEFAULT_CHAT_FRAME:AddMessage("Hello World")
end

Now it should work. Yes, everything below line 3 is mostly depending on the RoM Lua API ^^

You notice the "1" after "SLASH_Flecia" in line 4? The game requires that the name of the slash command identifiers have the form "SLASH_(addonspecific name)(number starting from 1)" in order to support multiple slash commands for the same function. (If you want to know more about this, extract the file "interface/worldxml/chatframe.lua" from interface.fdb - in there is the whole source for slash command parsing among some other stuff)
Mithrandir - Warden/Warrior/Scout/Druid 95/95/95/87 (Dochas) - yes, I'm german :P
Creator of RaidHeal (Curse)

5

Saturday, May 9th 2015, 5:50pm

It is stupid things like that why I need a good rom API reference place. Is there a entry point function for your add on code for example? No winmain or dllmain equivalent? Lua is programming insanity just saying. It is no wonder rom is such a memory hog when it's add on modules allocate tables without any real deallocation procedure. Bath set to nil and we will get around to it when we feel like it :dash:

6

Saturday, May 9th 2015, 6:07pm

Well, generally lua files are loaded in the order specified in the .toc files, and those are loaded alphabetically (well, kinda, depth first search including subfolders).

For the .lua files themselves, line 1 is the entry point, normally executed when the file gets loaded (like a giant function ^^)

For the memory hog aspect, try

Source code

1
print(collectgarbage("count"))
This prints the currently memory usage of the whole Lua environment in kilobytes (so your addon + base interface + other addons). I have some addons installed and the value doesn't go above 50 MB (compared to up to 2 GB memory used by RoM!). Yes there are some factors why this isn't the real memory usage of the addons themselves (textures and stuff like that are excluded!), but considering the vast amount of strings loaded im kinda surprised its this low...
Mithrandir - Warden/Warrior/Scout/Druid 95/95/95/87 (Dochas) - yes, I'm german :P
Creator of RaidHeal (Curse)

7

Saturday, May 9th 2015, 8:20pm

Do me a favor and program a basic GUI button add on that when pressed will force call all lua and rom garbage collection methods. Make it my tutorial. Document for a c plus programmer. Add dialog box with details of memory usage before and after. I am also a html nub so any GUI stuff within a simple add on like this will help. Like how you access button onevent methods etc. If you want to add me as codesiner my programmer call sign will be DwR. Thanks

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

8

Sunday, May 10th 2015, 12:00am

Since you know C++, picking up Lua will be a breeze. There's a few gotchas here and there, but still pretty easy to wrap your mind around. C++ is way more complicated.

Here are my recommended reading for starting into the world of RoM addon creation:

Programming in Lua - First Edition
This is the free, online version of the book by one of the creators of Lua. This version of the book is for Lua 5.0 (while RoM uses 5.1), but most of what is explained here still applies. Good starting point to figure out Lua.

Lua Reference Manual
This is the Lua reference. Pick the 5.1 stuff. It's a little terse, being a reference manual and all, but everything about the Lua is in here.

The Runes of Magic Wiki
This is the base resource for getting into RoM Addon creation. See the lower-right box for all your RoM info. I've personally added quite a bit to this section of the wiki.

RoMWiki's Guide to XML Frames
Though accessible from above link, since I wrote this specific guide on the RoMWiki (and it's sister guide, Guide to Dynamic Frames), I obviously recommend reading it as your intro to addon creation.

Finally, if you have questions, I'd be happy to help out.
2013... The year from hell....

9

Sunday, May 10th 2015, 2:49am

I have already read that first edition website (first read always takes a few read to get everything).
I bought the books second edition just waiting for them to arrive. I prefer to learn programming language stuff (concepts) reading from a book nowhere near the computer. But reading the inet pages gives me a head start anyway.

Lua is not going to be any issue to learn/grasp as a base language. Some of the stuff it does makes me scratch my head a little bit .... but it is what it is and I can get around that. There are just some thing about the language that opens the door for shotty programming among other things.

The problem is just learning RoM specific apis and forcing myself to do it.
Reminds me of when I first had to learn Access programming or worse yet the win32ApI. ICK!
Even though I know HTML is not a hard thing whenever I see an ugly HTML file I cant bring myself to read the thing.
Once ya get past the headache where you can really start to be creative with your own thoughts / programming concepts is where the fun starts .... getting there is the hurdle.

10

Monday, May 11th 2015, 2:25pm

Do me a favor and program a basic GUI button add on that when pressed will force call all lua and rom garbage collection methods. Make it my tutorial. Document for a c plus programmer. Add dialog box with details of memory usage before and after. I am also a html nub so any GUI stuff within a simple add on like this will help. Like how you access button onevent methods etc. If you want to add me as codesiner my programmer call sign will be DwR. Thanks


wtb ^ this addon. gonna take me time to really learn rom api and stuff. time/patience i dont have at the moment with rom memory. simple button that calls all memory cleanup functions with a button to press. if there is any other api functions that can help deal with memory call them too. thanks ahead of time to whoever writes it. if you can doucment it for a nub << great i will use it to learn stuff. If you dont want to do that np I just want to have the addon function.

EDIT:

if Lua can also somehow force call the windows garbage collections methods all the better add that as well.

This post has been edited 1 times, last edit by "danielrayment" (May 11th 2015, 3:11pm)


Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

11

Monday, May 11th 2015, 11:10pm

Lua only has one garbage collection function: collectgarbage() which only deals with Lua's memory area. It cannot call anything else unless the developers specifically allow it, so no Kernel system calls and no other memory affecting functionality either.

In my opinion, your best bet to learn this stuff is to actually write it yourself. Start with my guide to XML frames. Don't just read it, actually do the steps. Then look at other addons to see what/how others have done certain things/features and do something similar.

All my addons are in the public domain (if you can still find them) so you can rip any code you see in them. Admitedly, they aren't all that great code-wise, but hey, some were slapped together pretty quick and others just became a mess. Others still will likely be over your head at the moment (I'm thinking of the FuzzyDIYCE code here which is rather complex and uses some rather funky and advanced features of Lua).

Anyway, my point is to just dive in and do it. You'll learn a lot more this way than having someone else write the code for you.
2013... The year from hell....

12

Monday, May 11th 2015, 11:57pm

Once again it will take time before I can really get into Lua/XML etc. This addon isn't that hard to make for someone with your RoM Lua experience but would be useful sooner then later. I will get into others sample code and start learning stuff eventually. I am still waiting for the books to arrive at the store. I would rather look at your/others people code with a pure understanding of Lua. Even though after a first read I do get most of it pretty easily I will still wait till I have read the books over some more before diving into code samples.


As far as kernel only type calls go .... My first read with Lua shows that it can actually use DLL's and c library functions. In theory anyways this would mean that it could call any C driven winapi function. Aka aid in the windows memory cleanup process. That being said it was a first read and there are probably limitations on what it can do as far as that goes (but you would be able to shine a light on that way more than I could at this time).

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

13

Tuesday, May 12th 2015, 1:56am

Please note that the following is more my thoughts on the subject and should not be taken as criticism.

Once again it will take time before I can really get into Lua/XML etc. This addon isn't that hard to make for someone with your RoM Lua experience but would be useful sooner then later.

Except that I don't even have the game installed and haven't for many, many months now. So no, it would be much simpler and straight forward for you to bite the bullet and dive into the example from the guide. It actually goes over most of the features you are looking for anyway so you could then use it to create the addon you want.

Also, the guide has the completed code at the end so you could just go grab it and try it out. Granted it doesn't have as many comments as you would like, but then that's what the guide is, extensive commenting of the code, with explanations of what you are doing and why.

I am still waiting for the books to arrive at the store. I would rather look at your/others people code with a pure understanding of Lua. Even though after a first read I do get most of it pretty easily I will still wait till I have read the books over some more before diving into code samples.

You would be better served by looking at the example code from the guide at first since it will give you an understanding of how addons work in RoM. Lua is merely the scripting language being used, but to successfully create addons, you need to understand how frames and other RoM specific constructs work.

Further, XML is only partially needed, and you only really need to know how it is constructed for the various objects. You can always look at other code to see the appropriate parts. It's all just rince and repeat anyway. Once you understand how the XML basically works for RoM addons, you can then progress to my dynamic frames guide which forgoes XML files entirely.

As far as kernel only type calls go .... My first read with Lua shows that it can actually use DLL's and c library functions. In theory anyways this would mean that it could call any C driven winapi function. Aka aid in the windows memory cleanup process. That being said it was a first read and there are probably limitations on what it can do as far as that goes (but you would be able to shine a light on that way more than I could at this time).

This will not work. First, to be able to call a DLL from Lua, you still need the C++ side support for doing that, which the Lua engine in RoM doesn't have. Further, some of the Lua libraries were removed for security/anti-botting reasons. For example, the entirety of the io library isn't available in RoM.
2013... The year from hell....

14

Tuesday, May 12th 2015, 4:06am

Please note that the following is more my thoughts on the subject and should not be taken as criticism.

Quoted from "danielrayment" Once again it will take time before I can really get into Lua/XML etc. This addon isn't that hard to make for someone with your RoM Lua experience but would be useful sooner then later.
Except that I don't even have the game installed and haven't for many, many months now. So no, it would be much simpler and straight forward for you to bite the bullet and dive into the example from the guide. It actually goes over most of the features you are looking for anyway so you could then use it to create the addon you want.

Also, the guide has the completed code at the end so you could just go grab it and try it out. Granted it doesn't have as many comments as you would like, but then that's what the guide is, extensive commenting of the code, with explanations of what you are doing and why.

Quoted from "danielrayment" I am still waiting for the books to arrive at the store. I would rather look at your/others people code with a pure understanding of Lua. Even though after a first read I do get most of it pretty easily I will still wait till I have read the books over some more before diving into code samples.
You would be better served by looking at the example code from the guide at first since it will give you an understanding of how addons work in RoM. Lua is merely the scripting language being used, but to successfully create addons, you need to understand how frames and other RoM specific constructs work.

Further, XML is only partially needed, and you only really need to know how it is constructed for the various objects. You can always look at other code to see the appropriate parts. It's all just rince and repeat anyway. Once you understand how the XML basically works for RoM addons, you can then progress to my dynamic frames guide which forgoes XML files entirely.

Quoted from "danielrayment" As far as kernel only type calls go .... My first read with Lua shows that it can actually use DLL's and c library functions. In theory anyways this would mean that it could call any C driven winapi function. Aka aid in the windows memory cleanup process. That being said it was a first read and there are probably limitations on what it can do as far as that goes (but you would be able to shine a light on that way more than I could at this time).
This will not work. First, to be able to call a DLL from Lua, you still need the C++ side support for doing that, which the Lua engine in RoM doesn't have. Further, some of the Lua libraries were removed for security/anti-botting reasons. For example, the entirety of the io library isn't available in RoM.



Dude, don't take my rants at some others personnal. I appreciate any input you and any other programmers have to offer. There are just some people on this forurm that have nothing better to do then hijack threads with useless nonsense and argue about everything. With some people it has been going on for years.

I am already fully aware of the concept of frames, even if I am not used to the XML coding of it. I have done lots of windows programming in my day (though not for a while). Your XML code samples are fine I glanced over them already and know full well the whole once ya get it ya get it! I have looked at your links and will continue to look them up more. However everyones way of learning is a little bit different. For me I really dont gain much by glancing at other people code without learning the core of the language first. I also learn better from books so I will go invest in an XML book also.

As far as the C coding side thanks for the input. This is why I said it was a first read and you will have to have some patience with my suggestions as I dont know RoM Luas limitations.

Heron

Game Administrator

Posts: 942

Location: Swamp

Occupation: Fishing

  • Send private message

15

Tuesday, May 12th 2015, 4:57pm

I never expected this thread to produce drama. It seems to have a long track record of helpful questions and answers and discussion.

This certainly isn't the place to be grumbling at another player. It's also utterly unlike other threads that ramble and meander and eventually blow up. Let's just keep this one nice and clean, and cut the fluff: If you haven't a useful or related answer or comment to make... then don't. One does not need to reply to every single thing simply because one can. Also, consider editing the way the quotes display by snipping some middle parts to condense the whole. This prevents some wall-of-text issues.

Carry on there, Peryl

16

Tuesday, May 12th 2015, 6:21pm

I never expected this thread to produce drama. It seems to have a long track record of helpful questions and answers and discussion.

This certainly isn't the place to be grumbling at another player. It's also utterly unlike other threads that ramble and meander and eventually blow up. Let's just keep this one nice and clean, and cut the fluff: If you haven't a useful or related answer or comment to make... then don't. One does not need to reply to every single thing simply because one can. Also, consider editing the way the quotes display by snipping some middle parts to condense the whole. This prevents some wall-of-text issues.

Carry on there, Peryl


AMEN to that! Where were you like 3 years ago!

Anyone that has more useful links/books/sites suggestions please send me more feedback.
So far Peryl and Hoffmale have been very useful more input is welcome.

Anyone that wants to make the memory optimize addon sooner than I can please go ahead and do so.

Cike

Rogue

Posts: 4,171

Occupation: Being Human

  • Send private message

17

Tuesday, May 12th 2015, 7:00pm

I'd try the eu forums as well. they have a larger addon dev community than US does ATM iirc.

otherwise, you might want to just go to curseforge and dissect some addons if you want context for the API.
my r/p can outdps r/m. your name is stupid.

mages should stack dex. word.

18

Wednesday, May 13th 2015, 1:55am

So I was playing around in my C++ compiler and by chance I opened up this Flecia.xsd file. (I had to rename is as .txt to upload it)

This is the HOLY GRAIL of reasoning that can turn samples as linked above (or from addons I use) into something that makes sense to me. It clearly defines where UI, Frame, Anchors .... x,y, point, relativePoint come from and what there data type is. It shows everything that is available to me and what there data types are.

I can for example conceptualize Frame as a class object:

typedef struct { uchar x,y; } AbsDimension;
class Frame {
String name; String parent;

AbsDimension Size;

etc...
}
where Size.x Size.y would be a variable of unsigned byte type.

What it doesn't do however is fill in the values like relativeTo = "UIParent" where do I find all this info? what are my options?
danielrayment has attached the following file:
  • Flecia.txt (2.7 kB - 2 times downloaded - latest: May 13th 2015, 5:28pm)

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

19

Wednesday, May 13th 2015, 2:51am

Your best bet for this would be to extract Ui.xsd from the game client's data files (you can find tools for this on the RoMWiki).

You will need to investigate how it is setup, but it will tell you everything since this is the file that defines what the XML parser in RoM is validting against.

For example, here is some of the info related to a RoM Frame (I'm not going to show everything since Frame's are rather big). We read upward in this file, that is find the definition of the element type you want (in this case Frame), and then work upwards in the file. Anyway, we first find this:

Source code

1
<xs:element name="Frame" type="FrameType" substitutionGroup="LayoutFrame"/>

So a Frame element is of type FrameType and will substitute for a LayoutFrame. This means that any element that requires a LayoutFrame in its definition will also accept a Frame.

Just above this, we find the definition of FrameType (cut down for brievety):

Source code

1
2
3
4
5
6
7
<xs:complexType name="FrameType">
	<xs:complexContent>
		<xs:extension base="LayoutFrameType">
    ...snip...
		</xs:extension>
	</xs:complexContent>
</xs:complexType>

Here we see that the FrameType is an extension (or inherits from) LayoutFrameType. You can now look that up as well (it will be further up) and see what other methods, member variables and attributes this adds as well.

Rinse and repeat...
2013... The year from hell....

20

Wednesday, May 13th 2015, 4:54am

Your best bet for this would be to extract Ui.xsd from the game client's data files (you can find tools for this on the RoMWiki).


I have no idea where to find the tools to extract the file or the file itself. If not for Visual Studio I would never have been able to make the .xsd file I linked earlier. I have done a simple search through menus on romwiki and have used the search engine with xsd and nothing of value comes. if you could simply tell me how/where to access this file I have no problems scrolling though it on my own time.