GUI XML Questions..

Post » Sat Feb 19, 2011 8:27 am

I've been using MenuQue to add a new UI to my mod, and it's been going well, though there are a few things I'm having a bit of trouble with.

Edit: Issue #1: Self solved.. I wanted to make an element resize itself based on how many buttons were enabled, after struggling with making it work correctly from the XML, I decided to just do it from my script instead.. (It's the same difference I guess, but I would have preferred keeping that in my XML... So if you know how to do this, feel free to let me know, I'll certainly implement it.)

------

The other issue, is with quantity prompts, I'm trying to figure out if it's possible to get the mouse working to drag the slider, I have it clickable, and it works fine, but dragging doesn't seem to work, and I couldn't really see any options for doing this. (Is this just something hardcoded, that I won't be able to do, or am I missing something..)
User avatar
Anthony Santillan
 
Posts: 3461
Joined: Sun Jul 01, 2007 6:42 am

Post » Sat Feb 19, 2011 4:12 am

Edit: Issue #1: Self solved.. I wanted to make an element resize itself based on how many buttons were enabled, after struggling with making it work correctly from the XML, I decided to just do it from my script instead.. (It's the same difference I guess, but I would have preferred keeping that in my XML... So if you know how to do this, feel free to let me know, I'll certainly implement it.)
In Display Stats I have the popup window resize itself purely in xml, depending on the number of lines displayed, and with of the widest line - actually the vanilla MgicPopupMenu (its named that) does so already, only a bit more clumsy - DarnifiedUI does it quite a bit better. Also, in Enhanced Hotkeys, the hotkey menu us automatically resized depending on the number of hotkeys (rows x columns - which are both configurable).

So look at one of those to see how, or post a bit of your code and I may help.


The other issue, is with quantity prompts, I'm trying to figure out if it's possible to get the mouse working to drag the slider, I have it clickable, and it works fine, but dragging doesn't seem to work, and I couldn't really see any options for doing this. (Is this just something hardcoded, that I won't be able to do, or am I missing something..)
No idea, sorry :)
User avatar
jeremey wisor
 
Posts: 3458
Joined: Mon Oct 22, 2007 5:30 pm

Post » Sat Feb 19, 2011 1:21 am

I think I can anwser most of your questions. Lemme type it all down.... :P
User avatar
Noely Ulloa
 
Posts: 3596
Joined: Tue Jul 04, 2006 1:33 am

Post » Fri Feb 18, 2011 9:19 pm

Thanks guys.. :)

@TheNiceOne, really it shouldn't matter on my code too much... But a rough idea..


if (Button1 Enabled)
Add Button1 Height

if (Button2 Enabled)
Add Button2 Height


I just can't figure out how to make the conditional work properly to check against the buttons being enabled.. (Mainly because there are like thirty different variants, of , and I couldn't figure out which one to use, and it's kinda hard to tell how to order them..

It looks like the conditional comes after the condition.. ie,.

Add 1000
if (Visible)

But it's hard to tell, because every time I find some code doing this, there are always things like this..

Add 1000
if (visible)
Add 100

So, which one is it operating on? Logically, the conditional should be first, but, who knows..

---

@Kyoma, that sounds scary, must be a beast of a solution.. :D

