Saturday, 23 January 2010

Neverwinter Nights 2 Custom Store GUI

I've create a Custom store GUI for the persistence world Neversummer 5. The main reason for creating it, is so items can and their costs can be pulled from a database. First step is to make it look like the stock Neverwinter Nights 2 stores. Later on we can improve on them.

One of the things I've been having trouble with, is the dragging of an item from a players inventory to the store window to sell the item. Well with the hope of people in #nwn2cr I've finally got this working. I though I'd post about it as this kind of information is very hard to find.

My main mistake was trying to retrieve the event of a item been dropped on store GUI. This is actually done from the inventory screen.

Their are two events that were confusing me. OnMouseDrop and OnMouseDropReceived. So in a drag operation between two dialogs (in my case the inventory and the store) their is a source and destination of the drag operation. The source will fire the event OnMouseDrop, and the destination will fire OnMouseDropReceived.

I've not been able to figure out how to capture the dragged object details using OnMouseDropReceived, but OnMouseDrop works very well. I used the two following calls to capture the objects ID and send to to the store sell script:

OnMouseDrop0=UIObject_Misc_ExtractData("self:","objectid",0,local:3) OnMouseDrop1=UIObject_Misc_ExecuteServerScript("gui_store_sell",local:3)

Their is another bit of magic that was also need. The above will fire for any event, so you need to know that the item is been dragged to the store. I added the following calls to the store window:

OnMouseEnter=UIObject_Misc_ExecuteServerScript("gui_store_mouse","ENTER")
OnMouseLeave=UIObject_Misc_ExecuteServerScript("gui_store_mouse","LEAVE")

The script gui_store_mouse sets a variable on the player when the mouse pointer enters the store window and deletes it when the mouse pointer leaves. Now the gui_store_sell script can check the variable before selling the item.

I was hoping to use a combination of OnMouseDrop on the inventory dialog and OnMouseDropReceived on the store dialog, but it seems that OnMouseDropReceived is fired before OnMouseDrop.

Hope this helps another scripter/modder :-)

Thursday, 21 January 2010

Neversummer Blog's

This is mostly a test blog entry to see if I can get it to appear on the new neversummer blog planet I'm setting up. The idea is developers can blog about the various projects they are working on within neversummer.

Tuesday, 12 January 2010

Dell Studio 1535, FGLRX and RandR 1.2

I've had a little time to play around with the new RandR 1.2 support in ATI/AMD fglrx graphics drivers and I'm liking what I see. Make the laptop run with dual external monitors or the in-built panel is now really easy. It's a massive improvement over the ati-config approach I was using before.

Here are the commands I used to make the my Dell Studio 1535 run with dual external monitors:

xrandr --output LCD --off
xrandr --output CRT1 --right-of DFP_EXTTMDS --auto --output DFP_EXTTMDS --auto


These commands will now make it run with the laptop panel:

xrandr --output CRT1 --off
xrandr --output LCD --auto --output CRT1 --off --output DFP_EXTTMDS --off

Now I just need a nice way of attaching these commands to the screen setup button on the laptop :-)

Wednesday, 6 January 2010

ATI Drivers get Xrandr 1.2

I've just upgraded my laptop to OpenSUSE 11.2 and whislt I was at it, I pulled in the latest ati fglrx driver and wireless drivers. For some reason the display driver put up a bit of a fight, I think the problem was left over of older versions of the driver.

Once I'd removed the old ones, the new driver installed and work without a problem. The laptop panel came up with my desktop. I took my laptop to the study and plugged into into the two external monitors (LCD and a CRT). Now things started to not work again. It would only use the built in panel. So i tried to use the "aticonfig" tool to fix the issues and I got a error message about aticonfig not working when randr 1.2 was active!!

This is great news, it means we now have proper randr in the ATI comerical drivers (if I've not made a mistake and load the free drivers :-) ). So I can now configure the mointor setup using standard randr tools. Also Xrandr is much easier to work with than aticonfig. I suspect it should be possible to write a script and attach it to the monitor key on the laptop.

I'll post again when I've had time to play with this a little more