[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 »

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

Re: [WIP] GrimTK GUI Framework

Post by Duncan1246 »

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: 24
Joined: Sat Nov 26, 2016 12:12 pm

Re: [WIP] GrimTK GUI Framework

Post by ColdDeadStone »

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: 24
Joined: Sat Nov 26, 2016 12:12 pm

Re: [WIP] GrimTK GUI Framework

Post by ColdDeadStone »

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: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: [WIP] GrimTK GUI Framework

Post by Isaac »

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 »

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!
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 »

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: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: [WIP] GrimTK GUI Framework

Post by minmay »

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.
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 »

Main Menu -> Custom Dungeon

Can I use the font of the window title ("Choose Dungeon") with GrimTK?
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: [WIP] GrimTK GUI Framework

Post by akroma222 »

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