Page 13 of 14
Re: New GUI scripting concepts and foundation
Posted: Sun Feb 17, 2013 1:55 am
by thomson
It was confusing at the beginning. The gollum project you mentioned before talked about needing lots of ruby stuff to have it editable locally. It also explicitly mentioned that it does not work on Windows. Well, I do use Linux for about everything except gaming, so that wasn't a deal breaker for me, but was odd. And it didn't work. Luckily, that stuff is not needed.
JKos wrote: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.
Yeah, I've figured that out after 2 commits with failed attempts to insert an image
I saw your script for creating zip package. It is good and very easy to use. I think we should include readme and changelog in it as well. Speaking of changelog, you've added the book and I've integrated textured windows. I think that is sufficient to bump up revision number and perhaps do some sort of release?
Re: New GUI scripting concepts and foundation
Posted: Sun Feb 17, 2013 10:19 am
by JKos
I think we should move those images under the grimwidgets folder before the first release. I'm going to do it now, It's really just search and replace job.
Re: New GUI scripting concepts and foundation
Posted: Wed Mar 27, 2013 6:39 pm
by Drakkan
I have a question (or maybe request) for adding new guy to the party. When I edit the allowed skills, it automatically takes skills regarding the default class (for example if add to the party Mage, then you can edit just fire / air / ice skill etc... - whatever else you enter there, script doesnt care). What I need is to add six skills which I want for that character and set its values. Any advice for this ?
-- allowed skills: air_magic, armors, assassination, athletics, axes, daggers,
-- dodge, earth_magic, fire_magic, ice_magic, maces, missile_weapons, spellcraft,
-- staves, swords, throwing_weapons and unarmed_combat
skills = { -- here I want to define my 6 skills for that caharacter (now its taking default ones) },
Re: New GUI scripting concepts and foundation
Posted: Thu Mar 28, 2013 10:11 am
by mahric
Drakkan wrote:What I need is to add six skills which I want for that character and set its values.
As far as I know that's a limitation of LoG. You can only use the skills with the selected race.
Else we could have some great new classes.
Maybe in LoG2...
Re: New GUI scripting concepts and foundation
Posted: Thu Mar 28, 2013 12:15 pm
by Drakkan
mahric wrote:Drakkan wrote:What I need is to add six skills which I want for that character and set its values.
As far as I know that's a limitation of LoG. You can only use the skills with the selected race.
Else we could have some great new classes.
Maybe in LoG2...
what about thoorum ? he has defined skills, is that hardcoded ?
Re: New GUI scripting concepts and foundation
Posted: Thu Mar 28, 2013 12:19 pm
by Xanathar
Toorum is of class "ranger", which is one of the supported classes (although not selectable when you build the party).
Re: New GUI scripting concepts and foundation
Posted: Thu Mar 28, 2013 12:20 pm
by Asteroth
Drakkan wrote:mahric wrote:Drakkan wrote:What I need is to add six skills which I want for that character and set its values.
As far as I know that's a limitation of LoG. You can only use the skills with the selected race.
Else we could have some great new classes.
Maybe in LoG2...
what about thoorum ? he has defined skills, is that hardcoded ?
Toorum has a class of his own (ranger) which is coded the same as the others(pretty much).
Edit: Wait if you meant he has ranks already in those skills, not having a unique set of skills then I'm not sure how that works.
Re: New GUI scripting concepts and foundation
Posted: Tue Apr 02, 2013 6:37 pm
by Damonya
JKos wrote: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)
I wondered if it was possible to add widgets buttons in the book (example with a yes/now dialog), or activate a widget yes-no dialog, when you close the book. I tried all this afternoon to make it, but without success.

The best for what I'm trying to achieve is to enable this kind of widget with the C key (like the compass in the mod), or when you use an item, but I can do it even less.
Re: New GUI scripting concepts and foundation
Posted: Wed Apr 03, 2013 8:30 am
by Damonya
Damonya wrote:
I wondered if it was possible to add widgets buttons in the book (example with a yes/now dialog), or activate a widget yes-no dialog, when you close the book. I tried all this afternoon to make it, but without success.

The best for what I'm trying to achieve is to enable this kind of widget with the C key (like the compass in the mod), or when you use an item, but I can do it even less.
Ok I found.
or when you use an item
Just had to use this line:
Code: Select all
function autoexec()
fw.setHook('id_item.id_script.onUseItem',function()
--Put all the widgets you want here
end
)
end
Sometimes we look very far while the solution is simple
Concrete example:
Code: Select all
function autoexec()
fw.setHook('compass_1.script_entity_1.onUseItem',function()
local s_text = [[Hey, you! Are you brave?]]
local s_dlgId = Dialog.quickYesNoDialog(s_text, answerCallBack, nil)
Dialog.activate(s_dlgId, answerCallback)
local book = gw_book.create('compass_1')
book.textColor = {100,100,100,210}
book:addPageHeader(1,'This is the header of the 1st page.')
book:addPageText(1,
[[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin iaculis pretium velit,
commodo molestie augue adipiscing ac. In hac habitasse platea dictumst.Maecenas massa diam, accumsan sed mattis in, volutpat non elit. Maecenas ut ullamcorper nisi.]]
)
book.textColor = {200,200,200,210}
book:addPageHeader(2,'Different font color for this page.')
book:addPageImage(2,'mod_assets/grimwidgets/images/compass_full_E.tga',200,200)
book:addPageText(2,'and some text below it')
book:openPagePair(1)
gw.addElement(book)
return false
end
)
end
function answerCallBack(s_caption)
if s_caption == "Yes" then
hudPrint("Yeah, right...")
end
if s_caption == "No" then
hudPrint("Run for your life! There's killer snail after you")
end
end
...and I have the desired effect. A book when you use the item and a yes/no dialog when you close the book. Sorry if this was obvious to everyone, it was not for me in the beginning.
Only small problem with this: print("Calling dialog.activate() with wrong number and/or type of parameters.") in the console text, but I also have this text in your mod test.
Re: New GUI scripting concepts and foundation
Posted: Wed Apr 03, 2013 8:30 pm
by JKos
Good to hear that you found a solution, but to me that code looks like that it opens the dialog when the item is used not when the book is closed. Book widget has an undocumented feature: onClose-hook so you can override the default onClose functionality like this:
Code: Select all
local book = gw_book.create('my_book_1')
book.onClose = function(closeButton)
...your stuff here...
gw.removeElement(closeButton:getAncestor().id) --this line removes the book from the gui
end
And you should be able to add any widgets or elements in book by using another undocumented (yeah I 'm lazy

) function: gw_book:addPageElement(pageNumber,element)
Code: Select all
local button1 = gw_button:create("Push me",10,10)
button1.onClick = function() print("It should work") end
book:addPageElement(3,button1) --add button to page 3
Code is untested, so let me know if it worked
