[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!
Cashpwns
Posts: 11
Joined: Tue Oct 11, 2016 4:19 am

Re: [WIP] GrimTK GUI Framework

Post by Cashpwns » Fri Oct 14, 2016 6:03 pm

zimberzimber wrote:I may be wrong, but I assume the reason behind the crashes is in the following segment (inside showDialogue) -

Code: Select all

id = "show_wares",
speakerName = storeKeeperName,
speakerMessage = "I require an item if you wish to pass, I need a new shield, named the Vanguard. Get it for me and you can pass. Its in Zeonguard Cave.",
responses = {
{ text = items.uiName, onSelect=self.go.id..".script.buyItem" },
{ text = "Alright, I will get the shield for you. <Walk Away>" },
{ text = items.uiName, onSelect=self.go.id..".script.buyItem" }, calls the buyItem function, but it doesn't give it any data.
function buyItem(index) expects to receive data, but it doesn't.
Again, I may be wrong.
minmay wrote:I suggest that you review what commas and parentheses mean in Lua. Because this block:

Code: Select all

items = { name="lightning_blade", uiName="Here is the Vanguard.", cost=1
},

function ()countInventoryItem(name)
does NOT do what you wanted it to do. You wanted:

Code: Select all

items = { name="lightning_blade", uiName="Here is the Vanguard.", cost=1
}

function countInventoryItem(name)
Thanks for helping me on this! Both of you were right, I fixed my commas and parentheses, and the buyItem doesnt receive data and the script does not give out any data. Now I just have to find out how to make the script send data, and make myself learn how to not use heavily coded samples.

User avatar
Duncan1246
Posts: 402
Joined: Mon Jan 19, 2015 7:42 pm

Re: [WIP] GrimTK GUI Framework

Post by Duncan1246 » Sun Nov 06, 2016 9:58 pm

I test some scripts to display several texts on screen.
This works well if I use a string in showText, but fails if I do it with a variable with a string value.
EDIT: the issue wasn't due to the string variable itself but apparently to its lenght.
Now I am trying to change the background image, but "no valid image to show" is the only thing I get (image in dds format)
Some help?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?

ColdDeadStone
Posts: 19
Joined: Sat Nov 26, 2016 12:12 pm

Re: [WIP] GrimTK GUI Framework

Post by ColdDeadStone » Sat Nov 26, 2016 12:34 pm

Hello! Guess i found a bug! First, sorry for my English, i try to explain as good as possible. Download "GrimTK Alpha 008-23-0-0-007" and open the Sample Dungeon "GrimTK.dungeon_editor" and then export the Dungeon. Start a new game with the exported dungeon. Go to the "Text Input Section" and save the game! (quicksave for example)

Try to solve the Password. Its Working! Wrong Password do what it should and the Right Password is working too...

BUT if you now LOAD the game and try to click on the "Text Entry Box" to start typing the game crashes! Restarting the game and loading the savegame and trying again make it crash again... So, you cant save the game and still have a working "Text Input Box"!

Heres the Error from the "grimrock.log":

Loading dungeon GrimTK-Alpha-008-Test by John Wordsworth
Game loaded

=== Software Failure ===

mod_assets/ext/grimtk/scripts/gtk/input.lua:280: bad argument #1 to 'keyDown' (string expected, got nil)
stack traceback:
[C]: in function 'error'
[string "ScriptInterface.lua"]: in function 'checkArg'
[string "Gui.lua"]: in function 'keyDown'
mod_assets/ext/grimtk/scripts/gtk/input.lua:280: in function 'isKeyDown'
mod_assets/ext/grimtk/scripts/gtk/input.lua:245: in function 'commit'
mod_assets/ext/grimtk/scripts/gtk/core.lua:847: in function 'update'
mod_assets/ext/grimtk/scripts/hook.lua:2: in function <mod_assets/ext/grimtk/scripts/hook.lua:1>
[string "Script.lua"]: in function 'sendMessage'
[string "Component.lua"]: in function 'triggerConnectors'
[string "Component.lua"]: in function 'callHook'
[string "Gui.lua"]: in function 'draw'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk


Any idea how to fix this? Btw. this also crashes in my own dungeon not only in the sample one!
Thanks for reading!

ColdDeadStone
Posts: 19
Joined: Sat Nov 26, 2016 12:12 pm

Re: [WIP] GrimTK GUI Framework

Post by ColdDeadStone » Sun Nov 27, 2016 7:11 am

Still didnt find a fix for the Problem! But for a quick workaround you can "comment out" line 280 in the input.lua script which looks like this:

--self.current.keys[key] = self._context:keyDown(key);

With this a working "Text Input Box" after Saveing and Loading the game is possible BUT you lose the ability to use your Shift key for Special Characters! and CAPITALS. In my case its not a good solution but if the author cant fix it or nobody else find a way to fix it i have to use it that way, still better than crashing to Desktop.

Alright, thanks for reading and a nice day!

User avatar
Isaac
Posts: 2955
Joined: Fri Mar 02, 2012 10:02 pm

Re: [WIP] GrimTK GUI Framework

Post by Isaac » Sun Nov 27, 2016 7:13 am

ColdDeadStone wrote:Still didnt find a fix for the Problem! But for a quick workaround you can "comment out" line 280 in the input.lua script which looks like this:

--self.current.keys[key] = self._context:keyDown(key);

With this a working "Text Input Box" after Saveing and Loading the game is possible BUT you lose the ability to use your Shift key for Special Characters! and CAPITALS. In my case its not a good solution but if the author cant fix it or nobody else find a way to fix it i have to use it that way, still better than crashing to Desktop.

Alright, thanks for reading and a nice day!
I sent him the link to your post. No word if he's read it yet; but he's still active.

User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: [WIP] GrimTK GUI Framework

Post by Xardas » Wed Aug 30, 2017 10:27 pm

Time to bring new life back here.
How can i make a shop with more items than in the Dialog.04? I tried it with multiple pages, but the onSelect hook always Counts the index from 1 to 4 dependent on the item clicked, because i have only space for max. 4 items on one page and i can´t add more. Maybe it´s possible to give the function a fourth Parameter for making distinctions in the buy function.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!

Zo Kath Ra
Posts: 833
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: [WIP] GrimTK GUI Framework

Post by Zo Kath Ra » Sun Dec 09, 2018 1:32 pm

GrimTK uses assets/textures/gui/gui_items.tga
This file isn't in the LoG 2 asset pack.

How can I extract it from grimrock2.dat ?

The file is made up of many different graphics.
What are their coordinates?

minmay
Posts: 2657
Joined: Mon Sep 23, 2013 2:24 am

Re: [WIP] GrimTK GUI Framework

Post by minmay » Sun Dec 09, 2018 9:33 pm

Does this help?
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.

Zo Kath Ra
Posts: 833
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: [WIP] GrimTK GUI Framework

Post by Zo Kath Ra » Sat Dec 22, 2018 11:08 am

Main Menu -> Custom Dungeon

Can I use the font of the window title ("Choose Dungeon") with GrimTK?

User avatar
akroma222
Posts: 1024
Joined: Thu Oct 04, 2012 10:08 am

Re: [WIP] GrimTK GUI Framework

Post by akroma222 » Mon Aug 19, 2019 6:01 pm

grimtk based Question, (re clicking through windows/widgets) posted in simple Q simple A thread
viewtopic.php?f=22&t=7951&p=120714#p120714
Akroma
EDIT: Nevermind, found a suitable workaround 8-)

Post Reply