Journal Entry Collapsable Callback?

Does anyone know how to get an XML callback somewhere in the xml code when we collapse or expand a journal entry?

Or (perhaps better still), does anyone know how to insert some xml that allows a journal entry to be clicked on and its entry recognised in a callback?

My guess is that it has to be somewhere in this bit … if possible.

(Extract from journal.xml)

<UIListbox name="JournalEntryList" x=1 y=47 width=332 height=320 yPadding=2  
		showpartialchild=true scrollbaronright=true unequalcontrols=true scrollsegmentsize=32
		update=true OnUpdate=UIObject_OnUpdate_GetJournalEntries() >
			<UICollapsable prototype=true name="JournalCollapsable" x=0 y=0 height=PARENT_HEIGHT width=299 isexpanded=true 
			yPadding=1 xPadding=5 >
				<UIButton name="PROTO_HEADER" x=0 y=0 height=44 width=299 header=true >
					<UIText indent=18 hangingindent=18 align=left valign=middle fontfamily="Default" style=2 uppercase=true prototype=true maxlines=2 />
					<UIFrame state=up			fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=down			fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=hilited		fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=focused		fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=hifocus		fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=disabled		fill="b_qjd_hover_pressed.tga" />
					<UIFrame state=header		fill="b_qjd_normal.tga" />
					<UIFrame state=hiheader		fill="b_qjd_normal.tga" />
					<UIFrame state=downheader	fill="b_qjd_normal.tga" />
				</UIButton>
				<UIText name="PROTO_TEXT" x=0 y=0 width=299 height=DYNAMIC prototype=true align=left valign=top multiline=true color="312A0A"
				fontfamily="NWN1_Dialog" style="bold" />
			</UICollapsable>

			<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>	
		</UIListbox>

I have managed to get some feedback, but I am unable to extract data as I hoped. This is probably just me, but does anyone know what to use with the following “UIObject_Misc_ExtractData”…

OnMouseEnter0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)	
OnMouseEnter1=UIObject_Misc_ExecuteServerScript("gui_journalnotes","GIVEDATA",local:0)

I added this to the button as follows …

<UIButton name="PROTO_HEADER" x=0 y=0 height=44 width=299 header=true
OnMouseEnter0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)
OnMouseEnter1=UIObject_Misc_ExecuteServerScript("gui_journalnotes","GIVEDATA",local:0)>

But at the moment the data is nothing specific. (Just the module.)

Quite frankly, I don’t know if “self:” is referring to the button called “PROTO_HEADER” or to the listbox “JournalEntryList” (though I believe it’s the button). What I know however is that the variable local(0) will be a string containing the internal reference of objectid(0), whatever that is in the xml.

Did you try UIObject_Misc_ExtractData("selected:JournalEntryList","string",0,local:0)?
Not sure if the data type is a string, and its index is 0, but I understand that in that case local(0) will contain the selected row within the list box (but here I don’t know if it’s the quest name or the entry itself - sorry, you’ll have to check :wink: )
However, if I understand correctly what you’re after, maybe it’s simpler to just use
OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_journalnotes","GIVEDATA",listboxrow:JournalEntryList)
(as per New UI Callback Parameters - Neverwinter Nights 2 Blog - Obsidian Forum Community)

@4760

Yes, I have read that info many times already and am still not much wiser with respect to the extract command. :frowning:

Yes. This and many other combinations, even with diff variables (0-5). :slight_smile: The only data I ever got back was the module. :frowning:

I will give that a go!

Thanks! (I will let you know if that worked.)

EDIT: Unfortunately, I got nothing at all trying to send the data directly like this. So, it must require the extract data command, but I am beginning to wonder if the data is not retrievable from the GUI.

UPDATE: I now managed to get the “module” data returned (again) on a left click using this method, if I used the UIObject_Misc_ExtractData prior to calling the line. Still no individual journal indicators though. :frowning:

It’s true that the information regarding these commands is not very clear (at least for me!)
If you get the module itself, it could be that the Object_ID index is not high enough? When I test your instant spell code, I’ll test some more things with the UIObject_Misc_ExtractData command :wink:

@4760

Thanks!

I feel like we are missing potential variable names/numbers to get at what we need sometimes. But, I would have thought the journal GUI would have some variable references we could extract for each list object somewhere.

Let me know if you succeed - and I will keep trying now and then. Perhaps @kevL_s has one of his special tools that could dissect the info we might need. :innocent:

@Lance no it seems to me all the GUI-functions and related stuff is ‘concealed’ within the hardcoded nwn2 executable. If it were written in c# they would be relatively easy to get at, but I believe the .exe is c/c++

I haven’t done much at all (anything?) with UIObject_Misc_ExtractData()

here’s the xml files (in my nwn2 setup) that use the funct:

nx2_caravan
nx2_market
nx2_ol_partybar
nx2_shipping
nx2_storage
contextmenu
partychat_ol
portrait_change

if you want a look at them,

2 Likes

@kevL_s

Thanks for coming back to me. Yes, I have that link and tried to get as much from it as I could already, but it’s very difficult.

Good point about looking through the OC xmls for extra info … I will take a look at those you list to see if I find anything else then! :+1:

