To Jkos Log Framework

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

To Jkos Log Framework

Post by Mysterious »

Hi Jkos.

I am using the Framework in my Mod and I have a Question. I trying to figure out how to put a 75 x75 image in the upper left corner of the below Code for dialog Box. It say something about (npc module) I don't have it in any of the Framework folders, so am I missing something??

The line of code is: local s_npcId = "" -- "npc_guard" and local s_dlgId = Dialog.new(s_text, s_agree, nil) --s_npcId). I assume this must be where the Image is added, but I am not sure.. In the sample Mod you created it says you can put a Image in the Box...

Any help on this? Thank You :)

Code: Select all

--
-- Example on how to build your own dialog
-- 
-- This example uses all features:
--  * Shows portrait of the npc
--  * Defines buttons with custom text
--  * Uses a callback function to process the result
--

s_challenge = "Right, make me!"
s_agree = "I'm going already!"

function clickOgre()
	local s_npcId = "" -- "npc_guard"
	local s_text = [[Hey, you!
					What are you doing here? Why are you pressing
					this button?

					You're not supposed to be here.
					Leave while you can!]]

	local s_dlgId = Dialog.new(s_text, s_agree, nil) --s_npcId)
	Dialog.addButton(s_dlgId, s_challenge)
	Dialog.activate(s_dlgId, ogreCallBack)
end

function ogreCallBack(s_caption)
	if s_caption == s_challenge then
		hudPrint("Oh oh... Now you've done it!")
	end
	if s_caption == s_agree then
		hudPrint("Party is full of chickens!")
	end
end
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: To Jkos Log Framework

Post by JKos »

I see that you are using grimwidgets, it's gui-framework which just uses my LoG Framework for freezing the world and loading external scripts, and I'm not the only author of grimwidgets.
Dialog code for example is originally made by Mahric and integrated to griwidgets by thomson, Xanathar also contributed a lot in this project. So I don't know that Dialog code so well,
but I made a quick test by looking some examples/sources:

Code: Select all


function drawExample()

	gw.setDefaultColor({200,200,200,255})
	gw.setDefaultTextColor({255,255,255,255})

	local rect1 = Dialog.create(-1, -1, 600, 600)
	local img = gw_image.create('img1', 0, 0, 200, 200, "mod_assets/images/example-image.dds")
	Dialog.addButton(rect1.dialog.id, "test")
	
	rect1:addChild(img)
	img:setRelativePosition({'top','right'})
	img.marginTop = 40
	
	rect1.dialog.text = "This is a slow appearing long text let's try\nline breaks"
	
	local img1 = gw_button3D.create('img', 10, 10, "Awesome!", 300, 40)
	rect1:addChild(img1)
	img1:setRelativePosition({'center','bottom'})
	img1.onClick = function() gw.removeElement("Dialog") end
	
	gw.addElement(rect1, 'gui')
end
This shows an image at the top right corner of the dialog, not the top left because the text is displayed there.
I hope that this gets you on the track, but unfortunately grimwidgets is pretty much dead now, and not used in many projects, so don't except to get help easily. I also happen to know that there is some performance issues with grimwidgets, so be cautious if you are going to use 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
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: To Jkos Log Framework

Post by Mysterious »

Hi Jkos sorry for late reply Computer went down.

I am slowly working through it and I have got some things right. I do know your not the only author but I thought because you wrote the Framework System you would know. :) Oh and by the way the Framework is awesome. :) Thxs foe your help :)
Post Reply