LoG Framework (dynamic hooks etc.)
Re: LoG Framework (dynamic hooks etc.)
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?
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.)
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)
- script entities are now spawned in same order as they are loaded by calling fw_loadModule.
(this should fix that problem with exsp)
- 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
- cloneObject viewtopic.php?f=22&t=8450
Re: LoG Framework (dynamic hooks etc.)
Ah, great, thanks so much and sorry for the trouble.
Re: LoG Framework (dynamic hooks etc.)
New version again.
- Added support for party.onDrawGui, onDrawInventory, onDrawStats and onDrawSkills-hooks
some useless usage examples:
- 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
- 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
- cloneObject viewtopic.php?f=22&t=8450
Re: LoG Framework (dynamic hooks etc.)
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:
Eventually grimQ should also be updated to support those new hooks for the autohook feature (right now it doens't work)
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
Re: LoG Framework (dynamic hooks etc.)
@JKos: thanks!!
@Diarmuid:
Later today I check.
@Diarmuid:
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.grimQ should also be updated to support those new hooks for the autohook feature (right now it doens't work)
Later today I check.
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
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
Re: LoG Framework (dynamic hooks etc.)
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
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. ^_^')
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
)
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.)
Hi,
just add a function named autoexec to any script entity and put your hooks there.
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"
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
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
Code: Select all
fw_loadModule('talk')
import "mod_assets/framework/framework.lua"
- 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
- cloneObject viewtopic.php?f=22&t=8450
Re: LoG Framework (dynamic hooks etc.)
Thank you! That function autoexec() code was exactly what I needed. 

Re: LoG Framework (dynamic hooks etc.)
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
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

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
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org