how do I "use" GrimTK Gui assets?

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: how do I "use" GrimTK Gui assets?

Post by JohnWordsworth »

If you can post your mod somewhere, I can take a look in the next few days. Don't worry about whether it's messy or not - I'll just debug the problem and send the fix back!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: how do I "use" GrimTK Gui assets?

Post by FeMaiden »

JohnWordsworth wrote:If you can post your mod somewhere, I can take a look in the next few days. Don't worry about whether it's messy or not - I'll just debug the problem and send the fix back!
ok, I'll try to do that. for the time being, I am trying to discover the issue myself.
what I did is created a brand new project to start with a blank slate.

I imported your tools and the scripts I wrote involving the message box.

They work perfectly.

so my theory is that it's something I did when I created all those new tiem and character definitions.

so i'm gradually recopying all my definitions into the new mod.

so far I added all my unique weapons and items over, and those are not causing problems.

so I'm just gonna move a few things at a time over until I discover the culprit.

I am NOT looking forward to rebuilding my whole mod from scratch though.

it's enough to make me want to quit modding forever.

I am not blaming you it's not your fault, the grimtk tools did not ruin my mod.
it's more a case that now that I see how wonderful these tools are, I feel that by not using these tools, my mod will be ruined.
I NEED these tools to make my mod work because without the story my mod is just a generic "survival horror with light puzzle elements but with grimrock assets"

I dunno, maybe it's for the best. if I rebuild my mod from scratch, i can make it better, put more puzzles in, use better scripts, more efficient code...
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: how do I "use" GrimTK Gui assets?

Post by FeMaiden »

JohnWordsworth wrote:If you can post your mod somewhere, I can take a look in the next few days. Don't worry about whether it's messy or not - I'll just debug the problem and send the fix back!


BAM! AND EUREEKA....I discovered the problem.



apparently, the grimtk script entity can't just be "placed anywhere".

it has to be on the topmost map. the one designated as "level 1" in the dungeon.lua file.

I guess it has something to do with load order, or the "order of operations" or whatever you call it.

I had the script placed on level 12 (I know that seems odd but that's where I had my starting point. my dungeon is mostly overworld maps and I chose that one for the starting area. and whenver I was trying to run the script from any level above it in the load order. I was getting that failure because the editor did not recognize the command. and it did not recognize the command because it was trying to execute the command before running the grimtk script which defined it.

sooo...my main project isn't broken after all. I wish i had figured this out before I spent the entire day rebuilding it in a new project...


@john wordsworth, I wonder if you ought to update your readme and let people know this, but I guess most people just start their party on level 1 and naturally place the entity on level 1 and so this problem never cropped up before.
and this is also why it worked perfectly on every "new project" i made because of course I was immediately placing the entity on level 1 to test it.

I mean, you probably also should specify in your readme that people need to create an "ext" folder in their mod assets and then place the grimtk folder in the ext folder.
your readme just says to put it in the mod assets and then says to put

Code: Select all

 
import "mod_assets/grimtk/init.lua"
in the init.lua

but when i did that, it kept looking for a "hooks.lua" inside mod_assets/ext/grimtk

I fixed it by creating the folder and putting

Code: Select all


import "mod_assets/ext/grimtk/init.lua"
in the init.
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: how do I "use" GrimTK Gui assets?

Post by THOM »

Concerning the placement of the script:

Have you disabled levels in the editor while modding? If yes: Disabled levels and everything on it will be concidered by the game-machine as if they wouldn't exist. Maybe the script was on a diabled level? AFAIK it really doesn't matter, where on the map a script is placed, as long as the level is enabled...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: how do I "use" GrimTK Gui assets?

Post by minmay »

Level order does matter, it determines the order objects are initialized and serialized. I believe map position does as well. It's why you see so many script entities in the top left corner of level 1, it's the most convenient place to put them if you're going to reference them before the entire dungeon has finished initializing.
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
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: how do I "use" GrimTK Gui assets?

Post by FeMaiden »

minmay wrote:Level order does matter, it determines the order objects are initialized and serialized. I believe map position does as well. It's why you see so many script entities in the top left corner of level 1, it's the most convenient place to put them if you're going to reference them before the entire dungeon has finished initializing.
lol I noticed that in the main campaign they placed all the sky and heightmap and water surface entities in the upper left corner.
I was actually doing that too, on my accord. I thought everybody just did that to make it look neat.

but I remember from my college days, they went into detail about the order of operations and how important it is.

I usually place my scripts next to the section they relate to, like next to the puzzle or next to the floor trigger that activates it.

yeah, i was kind of bitching at wordsworth there, but I do think it's a good idea for him to include my suggestion to tell people to make sure the entity is on the "first" level.
I could have avoided wasting the entire day trying to rebuild my mod from scratch when all i had to do was move the scripting entity
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: how do I "use" GrimTK Gui assets?

Post by minmay »

FeMaiden wrote:
minmay wrote:Level order does matter, it determines the order objects are initialized and serialized. I believe map position does as well. It's why you see so many script entities in the top left corner of level 1, it's the most convenient place to put them if you're going to reference them before the entire dungeon has finished initializing.
lol I noticed that in the main campaign they placed all the sky and heightmap and water surface entities in the upper left corner.
Actually the position doesn't matter for those objects.
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
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: how do I "use" GrimTK Gui assets?

Post by JohnWordsworth »

Glad you solved the issue! I will take a look and see if I can do something to make it "load order independent". I thought that all of the GrimTK elements were loaded in an internal function that is called on the first tick of the game, but it's possible I missed something somewhere.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: how do I "use" GrimTK Gui assets?

Post by FeMaiden »

JohnWordsworth wrote:Glad you solved the issue! I will take a look and see if I can do something to make it "load order independent". I thought that all of the GrimTK elements were loaded in an internal function that is called on the first tick of the game, but it's possible I missed something somewhere.
keep in mind,what I said is just my theory. all I know is that placing the object in the top left corner of "level 1" fixed my problem. you can even test it for yourself.
try putting it in "level 1" and then putting the command for a messageBox. and then try it again with the grimtk object in level 2 instead of level 1 and you will see that it no longer recognizes the commands when run from level 1.

what's important to me is that it works, and the the quality of my mods has improved drastically. I have been going in and updating all my hudprints (which I thought was clever at the time) and now I can't believe how crapppy it looked, the way I was doing it before with the hudPrints...it looks so crappy compared to the messageBox
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: how do I "use" GrimTK Gui assets?

Post by minmay »

JohnWordsworth wrote:Glad you solved the issue! I will take a look and see if I can do something to make it "load order independent". I thought that all of the GrimTK elements were loaded in an internal function that is called on the first tick of the game, but it's possible I missed something somewhere.
The reason this is happening is that she's trying to use GrimTK before the dungeon even finishes initializing all of its objects, which happens "before" the first tick.
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