New GUI scripting concepts and foundation

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

Ok, I included the framework and made gw_loadModule function which can be used to load gw script entities. I moved gw and gw_events to lua files: mod_assets/grimwidgets/gw.lua and mod_assets/grimwidgets/gw_events.lua.

We can always rollback to previous version if this is not what we want.
- 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
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: New GUI scripting concepts and foundation

Post by thomson »

I just wanted to let you know that real life (aka project deadline) will make me likely to disappear till end of January. I may look at grimrock forum briefly, but I won't be able to contribute anything. That doesn't mean that I lost interest or anything, just being busy writing tons of a different kind of code.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

Real life or real wife? :D Yeah, I know what you mean, I have slowed down my modding pace a lot too. I just can't figure out how to extend the real life timer.
- 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
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: New GUI scripting concepts and foundation

Post by Xanathar »

Real life or real wife?
:lol: :lol: :lol:
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

I did some code refactoring:
added gw_utils module and moved some methods to it and prefixed private methods with _ on gw script entity.

Should we make another script entity for all those draw-methods? eg. gw_draw?
- 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
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: New GUI scripting concepts and foundation

Post by Xanathar »

Should we make another script entity for all those draw-methods? eg. gw_draw?
I didn't work on it these days, sorry.

Maybe it makes more sense to divide them by control type (like gw_buttons ?) and have the draw methods as private in those entities ? Or you mean just the "helper" draw methods like drawBevel and similar ?
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

Maybe, we should think about the structure a bit more. Anyway I added freeze world functionality to encounters, it's still buggy because only way to unfreeze world is to click leave button, so if you heal the dwarf the game is frozen forever, but the idea should be clear so thomson or anyone can continue from there.

Edit: shit, I accidentally committed on eob-waterdeep instead of grimwidgets, sorry I'm gonna fix it.
- 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
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

Ok, now it's pushed to grimwidgets repo and I updated it to eob-waterdeep repo too.
- 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
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

Added gwElement:setRelativePosition(positions)
Implementation is at gw_util.setRelativePosition

Code: Select all

button1:setRelativePosition{'center'} -- sets element position to the center of the parent element
button1:setRelativePosition{'left','bottom'} -- sets element position to the bottom left of the parent element
.. etc..

possible values: top,middle,bottom,left,center,right

TODO:
- possibility to pass relative position as an argument to addChild method
- support for {'after','element_id'} and {'below','element_id'}
- And I think we need a margin (top and left at least) property too
- 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
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: New GUI scripting concepts and foundation

Post by JKos »

FYI: I'm making a major code structure overhaul, so I hope that you guys don't have any uncommitted features in progress.

I'm changing the api to something like this:

Code: Select all

rect1 = gw_rectangle.create('rect_id',10,10,100,100)
button = gw_button.create('button_1',10,10,'button text')
rect1:addChild(button)
So every widget has a own script entity (like Xanathar suggested ). IMO It's much clearer and flexible that way.

Edit: Pushed my changes to github.
- I also added a text wrapping functionality and added text support for rectangles too. (see examples from dungeon)
- gw script has now general element factory method: gw.create(elementType,id,arg1,arg2,arg3,arg4,arg5,arg6)
which can be used like this:
gw.create('button3D','my_3D_button', 20, 20, "Click me", 150, 20, {200,200,200})

Which is exactly the same as calling:
gw_button3D.create('my_3D_button', 20, 20, "Click me", 150, 20, {200,200,200})
- 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
Post Reply