EQ2Interface.com
Search Downloads


Go Back   EQ2Interface > Developer Discussion > UI Developer Discussion

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Unread 12-07-2009, 02:36 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default The "Custom options" explanation

Landiin sent me a PM and I figured I'd share my response to all:

Quote:
Originally Posted by Landiin
So the only way to get the game to save a windows setting in the Custom Mod is to unlock change via script and lock it back? Is that how I am reading you code?
Well, that's part of it. It won't just save any setting of any window. Basically here's the deal:

It'll save a custom window's location and it's size. Size is the important one because in-game we can directly get the window's Width and Height. And these are 2 single numbered properties that we can change, and then save. The unlock/lock is to make sure the change is updated in the XML layout because the size is being changed via script, rather than normally by your mouse.

So you make a new tiny window for each setting you want to save. The code is set up to read like a true/false between each new window, reading if the Width is 1 or 2 depending on how the Settings changed. I also used Height.

For my stat bar I used the Width properties of 50 new tiny windows for the top bar, and the Height properties of the windows for the second bottom bar. This saved some extra coding for windows.

I haven't noticed any performance hits from all the new windows. They're placed way off screen and are only 1-2 pixels in size, plus they're not styled.

The one trick to getting the code to read the windows is the big part. If you try to use "OnShow" to check the size, the UI script tries to read it the instant the game loads, and it seems that is too soon.
So..... I attached a script to dynamic data for "NorrathTime" and used "OnTextChanged". This is a number that changes every few seconds, and I figured it would not cause any lag because it would not be a continuous loop. So every time this number changes it checks for the Width/Height of my custom tiny windows and then sets up those options accordingly.

I didn't want that script to execute forever, because that would cause problems, and it probably decreases performance constantly executing. So I used some logic and made it execute about 30 times (30 times that NorrathTime changes)... which gives the average user enough time to load into the game the first time and have all the settings load correctly.


I know it's a lot, but it seems to work well

Samejima did the same kind of "load script" but did an OnTextChanged for GameData.Self.Name and I feel that this only gets one chance to execute and depending on how fast your computer loads, it may load too quickly.

Hope that explains it in enough detail!

Cheers,
-Drum
__________________
"I'm afraid you're guilty of thought-crime. Don't bother getting the door, we'll let ourselves in..."
<Donate to DrumsUI> < [DrumsUI] Updater > < [DrumsUI] Full Interface> < Drumstix42 on Twitch.tv
>
Reply With Quote
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:11 AM.


Our Network
EQInterface | EQ2Interface | WoWInterface | LoTROInterface | ESOUI | MMOUI