[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
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: [WIP] GrimTK GUI Framework

Post by Duncan1246 »

JohnWordsworth wrote:GrimTK GUI Alpha 007 Released.

Release Notes
Hi John,
After my first juicy experience in GrimTK in ORR3, I decided to use it in my mod. I have already fw, so I read carefully the readme of GrimTK07 and I add this in my init.lua:
SpoilerShow

Code: Select all

import "mod_assets/grimtk/init.lua"
defineObject{
   name = "party",
   baseObject = "party",
   components = {
        fw_addHooks{
            class = "Party",
		onDrawGui = function(party, g)
				
			end,
		onRest = function(party)
			if ( findEntity("GTK") ) then
				if ( GTK.Core.GUI:isPartyLocked() ) then
					return false;
				end
			end			
		end,
		onWakeUp = function(party)
			if ( findEntity("GTK") ) then
				if ( GTK.Core.GUI:isPartyLocked() ) then
					return false;
				end
			end
		end
        },
   },
}
Hi John,
I have installed now GrimTK 8, and I have the same problem: any call to GTK.GUI falls, particularly "GTKGui.Dialogue.startDialogue".
I don't understand where is the problem, even in comparing my mod with ORR3 where the gui works well.
Can you help me?
Duncan
Last edited by Duncan1246 on Fri Sep 04, 2015 12:52 pm, edited 3 times in total.
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
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 »

John,

just to let you know I am using this feature in my mod now, and thanking you a lot for creating and sharing. :)
A trip of a thousand leagues starts with a step.
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 »

hmmmm, there seems to be a debug window somewhere, but I can't make it appear i, the editor. Any tip please ?
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 »

Hey CromCrom, great to hear you're using the GTK. Let me know how you get on :).

In other news - I have added a few updates and released GTK Alpha 008.
  • Can now call GTKGui.Dialogue.showDialoguePage(<page_name>) to jump to a page in the current dialogue.
  • Dialogue response onSelect callbacks can also return a page_name to jump straight to that page.
  • Added a basic shopkeeper example where you can buy items using a dialogue.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
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 »

Thank you, I am doing the finishing touches for my revamped crafting system, using GrimTK. I will be done soon, and will post pictures, and maybe a short tut video. However, I am stuck trying to "dynamically" change the text inside labels, for the "GPushButton" widget.
I could probably create two buttons on the same place, and make one appear and the other disappear, but well...
Any help please ?
A trip of a thousand leagues starts with a step.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: [WIP] GrimTK GUI Framework

Post by Drakkan »

intro / ending cinematics update pleeeease ? :)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: [WIP] GrimTK GUI Framework

Post by THOM »

...and the writable notebook!


(poor John - he has not enough to do with Grimrock-things these days... :mrgreen: )
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
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 »

Here John, thank you again, and again, and again, and.... ^^

viewtopic.php?f=23&t=8469&start=20#p97442
A trip of a thousand leagues starts with a step.
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 »

Help please,
is there a way to dynamically change text inside labels ?
My button definition is that:

Code: Select all

			{
				type = "GPushButton",
				position = {200, 450},
				size = {400, 20},
				name = "launchCrafting",
				label = {
					padding = {1, 1, 1, 1},
					text = "LAUNCH CRAFTING (or not)",
					font = GTK.Constants.Fonts.Large,
					textAlign = GTK.Constants.TextAlign.Center,				
				},
				onPressed = self.go.id .. ".script.craftItem"
			},
but this:

Code: Select all

	if launchCraftBool then 
		launchCrafting.data.textColor = {51,204,0,255}
		launchCrafting.data.text = "Launch crafting"
	else
		launchCrafting.data.textColor = {204,0,51,255}
		launchCrafting.data.text = "CAN'T CRAFT"	
	end
has no effect on the button text.
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 »

In order to change the text on a label you first have to get the label's data structure from the window. When you create the window, you can either keep a reference to that window around but assuming you have no information at all, you can do the following...

Code: Select all

local window = GTK.Core.GUI:getWindow("window_name");

if window then
	local label = window:findChild("launchCrafting")

 	if label then 
		label.data.text = "NEW TEXT"
	end
end
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Post Reply