Gui WIP

hi all.
i tried to add on my buttons some actions bbut it dosent work.
any way speeed up this?
any execute script doesn’t work on gui
two main questions for now.
1)why it dosent works?=solved by adding gui tag
2)how to hide part of interface via button click?=solved by adding gui tag
I need the ability to hide most of the interface and show it again.
i tried close gui and open but any script wont works.
what is best way to do that?

At first I thought to create as many tabs as possible, then I changed my mind - it would be too overloaded. (and I decided to leave everything as it is.
3 interfaces with the ability to switch, however, I can change something else.

When it comes to GUI and XML coding, I have found that @Lance_Botelle is the ultimate expert on that around here. So maybe he can answer if he has the time and sees this. I’m afraid I’m still a total noob when it comes to XML coding still, even if I’ve edited a few of the existing GUIs and Lance’s GUIs. To code them from scratch is still beyond me.

2 Likes

@lord_XD
(@andgalf )

Try checking out my XML tutorial …

https://neverwintervault.org/project/nwn2/other/gui/nwn2-xml-gui-coding-beginners

There is also a basic Scripting Tutorial to complement that one if you want it … (Link in the link above.)

1 Like

heavy textbook - yours, too heavy to understand mine.
nevertheless I dealt with 1 problem, it reminded me.
(Jumper (1/5) Movie CLIP - There Are Always Consequences (2008) HD - YouTube)

1 Like

No, it’s a step by step with FAQ check points … but, go with what works best for you … :thinking:

Why doesn’t my XML code even start in the module?
(Assuming I have the correct name and file being referenced.)
This can be for a number of reasons, but check the following:

·Spaces left in functions by mistake.Page 15 and Page 17.
·Extra apostrophes missing from the Tooltip function.Page 16.
·Duplicated attribute within the same tag.
·A comment has been left inside a tag.Page 7.
·Forgotten to close a tag with either > or />. Page 7.

2 Likes

I think the main mistake of star wars is that there were no alternative stories. ok
to business

I really appreciate what you do.
but some content is hard for me, sometimes I need an explanation that I really understand.
Nevertheless, everything seems to work now. It turns out that it was only necessary to add a tag (GUI) to the script that needs to be run.

1 Like

in principle, everything turns out. I’ll leave the topic like this, not everything has been implemented yet (there may be questions, then I’ll write here so as not to create a bunch of the same type of topics.)
P.s Lance_Botelle thanks for tutorial again it very helpful for testing.

1 Like

Hi all ! need some help again
1 question
how to create collapsible and expandable interface====solved_mini
but if anyone have better idea you can say me.

1 Like

my xml now

<?xml version="1.0" encoding="NWN2UI">

<!-- GUI 1: SCREEN DEFINITIONS -->

<! capturemouseevents=FALSE stops text from flicking on a mouse click >


<UIScene name="coltext" x=ALIGN_RIGHT y=ALIGN_RIGHT width=536 height=1080 priority=SCENE_SCRIPT scriptloadable=true backoutkey=true />
<! -- TABS -- >
	
<UIButton name="PAGE_1" x=0 y=0  width=176 height=40  text="UNITS" style="STYLE_SMALL_TAB" groupid=1 groupmemberid=1
OnSelected=UIButton_Input_ShowObject("FIRST_PAGE") OnUnselected=UIButton_Input_HideObject("FIRST_PAGE") />


<UIButton name="PAGE_2" x=176 y=0 width=176 height=40  text="TOWERS" style="STYLE_SMALL_TAB" groupid=1 groupmemberid=2
OnSelected=UIButton_Input_ShowObject("SECOND_PAGE") OnUnselected=UIButton_Input_HideObject("SECOND_PAGE") />

<UIButton name="PAGE_3" x=352 y=0 width=176 height=40  text="STATISTIC" style="STYLE_SMALL_TAB" groupid=1 groupmemberid=3
OnSelected=UIButton_Input_ShowObject("THIRD_PAGE") OnUnselected=UIButton_Input_HideObject("THIRD_PAGE") />

<!-- DEFINE FIRST TAB PAGE -->

<UIPane name="FIRST_PAGE" x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT capturemouseclicks=false >



	<!-- LOCATIONS AND GATES -->
<UIButton name="LOCATIONB1" x=30 y=96 text="NORTH" style="STYLE_MENU_BUTTON" width=140 height=30 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_new_pen")>
	</UIButton>
<UIButton name="LOCATIONB2" x=30 y=138 text="SOUTH" style="STYLE_MENU_BUTTON" width=140 height=30 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_buildtower","1")>
	</UIButton>
<UIButton name="LOCATIONB3" x=30 y=174 text="WEST" style="STYLE_MENU_BUTTON" width=140 height=30 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_buildtower","1")>
	</UIButton>
	<!--  GATES -->
	<UIButton name="GATE_1B" x=325 y=90  style="STYLE_MENU_BUTTON" width=66 height=38 OnLeftClick=UIObject_Misc_ExecuteServerScript("spawn_tort")>
	<UIFrame state=up		fill="gate_def.tga" />
					<UIFrame state=down		fill="gate_pr.tga" />
					<UIFrame state=focused	fill="gate_pr.tga" />
					<UIFrame state=hilited	fill="trade_b_accept.tga" />
					<UIFrame state=hifocus	fill="gate_pr.tga" />
	</UIButton>
<UIButton name="GATE_2B" x=325  y=130  style="STYLE_MENU_BUTTON" width=66 height=38 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_buildtower","1")>
	<UIFrame state=up		fill="gate_def.tga" />
					<UIFrame state=down		fill="gate_pr.tga" />
					<UIFrame state=focused	fill="gate_pr.tga" />
					<UIFrame state=hilited	fill="trade_b_accept.tga" />
					<UIFrame state=hifocus	fill="gate_pr.tga" />
	</UIButton>
<UIButton name="GATE_3B" x=325  y=170  style="STYLE_MENU_BUTTON" width=66 height=38 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_buildtower","1")>
<UIFrame state=up		fill="gate_def.tga" />
				<UIFrame state=down		fill="gate_pr.tga" />
					<UIFrame state=focused	fill="gate_pr.tga" />
					<UIFrame state=hilited	fill="trade_b_accept.tga" />
					<UIFrame state=hifocus	fill="gate_pr.tga" />
	</UIButton>
	<!--  BUY UNITS -->
<UIPane  name="CONTAINER" x=0 y=0  width=536 height=355   capturemouseclicks=false > 

<UIButton name="I_1" x=6 y=270 text="I"  style="STYLE_SMALL_TAB" width=40 height=40  groupid=1 groupmemberid=1
OnSelected=UIButton_Input_ShowObject("INFO_PAGE_1") OnUnselected=UIButton_Input_HideObject("INFO_PAGE_1") />
	
<UIText name="NumBox" x=215 y=270 fontfamily="Body_Font" width=80 height=80 update=true OnUpdate=UIObject_Misc_SetLocalVarString(0)/>

	<UIFrame name="NumFrame" x=215 y=270 width=80 height=80 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" 
	bottomleft="tp_frame_bl.tga" bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga" left="tp_frame_l.tga" 
	right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga" border=3 />	

	<UIButton name="INFO" x=294 y=268 text="-" style="STYLE_MENU_BUTTON" width=40 height=40 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_new_pen")>
	</UIButton>
	<UIButton name="INFO" x=294 y=310 text="+" style="STYLE_MENU_BUTTON" width=40 height=40 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_new_pen")>
	</UIButton>
		<!-- end NUMBER TEXT - TITLE, VIEW BOX & FRAME -->
 <UIPane  name="INFO_PAGE_1" x=0 y=0  width=22 height=22  hidden=true  capturemouseclicks=false > 
<UIText name="Title" text="The Footmen are a defensive backbone of the  Rock orden forces. They can sustain attacks while other  Rock units manoeuvre to destroy the enemy" x=0 y=0 width=22 height=22 align=center fontfamily="Special_Font" style=4 />
</UIPane>

</UIPane>
	

<!--  BUY UNITS two -->
<UIPane  name="CONTAINER2" x=0 y=355  width=536 height=355   capturemouseclicks=false > 

<UIButton name="I_1" x=6 y=270 text="I"  style="STYLE_SMALL_TAB" width=40 height=40  groupid=1 groupmemberid=1
OnSelected=UIButton_Input_ShowObject("INFO_PAGE_1") OnUnselected=UIButton_Input_HideObject("INFO_PAGE_1") />
	
<UIText name="NumBox" x=215 y=270 fontfamily="Body_Font" width=80 height=80 update=true OnUpdate=UIObject_Misc_SetLocalVarString(0)/>

	<UIFrame name="NumFrame" x=215 y=270 width=80 height=80 topleft="tp_frame_tl.tga" topright="tp_frame_tr.tga" 
	bottomleft="tp_frame_bl.tga" bottomright="tp_frame_BR.tga" top="tp_frame_t.tga" bottom="tp_frame_b.tga" left="tp_frame_l.tga" 
	right="tp_frame_r.tga" fillstyle="stretch" fill="tp_frame_bg.tga" border=3 />	

	<UIButton name="INFO" x=294 y=268 text="-" style="STYLE_MENU_BUTTON" width=40 height=40 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_new_pen")>
	</UIButton>
	<UIButton name="INFO" x=294 y=310 text="+" style="STYLE_MENU_BUTTON" width=40 height=40 OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_new_pen")>
	</UIButton>
		<!-- NUMBER TEXT - TITLE, VIEW BOX & FRAME -->
 <UIPane  name="INFO_PAGE_1" x=0 y=0  width=22 height=22  hidden=true  capturemouseclicks=false > 
<UIText name="Title" text="The Footmen are a defensive backbone of the  Rock orden forces. They can sustain attacks while other  Rock units manoeuvre to destroy the enemy" x=0 y=0 width=22 height=22 align=center fontfamily="Special_Font" style=4 />
</UIPane>

</UIPane>
	





	




</UIPane>


<! -- START THE SECOND PAGE -->

<UIPane name="SECOND_PAGE" x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT hidden=true capturemouseclicks=false>



<UIButton name="BUILD1" x=351 y=0 style="STYLE_MENU_BUTTON" width=176 height=40 OnLeftClick=UIObject_Misc_ExecuteServerScript("new_pen_gui_hudhelm","1")>
	</UIButton>


</UIPane>



<! -- START THE THIRD PAGE -->


<UIPane name="THIRD_PAGE" x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT hidden=true capturemouseclicks=false>



</UIPane>









	<UIFrame x=0 y=0 width=PARENT_WIDTH height=PARENT_HEIGHT topleft="frame1_tl.tga" topright="frame1_tr.tga" bottomleft="frame1_bl.tga"
		bottomright="frame1_BR.tga" top="frame1_t.tga" bottom="frame1_b.tga"
		left="frame1_l.tga" right="frame1_r.tga" border=32 />	

	<UIFrame x=8 y=8 width=536 height=1080 fillstyle="tile" fill="ui_back_cust1.tga"/>	





question: how to set a delay on a button?solved_mini
not very convenient (sometimes slow, sometimes too fast, but I’ll leave this thing / although right now I’ve balanced the speed a little). I’ll also make keyboard shortcuts for convenience, they will be more convenient, but all this is situational.calculator and price.
P.s Lance_Botelle thanks for tutorial and buttons

1 Like

it remains to make tabs for units, and make a price counter (it is almost ready).
is only 1 tab - I’m moving very slowly… :sleeping:.
Well, I’ll definitely finish by the new year!!! :joy:

1 Like

@lord_XD

XML always takes me a long time too. It requires a lot of trial and error before getting right. But, the more you practice, the better you’ll get at it. :+1:

@lord_XD

I have not tried this - if you do, let me know. :smiley: Having said that, I’m not sure the xml handles this type of image file.

I also do this as a hobby, as most of us here. Or, for me it’s become more of an addiction. :melting_face: :wink:
I would recommend you checking out the NWN2 Creator Discord Channel for your second module. If you have an interesting idea you might get people on board there to help you possibly. As long as you ask kindly, people are very friendly and helpful there, just like here. The chat on Discord is so much better than the PM system or Thread system here. A lot quicker.

1 Like

the animation does not work (if I manage to find out something, I’ll write. But in general it’s possible, at least because there is a loading bar)

questions again.
how to change font size??

@lord_XD

Add your own font via fontfamily.xml and use that. (Make sure it is in custom UI.)

Example from my own … but you may be limited - I have not tested limits.,

<!------------------------------------------- CUSTOM FONT ADDITIONS ------------------------------------------------------------>
	
	<!-- This is the font used by My "BIG" Read Book mod, by Lance Botelle -->

	<UIFontFamily name="Read_Book_Big" >
		<UIFontNormal		font="ui\\default\\fonts\\NWN2_Main.ttf"	pointsize=24 dropshadows=false outline=false />
		<UIFontBold		font="ui\\default\\fonts\\NWN2_MainB.ttf"	pointsize=24 dropshadows=false outline=false />
		<UIFontItalic		font="ui\\default\\fonts\\NWN2_MainI.ttf"	pointsize=24 dropshadows=false outline=false />
		<UIFontBoldItalic	font="ui\\default\\fonts\\NWN2_MainB.ttf"	pointsize=23 dropshadows=false outline=true />
	</UIFontFamily>
2 Likes

Lance_Botelle
Thanks , I’ll try it now

I couldn’t connect. I’m probably doing something wrong, however, I found another way.

@lord_XD

So, what did you end up doing then?

I was going to suggest using an image background with the texts already in place if you had no joy with the fontfamily.xml approach.

you misunderstood me. connecting the font is a good idea.

but for some reason I can’t do it, is it really not clear?
(something is wrong with the path and property of the font. (not displayed) but I solved the problem by simply setting fontfamily=“Special_Font” style=“4” .)

you can tell me if you want- Since sometimes the default font annoys me (preferably a file with an example and what to put where or describe in more detail)
I put the arial font in the folder with the game, where the default fonts are
but didn’t notice any result.
and connected it like

<UIFontBold font="ui\\default\\fonts\\ariblk.ttf" pointsize=24 dropshadows=false outline=false />
<UIText name="Costs" x=370 y=206 text="40000000" fontfamily="FontBold" width=200 height=60 update=true OnUpdate=UIObject_Misc_SetLocalVarString(local:1)/>
or
<UIText name="Costs" x=370 y=206 text="40000000" fontfamily="Arial" width=200 height=60 update=true OnUpdate=UIObject_Misc_SetLocalVarString(local:1)/>

but it doesn’t work