Edit: Hey Kyoma, while you're here, can I add a single trait to an existing item? I want to add a trait to button_xtralong.xml, but I couldn't tell if that was possible, in an easy manner.. (I can make my own buttons with not too much effort, if it's going to be too much of an ordeal..)

My text is too long to fit, and just changing the size was causing issues, I think it's the missing zoom trait, but it could be the cropping, or anything.. I just need longer buttons for longer text, no idea why Beth didn't already have that done, since it's fairly easy to make an element match the text size..
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Post » Fri Feb 18, 2011 9:47 pm

Better make a new post. :P

First let me start by saying that in XML scripting the values of &true; and &false; are 2 and 1 respectively. As for why it only recognized the first button, well to anwser that I'll explain a bit how the game goes from 'a list of operators/expressions' to 'an actual value'. It does this by going from top to bottom and performing each operator on the cumulative value of everything that came before.

A small example, where 'value-so-far' is well, exactly what it says
	 30  <!-- value-so-far is 30 -->	 20  <!-- now it is 50 -->	 19  <!-- the end result is now 31-->
This ofcourse is a pretty straightforward example and does not display the use of nested operators (see below if you're not sure what I mean). So lets look at that, the process remains the same except that when an operator block starts the 'value-so-far' gets pushed on a stack and then reset to 0. The operators within the block are then handled like normal and when the block ends it pops the previously pushed value from the stack and performs the operator from the block on it.

	 30  <!-- value-so-far is 30 -->	 20  <!-- now it is 50 -->	 19  <!-- the end result is now 31-->	 <!-- start of a sub block, value is stored and then reset-->		 20  <!-- value-so-far is 20 -->		 19  <!-- now its 1 -->	 <!-- the block has ended and the value-so-far is now 30 (31 - 1) -->
That should give a basic idea as to the flow-control of the operators. But there is something else (you'll probably understand why I first needed to explain the above). The two conditional operators ( and ) work by resetting the 'value-so-far' back to 0 if their result is &false;. This is always the case, regardless of what was performed before it. Take a look at this:

	 30 	 20 	 19 		<!--    if "_condition1" is false the value-so-far will be set back to 0, otherwise it will remain the same    -->			 20 		 19 				<!--   if "_condition2" is  false the value-so-far gets reset but it only affects this operator block   -->			<!-- now comes the pitfall, if this condition is false the value-so-far gets reset. As if everything that came before wasn't even there -->
So for your code the proper way of doing it is this (you'll want to put each button-code/condition within a block)

	 1 	 <!-- the first one doesn't need to be in a block -->			 2 						 3 						 4 				....
But do not forget that and are also operators so turning them into a block is also possible. The actual condition check is merely the end-result of the operator.
<_cond2> &true; <_cond3> &false; 	 1 			 2 					 <!-- the value so far is now &true; -->			 <!-- check if (value-so-far && _cond3) -->			<!-- so the resulting value that  will use is &false-->				....

User avatar
Astargoth Rockin' Design
 
Posts: 3450
Joined: Mon Apr 02, 2007 2:51 pm

Post » Sat Feb 19, 2011 12:11 am

For your other question about making your scrollbar draggable you'll be pleased to see http://cs.elderscrolls.com/constwiki/index.php/Tile_Systems_%28MenuQue%29 (I hope). Although I need to finish up the documentation for it. The idea is to give your scrollbar a unique string value for its trait, then when it gets opened MenuQue creates the needed background stuff. For normal menus this behaviour is hardcoded to specific IDs. It is als possible to indirectly give an trait this unique string by using a trait and copying its value.

Taking the default "vertical_scroll.xml" prefab as an example you could make it both scrollable (with the mouse wheel) and draggable using this:

		...	 &ScrollBar;  <!-- this tells MenuQue to setup a scrolling functionality for this element -->	...	<!-- then come the userX overrides for the prefab -->	 0 		<!-- Minimum value that can be scrolled to (should usually be zero) -->	...blablabla...not important...	...	<!-- now comes the userX trait which is inherited by the  trait of the "vertical_scroll_marker" element in the prefab -->	 &DragVertical; 	<!-- sets up a vertical drag movement functionality-->
At first it would only work when directly using in an trait but that led to minor annoyances with not being able to use the default prefab files without minor edits.
User avatar
Crystal Birch
 
Posts: 3416
Joined: Sat Mar 03, 2007 3:34 pm

Post » Sat Feb 19, 2011 10:14 am

Whoa, that's a lot of stuff, but, I understand most of it. :P I'm going to have to reference that a bit as I go, but I think you got me sorted..

Thanks a lot for taking the time to type all that up, I would wiki that info for sure, to help others out, as the only real source of XML info, is basically digging in at the moment..

As for the second part, I'm very happy to see that. :D You just made a lot of stuff I couldn't figure out how to do possible, and it looks relatively easy..

---

Edit: I see you're still posting, perhaps I should have waited a bit.. Must've been editing...

Well, I really appreciate it Kyoma, I'm going to try to get this implemented, if I have any trouble, I might just shoot ya a PM since you seem to know the most about the system, or I'll stop by the MenuQue thread, whatever you prefer..
User avatar
Elena Alina
 
Posts: 3415
Joined: Sun Apr 01, 2007 7:24 am

Post » Sat Feb 19, 2011 8:40 am

Edit: Hey Kyoma, while you're here, can I add a single trait to an existing item? I want to add a trait to button_xtralong.xml, but I couldn't tell if that was possible, in an easy manner.. (I can make my own buttons with not too much effort, if it's going to be too much of an ordeal..)

My text is too long to fit, and just changing the size was causing issues, I think it's the missing zoom trait, but it could be the cropping, or anything.. I just need longer buttons for longer text, no idea why Beth didn't already have that done, since it's fairly easy to make an element match the text size..
Short anwser, no you cannot override traits in the prefabs that aren't at top-level. For a while I thought about implementing such a feature but due to time constraints I kinda put it on a shelf. But I know all to well how annoying it is to be forced to make tiny little changes to a prefab, or rather, having to create a separate file just for those tiny changes. I myself whipped up a couple of 'generic' elements, like a background, buttons, etc. that are much more flexible in terms of customizing them using override.

For example, this http://dl.dropbox.com/u/16544701/Oblivion/generic_background.xml which allows for a zoom override.Or this http://dl.dropbox.com/u/16544701/Oblivion/generic_button.xml, which can be configured for several sizes and zoom level. While it still means additional prefabs it does reduce the amount of additional prefabs. :)

*Funny remark* ..since you seem to know the most about the system... while it is probably correct, how could it have been incorrect. I mean, I created it. :P
User avatar
D LOpez
 
Posts: 3434
Joined: Sat Aug 25, 2007 12:30 pm

Post » Sat Feb 19, 2011 1:12 am

Short anwser, no you cannot override traits in the prefabs that aren't at top-level. For a while I thought about implementing such a feature but due to time constraints I kinda put it on a shelf. But I know all to well how annoying it is to be forced to make tiny little changes to a prefab, or rather, having to create a separate file just for those tiny changes. I myself whipped up a couple of 'generic' elements, like a background, buttons, etc. that are much more flexible in terms of customizing them using override.

For example, this http://dl.dropbox.com/u/16544701/Oblivion/generic_background.xml which allows for a zoom override.Or this http://dl.dropbox.com/u/16544701/Oblivion/generic_button.xml, which can be configured for several sizes and zoom level. While it still means additional prefabs it does reduce the amount of additional prefabs. :)


Ah, I see.. Well, I guess one more prefab won't hurt. :)

Well, many, many thanks for all your help Kyoma, seriously, it's greatly appreciated. :D

---

Edit:

*Funny remark* ..since you seem to know the most about the system... while it is probably correct, how could it have been incorrect. I mean, I created it. :P

Haha, well, I meant you seem to know a lot more about things in general when it comes to the UI than other ppl around here..

But, yeah, I can see how you might have read it that way.. :P

Of course you know how MenuQue works, I hope you didn't think I was implying otherwise.
User avatar
Red Bevinz
 
Posts: 3318
Joined: Thu Sep 20, 2007 7:25 am

Post » Sat Feb 19, 2011 1:54 am

What do I use for horizontal scrolling?

I guessed DragHorizontal, but it didn't work. (Edit: I think I just confused myself, I got too many userX's, and XML files open, I'm going to take a minute, and go over this again from the start.. Cus, it's looking like I just did it wrong..)

                <!-- SCROLL ============================================================================-->                                         &ScrollBar;                          350                                                                                                                         
2
60 5 1 &DragVertical; &false; &true; &true; 1 Menus\dialog\dialog_selection_full.dds 255 1 120 64 60 21 3 &true; &true; 1 dialog\dialog_selection_cut.dds 104 64 100 0

User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am


Return to IV - Oblivion