Page 12 of 14
Re: New GUI scripting concepts and foundation
Posted: Sun Feb 03, 2013 11:31 pm
by thomson
I had a discussion with mahric and we agreed on general goals of merge of the grimwidgets and Dialog code from LotNR. I started working on this. Some files from Dialog are already here. There are 3 new dialogs that can be used, but they are only loosely integrated with grimwidgets. This is definitely an early work in progress. Feel free to look at the code, but please don't complain that there's too much duct tape

Re: New GUI scripting concepts and foundation
Posted: Sun Feb 03, 2013 11:35 pm
by Xanathar
I
love duct tape
And I'm sorry that I'm not contributing enough to this

Re: New GUI scripting concepts and foundation
Posted: Tue Feb 05, 2013 1:40 am
by thomson
As Diarmuid pointed out, the whole grimwidgets framework overlaps to some degree with the GUI dialogs done by Mahric. After chatting with Mahric about priorities and desired functionalities, we agree that merge of both approaches is possible.
Here's the *early* result:
Note that one of the buttons (Sancsaron) is slightly lighter, because cursor hovered over it (yes, buttons are cursor sensitive).
The code allows creating simple dialog boxes (informational, yes/no, simple buttons) with a single call, so it will be easy for use for modders. On the other hand, more advanced users have much better control - you can create window with additional elements stacked inside or one next to each other, buttons react to cursor moving over them etc.
Grimrock style textured buttons are there, just the screenshot doesn't show it.
The long term plan is to finish the integration with grimwidgets and then start adapting grimwidgets in projects that may be interested. Legend of the Northern Realms and EOB: Waterdeep sewers are two projects that are interested for sure, but I think others may be interested as well.
Re: New GUI scripting concepts and foundation
Posted: Wed Feb 06, 2013 10:46 pm
by JKos
Those dialogs look great, a really nice addition.
I also made a higher level widget: a general purpose book (it's not perfect yet but works)
Screenshot
https://docs.google.com/file/d/0B7cR7sc ... 91dDQ/edit
simple usage example
Code: Select all
local book = gw_book.create('my_book',30,30)
book:addPageHeader(1,'Header for the first page') -- adds text to the top of the 1st page
book:addPageText(1,'Some text' here') -- adds text below the previous header
book:addPageImage(2,'/mod_assets/some/image.tga',200,200) -- adds an image to the 2nd page (width and height must be specified)
gw.addElement(book)
Re: New GUI scripting concepts and foundation
Posted: Fri Feb 08, 2013 2:31 am
by thomson
The book looks super useful - spellbook, questlog or a diary. So many useful applications! Great work.
I have reimplemented gw_events module. It allows you to create scripted events that are based on series of dialogue boxes. You can define states and actions allowed in those states. For example, let's assume a scenario, where you meet a wounded dwarf. Once you approach it, you can heal him or leave him. If healed, he asks if he can join you party. You can accept or reject his offer.
Here's example code that creates such encounter:
Code: Select all
-- List of available states. First field is a state name. The second is its description. Every event start with the first state listed.
states = {
{ "init", "An injured dwarf lies on the ground before you." },
{ "healed", "Having regained his strength, the dwarf thanks you and wants to join you party." },
{ "join", "As Taghor joins your party he says: Let's go kick some asses!" }
}
-- This is an optional callback that is executed once specific action is taken
function onHeal()
hudPrint("Dwarf is now healed!")
-- Callbacks can return state name to force transition to specific state
-- return "join"
end
-- This is a list of allowed actions in each state.
actions = {
{ "init", "healed", "Tend his wounds", onHeal},
{ "init", "abort", "Leave" },
{ "healed", "join", "Yes" },
{ "healed", "end", "No" },
{ "join", "end", "Continue" }
}
And here's how this looks like in the game:
step 1 step 2 step 3
Re: New GUI scripting concepts and foundation
Posted: Sat Feb 09, 2013 10:55 pm
by thomson
Ok, some guys from LotNR are trying to use grimwidgets! We have first users. Yay!
The initial feedback is that installation in existing dungeons is not described anywhere. So this brings us the topic we've managed to avoid so far: documentation. How do you guys want to write documentation with examples? If you do not have better proposals, how about wiki? We could also use grimwiki.net (easier to find for modders) or on github.com (code and doc kept in one place).
Re: New GUI scripting concepts and foundation
Posted: Sat Feb 09, 2013 11:22 pm
by JKos
I vote for github, and I think we could add the documentation to the README.md like in the github wiki project:
https://github.com/github/gollum
It's easy to find and it's part of the project and is available offline too. README.md supports the gollum wiki syntax.
About he installation: I think we should provide a separate installation zip package which contains only the needed scripts. I can do that.
Re: New GUI scripting concepts and foundation
Posted: Sat Feb 09, 2013 11:55 pm
by JKos
Hmm, I think grimwidgets will conflict with LotNR, because there are parts of the lnr framework in it (like Dialog.lua and Util.lua). But I'm sure you guys can sort it out.
Should we move those required images under the grimwidgets/images folder? This way they wont overwrite with any other images. I really don't want to add lnr or textures folder to the grimwidgets installation zip.
Re: New GUI scripting concepts and foundation
Posted: Sat Feb 16, 2013 5:00 pm
by thomson
Here you go:
https://github.com/xanathar/grimwidgets
I haven't had time to document everything, so I started with simple dialogs and managed to document book so far.
I plan to work on the documentation in a near future. After that I plan to sort our directories as JKos suggested (remove lnr directory completely, move images etc).
Re: New GUI scripting concepts and foundation
Posted: Sat Feb 16, 2013 9:41 pm
by JKos
thomson wrote:
I haven't had time to document everything, so I started with simple dialogs and managed to document book so far.
I plan to work on the documentation in a near future. After that I plan to sort our directories as JKos suggested (remove lnr directory completely, move images etc).
That's a great start, good job. I thought that md files support gollum syntax, but it seems to be slightly different markup called markdown:
http://daringfireball.net/projects/markdown/syntax#link
I fixed some broken links from README.md.
I will start documenting the lower level api. Btw. did you notice that you can edit README.md online on the github site? Just wanted to point this out in case you didn't notice it. Much easier that way.