Monday, 17 March 2008

XML Terminology & Some Findings

I have been playing around with the XML code for NWN2 for a few days now and slowly putting together a really basic tutorial for people like myself who had no idea where to start. So far, the tutorial goes into a reasonable amount of detail about some basic GUIs, but I wanted to write one more GUI that went that little bit further and give information on how to send data back to the module, using functions like UIObject_Misc_ExecuteServerScript () and UIObject_Input_ActionTargetScript(). Now, I seem to have mastered the first of these two functions, and I thought I had mastered the second. However, when it came down to testing my code, the second of these functions refuses to work as I thought. I have posted on the Bioware forums, but have not had an answer yet. Hopefully, I will receive one soon, as it will allow me to complete the last GUI and finish the tutorial and post it on the Vault.

During my writing of the tutorial, I realised there was one term I was using that was a little misleading and so I decided to edit the word out for the correct name. However, I hope I explained its usage clearer than others have done in the past: Tags! In my working out of the code, I always saw the things like UIScene as "functions" and referred to them as such within the tutorial. However, as I learned more, I could see that it is the type of lines of code written above (in the first paragraph) that are actually the functions in XML and that these items I had been calling functions were merely "objects" with certain "tags", which I assume have been predefined by Obsidian. So, I edited all my incorrect references to "functions" and replaced them with the correct term of either "object" or "tag". Since then, I have also learned that what I have been calling "parameters", others are calling "attributes". However, as the word "parameter" has not been readily used elsewhere for XML, I have left my wording as it is for the time being, as it still makes more sense to me as a beginner, which is the audience I am aiming for.

I made another big discovery when testing my code as well: Functions like the two listed above must not have any spaces between their parameter listing. This had me stumped for ages, as I could see nothing wrong with my code and it was not until I copied and pasted a line almost identical to mine from another file and found that worked, did I then discover the spaces in my own code that made the difference.

Another discovery I made was that it is not yet possible to design a custom button that can be dropped onto a hotbar. Looking at the parameters available, I thought this could be done, but in practice it simply does not work. Then I checked the forums and someone else had mentioned they would like the facility to be able to do this, and so I assume it cannot be done after all. If anybody knows any different, then please let me know.

I intend to spend some more time looking over XML code made by others if and when I get the chance, especially some of the more advanced stuff, like that done by Adam Miller as part of his Dark Waters series. Maybe I can learn one or two tricks from him there.

No comments: