New GUI scripting concepts and foundation

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

JKos wrote: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.
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?
[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 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.
- 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
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: New GUI scripting concepts and foundation

Post 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) },
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: New GUI scripting concepts and foundation

Post 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...
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: New GUI scripting concepts and foundation

Post 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 ?
Breath from the unpromising waters.
Eye of the Atlantis
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 »

Toorum is of class "ranger", which is one of the supported classes (although not selectable when you build the party).
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
Asteroth
Posts: 471
Joined: Wed Oct 24, 2012 10:41 am
Location: Eastern U.S.

Re: New GUI scripting concepts and foundation

Post 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.
I am the God of darkness and corruption.
viewtopic.php?f=14&t=4250
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: New GUI scripting concepts and foundation

Post 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.
Orwak - MOD - Beta version 1.0
User avatar
Damonya
Posts: 134
Joined: Thu Feb 28, 2013 1:16 pm
Location: France
Contact:

Re: New GUI scripting concepts and foundation

Post 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:
SpoilerShow

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:
SpoilerShow

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.
Orwak - MOD - Beta version 1.0
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 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 :)
- 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