XML related question (probably)

I wish I didn’t have to do this but the Toolset and NWN2 forced me to. I’m working on a puzzle that has to do with rows of letters “stacked on top of each other” (or how to say that in english). I thought it would be easy, but as it turned out, in the game every letter won’t show properly above on another when using dialogue or showing letters as a description of an item. So, I realized I probably have to do some xml stuff, which I hate since I find it very confusing. I tried reading some of Lance’s stuff for this thing before but…

What I want/need to do is: Just show a picture in the game inside a box/square where there’s an X in the corner so you can close the square/box. Is there an easy way to do this? Has anyone done this already? If so, does anyone have a template to share? I so wish that I didn’t have to spend hours trying to learn how to code xml files just for this one thing.

EDIT: Here’s a picture to better show what I mean by the letters not aligning. I want/need rows of letters that match both vertically and horizontally

letters

2 Likes

hey andgalf,
since i’ve had my head stuck in XML for the past week
ill whip something up

question: how many columns and how many rows?

Thanks, kevL_s! I’ve actually got it almost working already. I checked my second module where Aqvilinus had done some custom xml for me, looked at that and tried to reverse engineer it, and totally unbelievably it actually showed up ingame. :astonished:

So this is my xml code at the moment:

<?xml version="1.0" encoding="utf-8"?>

<UIScene name="door_riddle" width="400" height="639" x="ALIGN_CENTER" y="ALIGN_CENTER" scriptloadable="true"
capturemouseevents="true" capturemouseclicks="true" ignoreevents="false" focusable="true" draggable="true"
fadein="0.1" fadeout="0.1" priority="SCENE_SCRIPT" update="false" />

    <UIIcon name="DOORRIDDLE_IM" width="PARENT_WIDTH" height="PARENT_HEIGHT" x="0" y="0" img="doorriddle.tga"
    capturemouseevents="false" capturemouseclicks="false" ignoreevents="true" focusable="false" draggable="false" />

and the simple script I made (also based on what I saw Aqvilinus had done for me):

void main()
{
	object oPC = GetFirstPC();
	
	DisplayGuiScreen(oPC, "DOOR_RIDDLE", FALSE, "DOOR_RIDDLE.xml");
	
}

I’ve “stolen” this riddle from D&D Door Puzzles: A Designer's Guide (with free puzzles) but they wrote there they were totally fine with that, as long as you linked to their website. So here’s my picture (I edited the one on the website somewhat):

Ingame the picture is moveable now, which I really like. It would be nice though if there was some kind of frame around it and an “X” to close the whole window.

1 Like

Alright. I’m making some progress. Skimming through Lance’s tutorial I managed to come up with this so far:

<?xml version="1.0" encoding="utf-8"?>

<UIScene name="door_riddle" width="400" height="639" x="ALIGN_CENTER" y="ALIGN_CENTER" scriptloadable="true"
capturemouseevents="true" capturemouseclicks="true" ignoreevents="false" focusable="true" draggable="true"
fadein="0.1" fadeout="0.1" priority="SCENE_SCRIPT" update="false" />

    <UIButton name="CloseButton" x=350 y=20 style="STYLE_CLOSE_BUTTON" OnLeftClick=UIButton_Input_ScreenClose() /> 
    <UIIcon name="DOORRIDDLE_IM" width="400" height="639" x="0" y="0" img="doorriddle.tga"
    capturemouseevents="false" capturemouseclicks="false" ignoreevents="true" focusable="false" draggable="false" />

here’s what I have so far … will look at Aqvi’s xml also … yep it needs a border

that looks pretty good :)
Are those stock graphics?
can you post the xml for it, and ill tweak it

1 Like

Nice. The graphics is “stolen” directly from the website. The only thing I’ve done is changing some of the letters. That was quite easy through just copy and paste in Gimp.

XML is in the post above.

ok, so the image will be static ? it all just needs a border ?

Precisely. I wanted something really simple.

Didn’t want graphics at all to begin with, but I have to say, the riddle gets to be a bit clearer and easier when there’s a graphical presentation.

pls post “doorriddle.tga” to this thread …

Eh…I tried but it won’t let me.

oh convert it to png

https://drive.google.com/file/d/1g93DfmRMLTuDhrCzIplTEmCkbBRz11ce/view?usp=sharing

There you go.

got it :slight_smile:

