[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
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: [WIP] GrimTK GUI Framework

Post by JohnWordsworth »

JKos. If I recall correctly, your GUI framework for LOG1 had an "autoexec" mechanism for calling a function from each script entity. Do you have this in the new framework? If so, I can add an autoexec to install the GrimTK methods automatically when using the framework :).
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Slade
Posts: 36
Joined: Tue Oct 21, 2014 6:31 pm

Re: [WIP] GrimTK GUI Framework

Post by Slade »

Hello, why that sample map keep crashing when i step at the first pressurre plate? And same thing when i tried to GTKGui.Basic.showInfoMessage("blaa"); to my own map.. what im doing wrong? Installed it like readme said. Im a complete noob at lua and everyting but trying hard...so srry :)
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 »

Hi Slade. Are you running the latest beta version of Grimrock 2? The latest version of the toolkit only works with 2.2.4 - which is only available through Steam at the moment. If you are not running the Beta, and do not have the Steam version - you can download Alpha 005 for now and then upgrade when the Beta is made public!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Slade
Posts: 36
Joined: Tue Oct 21, 2014 6:31 pm

Re: [WIP] GrimTK GUI Framework

Post by Slade »

Oh, my version is 2.1.18 apparently, so where i can download that on steam?(why i cant find it) Thanks for the answer btw :)
Last edited by Slade on Tue Mar 03, 2015 10:17 pm, edited 1 time in total.
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: [WIP] GrimTK GUI Framework

Post by Zo Kath Ra »

Slade wrote:Oh, my version is 2.1.18 apparently, so where i can download that on steam?(why i cant find it) Thanks for the answer :)
viewtopic.php?f=18&t=8168&p=82749#p82749
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: [WIP] GrimTK GUI Framework

Post by JKos »

@AdrTru:
Oh, right, now I understand what the problem is, the onDrawGui-connector of the grimtk doesn't get called if the party.onDrawGui-hook isn't defined.
This can be fixed by defining a dummy onDrawGui-hook like this in your party-object definition:

Code: Select all

defineObject{
   name = "party",
   baseObject = "party",
   components = {
		fw_addHooks{
			class = "Party",
			onDrawGui = function(party,g) 
				--Dummy hook for enabling onDrawGui-connectors
			end
		}
	}
}
Defining onDrawGui with hook-framework doesn't really differ from native in any way (other than that the Party-component definition is inside of a fw_addHooks-function call).
onDrawXXX-hooks aren't passed to hook-framework for performance reasons, and it's not even needed with LoG2 since we can use native connectors if we need add/remove onDraw-hooks at runtime.

@JohnW
autoexec is not a part of the hook-framework, I wanted to keep it as simple as possible. However I made a separate script which implements autoexec viewtopic.php?f=22&t=8132
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
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 »

@Slade...

1. Steam -> Library
2. Right Click "Legend of Grimrock 2" and click "Properties".
3. Go to "Betas" tab.
4. Select "beta - " from the dropdown.

You may need to restart Steam afterwards.

@JKos: Strangely, if there is no onDrawXXX method in the party definition - then you cannot hook into it using party.party:addConnector("onDrawGui", ...). So, I had to define a completely empty onDrawGui hook in the party definition so that I could add a connector for it later.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: [WIP] GrimTK GUI Framework

Post by Drakkan »

JKos wrote:@AdrTru:
Oh, right, now I understand what the problem is, the onDrawGui-connector of the grimtk doesn't get called if the party.onDrawGui-hook isn't defined.
This can be fixed by defining a dummy onDrawGui-hook like this in your party-object definition:

Code: Select all

defineObject{
   name = "party",
   baseObject = "party",
   components = {
		fw_addHooks{
			class = "Party",
			onDrawGui = function(party,g) 
				--Dummy hook for enabling onDrawGui-connectors
			end
		}
	}
}
Defining onDrawGui with hook-framework doesn't really differ from native in any way (other than that the Party-component definition is inside of a fw_addHooks-function call).
onDrawXXX-hooks aren't passed to hook-framework for performance reasons, and it's not even needed with LoG2 since we can use native connectors if we need add/remove onDraw-hooks at runtime.

@JohnW
autoexec is not a part of the hook-framework, I wanted to keep it as simple as possible. However I made a separate script which implements autoexec viewtopic.php?f=22&t=8132
JKos could be there some collide problem between John GUI and your party hiring GUI ? Just asking, cause I still have John GUI dialogues screwed sometimes :/
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: [WIP] GrimTK GUI Framework

Post by JKos »

I don't think that it's possible, they don't share same variables or anything, so I can not see how they could interfere with each others.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Slade
Posts: 36
Joined: Tue Oct 21, 2014 6:31 pm

Re: [WIP] GrimTK GUI Framework

Post by Slade »

Cool, thanks dudes! Now it works..learned something new about steam too :P This is everything that i could ask for a mod! I appreciate your work very much John! And one more question.. : Can you activate that dialog with mouse click?(edit i guess with that npc mod.. need to try out)
Post Reply