User Interface

Information for creating custom user dialogs.

Machinations: Change your name

BetterThanLife posted a tutorial concerning custom interface screens.

This tutorial guides you through the creation of your own custom user interface screen for Neverwinter Nights 2. The screen is responsible for allowing the user to change their characters name. This is an illustrative example but you could easily extend it for a variety of other purposes. A sample module is included that allows you to ask a gnomish 'name changer' to change your name for you, this just shows one use of such a script and screen.

Download the zip file with the module showing how he did it from his site:
http://www.machinations.org/ChangeNameUserInterfaceTutorial.zip

OEI: UI Customization blog posts

Rob McGinnis has been posting a series of posts in the Obsidian Entertainment NWN2 Developer Blog. There's a ton of information in there, and they seem to be posting one a week. Here is the link to the full category of posts:

http://forums.obsidianent.com/index.php?automodule=blog&blogid=2&&cat=7

And here are some of the topics included at the time of this writing, along with the basic introductions he included:

  • UIScene - The UIScene tag at the top of the XML files defines certain global parameters about the entire GUI window being defined in the file.
  • UIPane - UIPane is the generic 'container' for other UI Objects. Panes can't be rendered, but they can contain 'child' objects which can be renderable objects.
  • UIObject - UIObject is the 'base' GUI object. You can't actually define it in XML, but it contains attributes that are common to many different UI Objects, so I'm starting here.
  • Special Screens - Most XML files are loaded as default UI Scene, which implies no special behaviors. There are, however, several XML files that will get special handling in code and most conform to specific rules in order to even be loaded.
  • UIObject - hideoverride - In 1.05 there is a new attribute that all UI Objects handle called hideoverride. If true, this attribute sets a UI Object hidden and keeps it that way until a script says otherwise via the SetGuiObjectHidden() script function.
  • UIText - UIText is the GUI object used for containing and rendering text. It is one of the more complicated UI Objects to work with.
  • UIButton - UIButton is the generic, clickable object one expects to find on any PC game interface. It also acts as a 'restricted' container of sorts, as it can contain specific UI objects within it.
  • Multiple Callbacks Per Event - In 1.06, it will be possible to set up multiple GUI callbacks on a single UI event in XML. The syntax will be to use the event name and append a number to it. The engine will read in the callbacks until it fails to find the next sequential number.
  • Couple new GUI script functions for 1.06 - 1.06 will have a number of new script functions that will give improved control over custom GUIs. SetGUIProgressBarPosition(); and SetGUITexture();
  • New UI Callback Parameters - In 1.06, callbacks can take 2 new 'variable' parameters in addition to global:# and local:#.
  • UIObject_Misc_ExtractData - A new callback in 1.06 is: IObject_Misc_ExtractData( sourceobject, datatype, index, destinationvar )
  • UIObject_Input_ActionTargetScript - New in 1.06, will let you make 'GUI actions' similar to the 'actions' that are created when you click on a spell or feat button to cast it, or on a button in the DM Choser that then has you select a target to do the action to.
  • UI Listbox - UIListBox is a container similar to UIPane and anything listed under UIPane that makes sense for UIListBox probably does the same thing under UIListBox. So I'm going to stick to discussing the attributes that are unique to UIListBox. Refer to UIPane for the basic attributes (Like X, Y, Height, Width, etc).