1 Like

@Lance_Botelle, I looked at the full “journal.xml” file, and I believe what you’re looking for is in the second listbox, at the bottom:

	<UIPane name="NOTES_PAGE" x=34 y=84 width=336 height=368 hidden=true >
		<UIListBox name="NOTES_LISTBOX" x=1 y=47 width=332 height=320 showpartialchild=true
			unequalcontrols=true scrollsegmentsize=30 hidescrollbarwhennotneeded=false >
			<UIText name="NOTES_FIELD" width=PARENT_WIDTH height=DYNAMIC align=left valign=top multiline=true color="black" fontfamily="NWN1_Dialog" style="bold" clearonescape="false"
			editable=true selectable=true maxlength=16384 allowspace="true" />
			<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>	
		</UIListBox>	
	</UIPane>

If I’m right, the quests are listed in “NOTES_LISTBOX” and the journal entries are in “NOTES_FIELD”. Therefore, to get the text of the entry from the selected quest, you should probably call
OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_journalnotes","GIVEDATA",listboxtext:NOTES_LISTBOX.NOTES_FIELD)

If that doesn’t work, please try another time but after having put the “selectonleftclick=true” attribute on the UIListbox

1 Like

@4760

Thanks for this. I will be sure to test it tomorrow!

If it works for the idea I have in mind, it will be really helpful. :+1:

I’ll be sure to let you know.

@4760

I just checked that section of xml and that affects the NOTES section only … so, I do think its the section of XML I am looking at. But thanks for looking!

“NOTES_PAGE”

Check this TAB instruction … which directs to that section of xml.

<UIButton name="SHOW_NOTES" x=286 y=43 style="STYLE_SMALL_TAB" strref="63498" buttontype=radio groupid=1 groupmemberid=3
		OnSelected=UIButton_Input_SetJournalPage("NOTES_PAGE","PAGE_NOTES") OnUnselected=UIButton_Input_HideObject("NOTES_PAGE") >
	</UIButton>
1 Like

@Lance_Botelle you’re right.

What do you get with
OnLeftClick=UIObject_Misc_ExecuteServerScript("gui_journalnotes","GIVEDATA",listboxtext:JournalEntryList.PROTO_TEXT)?

As you have surely guessed by now, I’m also trying to understand how it works! :wink:

@4760

Sadly, I still have nothing returned … (zero for module at best).

I may try rewriting the xml from scratch to see if I can do away with the collapsible element altogether, as I think that is what is causing the issue … possibly? It all depends how they hard code the journal info reaching the GUI in the first place.

I mean in my own additions, I use UIPane to encase certain UIListBox elements, which then appear to give me data feedback, but I get nothing from this at the moment. But one would imagine they must be embedded somewhere. :thinking:

@kevL_s

I went through those OC xml and they do follow the pattern I was using. I think my problem is I don’t know where or how (if any) the variables are stored on the GUI. I note that some of these GUIs give some refs for the variables they have used, but I cannot find any info on journal GUI variables.

my opinion is that the proto ‘auto-iterate’ routine makes elements much less workable for us than gui-elements usually are.

ya. Too many undocumented unknowns + permutations …

@kevL_s

Definitely … and I tried winging around the proto elements, but it broke the GUI completely. So, I am trying to think of a way around the issue.

Here’s my issue that was annoying me and wanted to resolve, but is turning out more trouble than worth …

I like to give players updated journal entries with additional info, like you have found 3/4 items you need. Furthermore, I add this minor quick ref detail to the journal name so it’s easy to see and reference. I use TOKENS to store this info and update as required. The problem is, TOKENS do not like changing when already “baked” into a journal entry, so you have to remove the entry, update the token and give the entry back. This results in two journal updates spammed to the chat widow, which looks untidy and unnecessary.

So, my idea was to move this additional info to a small “current ref” GUI that could be updated separately and displayed as required by clicking on a journal entry in the journal.

First I tried to stop the chat feedback completely … could not do it.
Next, I tried this GUI approach, but cannot get the callback to work.

So, any ideas on a workable system?

I am edging towards adding my own single button to bring up my own list of journal entries that can be “monitored” as a small in-game GUI. But that feels like overkill!

honestly sounds like a decent idea. Any solution, I believe, is gonna be … extensive

suggestion: sleep on it and maybe the OCD will pass …

1 Like

This is already many nights down the line. :wink:

But I get your point … must try to ignore … nope, can’t do that yet. :exploding_head:

Probably going to be this … Box can toggle display or not.

And closed …

2 Likes

That’s neat. Much better than the journal, when player is focused on collecting items to complete a particular quest.

@kevL_s

Thanks!

I am also going to add a right click function to the button to change the background type while open, so it is this style, perhaps a black smudge style and finally a no background (just text) style.

As you say, it’s more immediately accessible this way and I can now remove all those TOKEN points of code that annoyed me. It’s a fair amount of messing around, but I reckon the end result will be worth it. I was also going to have the button have a slight blue glow when it contains active tasks (worth opening).

UPDATE: Choice of TASK BOX background added: As imaged, with black smudge or just plain text. And icon indication when task list available added.

1 Like