Page 15 of 16
Re: LoG Framework (dynamic hooks etc.)
Posted: Wed Apr 24, 2013 1:16 am
by Diarmuid
Hi jKos and Xanathar, did you change something in how modules are loaded? Because the latest update seems to have broken exsp.
I use fw_addModule() to load a script entity A, then load a script entity B, and in B there is a method call to A which fails. Are all modules put into a table and then loaded later in a random order, or something like that? What has changed?
Re: LoG Framework (dynamic hooks etc.)
Posted: Wed Apr 24, 2013 9:01 pm
by JKos
New version:
- script entities are now spawned in same order as they are loaded by calling fw_loadModule.
(this should fix that problem with exsp)
Re: LoG Framework (dynamic hooks etc.)
Posted: Thu Apr 25, 2013 12:02 am
by Diarmuid
Ah, great, thanks so much and sorry for the trouble.
Re: LoG Framework (dynamic hooks etc.)
Posted: Thu Apr 25, 2013 8:14 pm
by JKos
New version again.
- Added support for party.onDrawGui, onDrawInventory, onDrawStats and onDrawSkills-hooks
some useless usage examples:
Code: Select all
function autoexec()
fw.setHook('party.myHook.onDrawGui',function(g)
g.color(0, 0, 0)
g.drawRect(10, 10,100, 100)
end
)
fw.setHook('party.myOtherHook.onDrawGui',function(g)
g.color(255, 255, 255)
g.drawRect(110, 110,100, 100)
end
)
fw.setHook('party.myInventoryHook.onDrawInventory',function(g,champion)
g.color(255, 255, 255)
g.drawText(champion:getName(),110,130)
end
)
end
Re: LoG Framework (dynamic hooks etc.)
Posted: Fri Apr 26, 2013 4:47 am
by Diarmuid
Remind me if I'm wrong, but for dynamic hooks to work, there must not be an object defined with that hook in an .lua, because it overrides the framework calls, right?
So if nothing must ever define it's onDraw hooks "hardcoded", then we need new versions of things like grimwidgets, because right now if grimwidgets is installed, those new framework hooks do nothing.
I went ahead for the ORRR2, removed the party definition from grimwidgets.lua, and added the following to gw.lua:
Code: Select all
function autoexec()
fw.setHook('party.gw.onDrawGui', function(g)
gw._drawGUI(g)
end
)
fw.setHook('party.gw.onDrawInventory', function(g,champ)
gw._drawInventory(g,champ)
end
)
fw.setHook('party.gw.onDrawSkills', function(g,champ)
gw._drawSkills(g,champ)
end
)
fw.setHook('party.gw.onDrawStats', function(g,champ)
gw._drawStats(g,champ)
end
)
end
Eventually grimQ should also be updated to support those new hooks for the autohook feature (right now it doens't work)
Re: LoG Framework (dynamic hooks etc.)
Posted: Fri Apr 26, 2013 8:23 am
by Xanathar
@JKos: thanks!!
@Diarmuid:
grimQ should also be updated to support those new hooks for the autohook feature (right now it doens't work)
This is strange because for my dungeon I was using a modified framework which was already forwarding onDrawGui and using autohooks without hassles. But then, I might have some minor change I forgot somewhere in my grimq so I wouldn't bet my hand on it.
Later today I check.
Re: LoG Framework (dynamic hooks etc.)
Posted: Sat May 25, 2013 4:31 am
by Gotcha!
Hi there,
Would you mind a question?
I am a real nincompoop when it comes to lua and this framework thing utterly hurts my mind as well.
I've got the framework installed and it probably works, but I have no idea how to make a hook/script that makes my party members talk.
Does any of you perhaps have an example?
I take it that I just need to place a new script item in the editor and paste the hook in there?
But pasting stuff like
Code: Select all
talk.addTalkHook('snail_1','onDie','Take that slimeball!',1)
talk.addTalkHook('round_shield_1','onPickUp','This will be useful.',0.5)
return opener.name == 'party'
end
)
doesn't work.
I hope you can help! I am creating a huge dungeon where the party members are required to do a lot of talking.
(By the by, if anyone would know of a way to make them talk without this framework then I'd be happy too. Lua is already an impossible thing for me to grasp. I don't like to overcomplicate things for myself. ^_^')
Re: LoG Framework (dynamic hooks etc.)
Posted: Sat May 25, 2013 2:48 pm
by JKos
Hi,
just add a function named autoexec to any script entity and put your hooks there.
Code: Select all
function autoexec()
talk.addTalkHook('snail_1','onDie','Take that slimeball!',1)
end
the autoexec function is executed automatically after the framework is loaded.
Now when you kill the snail_1 it should print
Random Champion Name: Take that slimeball!
EDit: you also have to load the talk module by adding this line to your init.lua
after this line:
import "mod_assets/framework/framework.lua"
Re: LoG Framework (dynamic hooks etc.)
Posted: Sun May 26, 2013 2:48 am
by Gotcha!
Thank you! That function autoexec() code was exactly what I needed.

Re: LoG Framework (dynamic hooks etc.)
Posted: Tue Jun 04, 2013 5:57 pm
by Xanathar
Hi JKos
I did some perf test, and it seems routing onDrawGui (and friends) through the framework causes a bad slowdown of everything (even if nothing is registered) for some reason. The slowdown is visible only in a dungeon with many many objects - don't know the reason, but I know dispatching gui without the framework actually improves my mod performance a lot. Still investigating this, if I find further details I'll tell you.
My fault for suggesting adding them

sorry