Page 1 of 1

To Jkos Log Framework

Posted: Tue Apr 08, 2014 10:46 am
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

Re: To Jkos Log Framework

Posted: Tue Apr 08, 2014 10:51 pm
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.

Re: To Jkos Log Framework

Posted: Mon Apr 14, 2014 10:28 am
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 :)