1 Like

Odd…I tried adding a border by reading Lance’s code but it doesn’t work. Maybe those tga files he refers to is his own?

<?xml version="1.0" encoding="utf-8"?>

<UIScene name="door_riddle" width="400" height="639" x="ALIGN_CENTER" y="ALIGN_CENTER" scriptloadable="true"
capturemouseevents="true" capturemouseclicks="true" ignoreevents="false" focusable="true" draggable="true"
fadein="0.1" fadeout="0.1" priority="SCENE_SCRIPT" update="false" />

  
    <UIButton name="CloseButton" x=380 y=10 style="STYLE_CLOSE_BUTTON" OnLeftClick=UIButton_Input_ScreenClose() /> 
    <UIIcon name="DOORRIDDLE_IM" width="400" height="639" x="0" y="0" img="doorriddle.tga"
    capturemouseevents="false" capturemouseclicks="false" ignoreevents="true" focusable="false" draggable="false" />
    <UIFrame width="400" height="639" 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"
    left="tp_frame_l.tga" right="tp_frame_r.tga" border=5/>

EDIT: Found on NWN2Wiki that I must have some UIPane too apparently. On it…

<?xml version="1.0" encoding="utf-8"?>

<UIScene name="SCREEN_DOOR_RIDDLE" x="ALIGN_CENTER" y="ALIGN_CENTER" width="460" height="699" scriptloadable="true"
capturemouseevents="true" capturemouseclicks="true" ignoreevents="false" focusable="true" draggable="true" backoutkey="true" idleexpiretime="0.1"
fadein="0.1" fadeout="0.1" priority="SCENE_SCRIPT" update="false" />
<!-- priority="SCENE_INGAME" -->

	<UIButton name="CloseButton" x="402" y="30" style="STYLE_CLOSE_BUTTON"
	OnLeftClick='UIButton_Input_ScreenClose()' />

	<UIIcon name="DOORRIDDLE_IM" x="30" y="30" width="400" height="639" img="doorriddle.tga"
	capturemouseevents="false" capturemouseclicks="false" ignoreevents="true" focusable="false" draggable="false" />

	<UIIcon name="DOORRIDDLE_BG" x="8" y="7" width="444" height="685" img="idesc_paper_bg.tga" />

	<UIFrame x="0" y="0" width="PARENT_WIDTH" height="PARENT_HEIGHT" border="30"
	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" />

note i changed the name of the UIScene –

1 Like

those .tgas are standard. But i think you have them hidden behind the image. Increase the size of the entire scene, etc etc

Quite nice. I do think the border is a bit thick though. Trying to see if I can change that…

i think so too. There’s a paper background showing between the border and the image … not sure if it should be 1 or a few pixels or there at all (im no artist). Also, the paper shouldn’t be overlapping the bottom and right borders like it is in the screenshot above.

No luck fixing my own so far. I’ll try yours then. By the way, why did you change the name of the UIScene?

because it was lowercase in your XML but uppercase in your script … and UIScene names usually start with “SCREEN_”

just policy … I like case invariance and label conformity … /shrug

 

<?xml version="1.0" encoding="utf-8"?>

<UIScene name="SCREEN_DOOR_RIDDLE" x="ALIGN_CENTER" y="ALIGN_CENTER" width="415" height="653" scriptloadable="true"
capturemouseevents="true" capturemouseclicks="true" ignoreevents="false" focusable="true" draggable="true" backoutkey="true" idleexpiretime="0.1"
fadein="0.1" fadeout="0.1" priority="SCENE_SCRIPT" update="false" />
<!-- priority="SCENE_INGAME" -->

	<UIButton name="CloseButton" x="376" y="10" style="STYLE_CLOSE_BUTTON"
	OnLeftClick='UIButton_Input_ScreenClose()' />

	<UIIcon name="DOORRIDDLE_IM" x="8" y="7" width="399" height="638" img="doorriddle.tga"
	capturemouseevents="false" capturemouseclicks="false" ignoreevents="true" focusable="false" draggable="false" />

<!--	<UIIcon name="DOORRIDDLE_BG" x="8" y="7" width="444" height="685" img="solid_black_fill.tga" /> -->

	<UIFrame x="0" y="0" width="PARENT_WIDTH" height="PARENT_HEIGHT" border="30"
	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" />
1 Like