[WIP] GrimTK GUI Framework

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: [WIP] GrimTK GUI Framework

Post by cromcrom »

Is there a way to not make the UI "transparent" ? When I click on a button, if there is an item "behind" (say, for example, on an alcove), it will grab that item. Leading to a "bug", if the clicked button should destroy that alcove item. (I encountered this problem quite a lot of times before figuring out. :oops: )
I could probably write a bugproof function (if mouseItem then return) of some sort, but well.
If anybody has a tip, most welcome. Thanks.
A trip of a thousand leagues starts with a step.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: [WIP] GrimTK GUI Framework

Post by JohnWordsworth »

Hmm, I hit this problem the other day with the ORRR3. I have yet to solve the issue (not that I've tried for long), but will have a think about it and post a solution. I'm hoping that a button will block mouse input to the game world, and then I could just place a big button behind every window automatically. Failing that, we might need to disable any surfaces / clickable entities in the spaces around the player and then re-enable them later.

Will ponder and get back to you!

Other news about GrimTK - I'm working on a crafting system for the ORRR3 which will come bundled with GrimTK. It's very similar in style to Skyrim - Select Category -> Select Item -> Click Build.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: [WIP] GrimTK GUI Framework

Post by akroma222 »

cromcrom wrote:Is there a way to not make the UI "transparent" ? When I click on a button, if there is an item "behind" (say, for example, on an alcove), it will grab that item. Leading to a "bug", if the clicked button should destroy that alcove item. (I encountered this problem quite a lot of times before figuring out. :oops: )
I could probably write a bugproof function (if mouseItem then return) of some sort, but well.
If anybody has a tip, most welcome. Thanks.
Cromcrom & john,
Last post here was from November - you guys may have found solutions to the 'transparent' UI - being able to interact with objects, pick up and throw items through the UI etc
I have also encountered logistical issues with this while creating my picklocking system, Question - do we have a solution to this??
If not, here is how I have hacked around it (correct me if there is a better way pls)

My system requires you to keep pick locks in the mouse cursor through out the picklocking process - so I needed to move my UI buttons into areas of the screen that you cant throw or place items into
If you click on the clickable area of the chest through the Champ Select menu - then it just takes you back to the Main Menu anyways
These are the positions of the spawned UI menus
SpoilerShow
Image
If I drag the Champ select menu to the side...... You can see the Champion buttons have default positions over an area (yellow shading) in front of the chest where you can not pick up or drop items (because of the chest)- I also reduced the clickable area (green box) for the lock
SpoilerShow
Image
So, that is my dodgey, hacky solution....
Also, I have written some functions to make sure you cant pick up items while UI menus are activated....

Place in a script called guiExpScript
SpoilerShow

Code: Select all

                          --place all names of menus you are using in this table

guiWindows = {"gtk-select-menu-small", "gtk_info_message", "log2-messagebox-champSelect", "gtk-info-message-box", "log2-messagebox-large", "log2-messagebox-small",
			"gtk-select-menu-option", "gtk-select-menu", "log2-textinputbox", "gtk_text_input"}		
			
function getGuiWindows()           --check if any of the windows in the table are currently spawned	
	for i = 1,#guiWindows do
		local name = guiWindows[i]
		local winList = GTK.Core.GUI:getWindow(name)
		if winList then
			return true	
		else
			return false
		end
	end
end
Then place this in your - onPickUpItem hook
SpoilerShow

Code: Select all

onPickUpItem = function(self, item)
			
			if guiExpScript.script.getGuiWindows() then
				
				return false	
				
			end
If there have been any newer, better solutions or developments here, pls let me know.
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: [WIP] GrimTK GUI Framework

Post by THOM »

Can anyone help me, how to lock the party while a messagebox or a selectmenue is open?

I had a look into the examples and for a dialogue there is this:

Code: Select all

	local dialogue = {
		lockParty = true,
		pages = {... ... ...
But I cannot find out IF ther is a way, to put this also into messageboxes/selectmenues, and if WHERE to put.

Has anyone an idea?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Echoplex
Posts: 63
Joined: Tue Nov 04, 2014 10:59 pm

Re: [WIP] GrimTK GUI Framework

Post by Echoplex »

What is the mod directory path the pictures that are used in the dialogue scripts should be placed in when uploading the mod to say steam? I'm able to pull them into the dialogue via the editor no problem however once uploaded to steam it results in a crash when triggered. I'm guessing just like the custom portraits being uploaded there is a very specific location and format that needs to be used so it will upload properly. Portraits needed to be 128x128 dds format and placed in the mod_assets/textures/portraits folder. Those work fine. The pictures in question for the dialogue are dds format and 192x192 and do not display when triggered in the dialogue scripts once published. Again they do work inside the editor.

Code: Select all

function gtkDidLoad()
	GTK.Core.GUI:addImage({ name="davion", path="mod_assets/ext/grimtk/samples/davion.tga", size={192, 192} });
end

isDone = false;

function showIntroDialogue(sender)
	if ( isDone == true ) then
		return;
	end

	local dialogue = {
		lockParty = true,
		pages = {
			{
				id = "page1",
				mainImage = "davion",
				mainMessage = "Spoilers",
				speakerMessage = "Yysara:",
				responses = {
					{ text = "Spoilers", nextPage = "page2" },	
				} 
			},
			{
				id = "page2",
				mainImage = "davion",
				mainMessage = "Spoilers,
				speakerMessage = "Yysara",
				responses = {
					{ text = "Spoilers", nextPage = "page3" },
				}
			},	
			{
				id = "page3",
				mainImage = "davion",
				mainMessage = "Spoilers",
				speakerMessage = "Yysara",
				responses = {
					{ text = "<Spoilers.>"},
				}
			}
		}
	}

	GTKGui.Dialogue.startDialogue(dialogue);
end

function hideDemoDialogue()
	GTKGui.Dialogue.hideDialogue();
	end
	
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: [WIP] GrimTK GUI Framework

Post by minmay »

Only files that are somewhere in the mod_assets directory, and whose filenames end in .dds, .lua, .model, .animation, .wav, .ogg, or .ivf, will be exported. If you are trying to use files that actually end in .tga or .DDS instead of .dds, they won't work, even if they're actually dds files, because the game only checks the extension when exporting.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Echoplex
Posts: 63
Joined: Tue Nov 04, 2014 10:59 pm

Re: [WIP] GrimTK GUI Framework

Post by Echoplex »

The files are in dds format and have the dds extension and are not importing over. I'm suspecting that they need to be in a specific directory for the import just as the portraits do. Im not sure if this is a steam only problem or not.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: [WIP] GrimTK GUI Framework

Post by minmay »

Can you at least provide the error message and console output for the crash?
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Echoplex
Posts: 63
Joined: Tue Nov 04, 2014 10:59 pm

Re: [WIP] GrimTK GUI Framework

Post by Echoplex »

I don't receive an error message it just crashes to desktop. Where would I capture such a message to report back?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: [WIP] GrimTK GUI Framework

Post by minmay »

Run the Grimrock 2 executable file from the command prompt (Windows) or a terminal (Mac OS).
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply