EQ2Interface.com
Search Downloads


Go Back   EQ2Interface > Developer Discussion > UI Developer Discussion

Reply
Thread Tools Search this Thread Display Modes
  #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
  #2  
Unread 12-07-2009, 02:44 PM
Drumstix42's Avatar
Drumstix42 Drumstix42 is offline
A Griffon
Featured
 
Join Date: Oct 2004
Server: Antonia Bayle
Posts: 3,287
Default

So in the XML UIsettings file, you get lines like this:

Code:
<Window Name="StatBar_AAXP" alignment="4" alignment_offset="98324,99002" locked="true" size="1,2" />
And if you're interested how I made my execution script loop only so many times, it was fairly easy.

- Text element, set to visible.
- DynamicData="/GameData.General.Time" (this is norrath time, EarthTime is the local time just FYI)
- have a value called "changed" set to "0"

Code:
OnTextChanged="do initialization code
changed=changed + 1
COND=(changed < 35)
Visible=COND"
Code:
OnHide="OnTextChanged=' '"
So after it gets executed 35 times, it'll hide itself and then changes the OnTextChanged to do nothing.

Hope this helps out anyone interested about having custom options and such
Hopefully the devs will just allow some more UI customization soon and this method will be outdated and an easier on will come forth.
__________________
"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
  #3  
Unread 12-07-2009, 04:13 PM
Landiin Landiin is offline
Slayer of clock cycles
This person is a EQ2Map developer.
Featured
 
Join Date: Nov 2004
Server: Oasis
Posts: 3,464
Default

I seen a savessetting=true in one of the default windows but it didn't to jack that I could tell. Its been so long since I've really modded getting use to jumping through hoops is annoying. Now that I've started updating some of my old code I'm starting to remember why I stopped in the 1st place..

And remember is called a thingy-ma-bopper...
__________________
Landiin's EQ2MAP Updater Discussion Download

Last edited by Landiin : 12-07-2009 at 04:16 PM.
Reply With Quote
Reply



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:43 AM.


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