New GUI scripting concepts and foundation

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
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 »

Ok, I just resumed working on it and I'm doing a generic panel (beveled or flat rectangle with no logic whatsoever) and a generic image elements (actually, I did them just not tested yet, in the lunch break).

Just for coordination of this, has anybody here used Trello in the past ? I use it often for small projects (where I don't have to use bigger tools) and found it's good for tracking things to do etc.

If everyone agrees I can setup a Trello board.
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 »

Good to hear. We can use tools provided by github too, this is so small project that I think that they will do fine. There is a simple issue tracker and simple wiki.
Just signed up to trello and it looked nice with kanban boards etc. but I don't really see that much benefit of using it compared to git hub tools.
Of course I don't know trello, so if you think that it's much better than github's tools then maybe we should try 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
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 »

We can use tools provided by github too, this is so small project that I think that they will do fine.
Perfectly fine with them (actually I didn't look :S).
Of course I don't know trello
Basically it has all what you may want from a kanban board. There are some Chrome extensions targeting using it for scrum but it's simple as that (its main value is exactly that it's simple).

Anyway, let's go with github tools, it makes more sense, don't know how I didn't look there.
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
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 »

Just had another 20 minutes :( to work on it.

In the event for the dwarf there is this comment:

Code: Select all

-- todo: the following x,y coords are temporary.
--       They should be calculated automatically.
What kind of auto calculation should be done ? For resolution indipendency or anything else ?

Also, I would like to move the state variable outside the script_entity to be managed through a table in gw_events.lua. This would allow us to
  • Have a default where a state can be specified in place of a function in the actions declaration (for longer dialogues, otherwise it gets to a mess of functions)
  • Have dialogues interacting each other (a standard way to set each other state).
Tell me what is your opinion on this - you have a clearer idea on what events should do I think.

Also something on which I'm not entirely convinced but not entirely against too: moving from integer states to string states (or anything states).
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
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 »

Xanathar wrote:Just had another 20 minutes :( to work on it.

In the event for the dwarf there is this comment:

Code: Select all

-- todo: the following x,y coords are temporary.
--       They should be calculated automatically.
What kind of auto calculation should be done ? For resolution indipendency or anything else ?
I was thinking about not having to specify them. The dialog window should appear in the center of the screen. Also, it shouldn't be mandatory to specify the image size and button positions.
It's an old code. I'll try to rewrite it using what we have now. It should be a lot cleaner.
Xanathar wrote: Also, I would like to move the state variable outside the script_entity to be managed through a table in gw_events.lua. This would allow us to
  • Have a default where a state can be specified in place of a function in the actions declaration (for longer dialogues, otherwise it gets to a mess of functions)
  • Have dialogues interacting each other (a standard way to set each other state).
Tell me what is your opinion on this - you have a clearer idea on what events should do I think.
I'd like to keep the ability to define everything regarding a single event in one place. This is important from modder prespective. If a modder needs to register his event somewhere, he may get confused. Sure, we can keep and manage the state somewhere else, but it should be done be the framework itself, e.g. when processing an event for the first time.

Related question: I don't really know how savegames work. Definitely we need to have the ability to keep the state persistent between loads/saves.
Xanathar wrote: Also something on which I'm not entirely convinced but not entirely against too: moving from integer states to string states (or anything states).
I don't have any opinion either. I'm ok with keeping the state numbered or as a string. String may be easier to understand for less programming oriented modders.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
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've implemented gw_image object. I also partially rewritten gw_events to draw things using gw_element objects.

I must say that the new refactored code is much easier to work with.

I plan to finish it on Sunday. If any of you want to finish it earlier, feel free.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
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 »

I'd like to keep the ability to define everything regarding a single event in one place. This is important from modder prespective. If a modder needs to register his event somewhere, he may get confused. Sure, we can keep and manage the state somewhere else, but it should be done be the framework itself, e.g. when processing an event for the first time.
That was what I meant. Simply instead of having an explicitely declare state variable, we would have starting_state (or even just decide that every event starts at state 1) and then the gw_events would keep track of the state.

About savegames: every variable in scripting entities is saved and restored when saving/loading, so event states etc. should already be preserved through saves.
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
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've spent some time on a new code. In the EOB remake I need the ability to add new champions to the party. Unfortunately, since the limit is 4, that means that when new guy joins in, one of the old ones has to go (similar to what was in EOB1 and 2 when you reached 6 people in your party).

It is work in progress and I run out of time today. Nevertheless I wanted to commit what I did so far. The code now displays a dialog box. It is now possible to pick which one of the 5 champions (existing 4 + the new guy) should go away. The code sets name, race and class of the new champion. There's a lot more to do:
- set skills, traits, experience, portrait, experience and levels
- have the ability for the new guy to bring in some item with him
- have the old guy to drop everything he had before he goes away
- food is not set
- conditions (e.g. paralyzed, dead) are not set.
- hide the code to mod_assets/grimwidgets, so the usage will be simpler for modders

I also fixed small bug in text wrapping. The text no longer starts with a space. It is also possible to disable text wrapping by adding textwrap=false to gwElement object.

I also have some questions:
1. How do I get the portrait of existing champion? Sadly, there is no getPortrait() method in Champion object.
2. How do I set the experience? Reference only shows levelUp() and gainExp() methods. If there are no other way, I'll try do call gainExp() with negative value until level drops. That's an ugly hack, but the current API does not seem to offer any better approach.
[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 »

I added some features too, see changelog: https://github.com/xanathar/grimwidgets ... NGELOG.txt

And check the gui_demo for examples.
- 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'm working on a dialog box to have a new champion join your party. One of the steps is that the old guy has to go. I'd like him to drop all items on the floor, before he vanishes. It is easy to get an item from the inventory, but I haven't found a way to write the code to actually drop it on the floor. I think the only way to do it is to destroy old instance and spawn a new one with proper position set. Trivial spawn won't do the trick, though. The problem here is that you need to keep lots of things: stacked items, charges, torch fuel, items in containers etc.

In this post, I've found that I not the only one who needed that. The code is very simple, thanks to Xanathar's GrimQ.

The easiest way would be to include GrimQ in grimwidgets. It's not a huge dependency - a single 40KB file. Are you guys ok with including this?
If you don't want GrimQ here, where do you think I should put the "get new guy" code? Although I plan to use it in EOB remake, having a gui to get a new character join your party is likely to be useful for many other dungeons. It makes sense to make it available, together with other examples: spell book, compass, event etc.

p.s. The latest version does not load in dungeon editor, because there's missing gw_text.lua text.
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
Post Reply