LoG Framework (dynamic hooks etc.)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
slackmg
Posts: 20
Joined: Fri Nov 09, 2012 12:21 am
Location: Here I am.

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by slackmg »

Thanks. I'm working again after updating the fw.lua file. Must've had the broken version in the dungeon export. I thought I had the last version in, but it appears not. Thanks for the great framework (especially the illusion walls).

Mike
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Hi JKos,

The hook handling with equip/unequip seems bugged in the framework, as hooks defined in .lua files do not get argument passed on correctly.

See what I wrote to your intention in the "cancel equip/unequip" thread: viewtopic.php?f=14&t=4637#p48778
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

Sorry, I didn't notice that the published version had those hooks. New version uploaded. It still has onEquipItem and on onUnequipItem hooks but they work like native hooks, which do have only slot and champion arguments. Previous version was modified so that the item was added as a first argument, because I wanted to make it work like all other hooks which do get the entity as a first argument.
- 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
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Ah... So the normal hooks don't have the self arg... I thought they did, based on your reference sheet. Damn, that means my equipStopper is still buggy I'll fix it tonight.

Thanks for the quick fix. Your version was better but I think its better to follow ah's hooks for compatibilty and if non-fw users look at your cheat sheeet.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

All previous hooks do get the self arg, but onEquipItem and onUnequipItem don't. I was pretty confused about it too, and I hope the AH will fix it.
my cheat sheet says:
onEquipItem(champion, slot)
onUnequipItem(champion, slot)

Edit: but I guess that's what you get when you drink Glögg while scripting :D
- 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
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by Diarmuid »

Lol @ Glögg and coding.

Unfortunately, now, the dynamic hooks for equip/unequip don't seem to work at all. The following gets me no result:

Code: Select all

autohook = {
	conjurers_hat = {
		onEquipItem = function(champion, slot)
			print("Hello!")
		end
	}
}
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

Damn, I just realized that my framework requires the self argument. Obviously It's not possible to bind hooks to items if the item is not known by the framework. So I have to change it back so that item is passed as a 1st argument. But meanwhile you should be able to use native hooks, just override the framework hooks by cloneObject.

Code: Select all

cloneObject{
 name= 'conjurers_hat'
 baseObject='conjurers_hat'
 onEquipItem=function(champion, slot)
         print("Hello!")
 end
}
after the framework is included.
- 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
JayFight
Posts: 4
Joined: Fri Dec 28, 2012 5:35 am

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JayFight »

you can skip this part
hi there. first i want to say i love this, and second i noticed you have a gui module included but it won't let me use it (i think it's trying to access something and that something isn't there)

so anyways i was wondering if there was a way to use this to make my own custom gui. you know like rearranging the layout or adding my own gui images or even making menus, i

only ask this because i would love to make a shop using this. like you would click something in the environment(say an NPC of some sort like a spider) and it responds with say something that looks like the map (or what ever else you put) opening up and inside there is a list of items with prices and you can click those to buy them.

if there is a way to do that maybe you can give an example of how to do that and i could just go from there, i have a little experience with reworking scripts, but i don't know how to write them myself. anything you(or anyone) puts i can take and turn into what i need, i just can't figure out how to start such a thing myself is all

thank you
okay just so you know i just found another thread you have been talking in about this very thing i was asking about above sorry i didn't see that thread earlier, now i have to finish the thread and hope i can piece together what i need to figure out a custom gui on my own
Last edited by JayFight on Mon Dec 31, 2012 3:14 am, edited 1 time in total.
JayFight
Posts: 4
Joined: Fri Dec 28, 2012 5:35 am

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JayFight »

oh also i forgot to mention that i tried to use the default spell module to add them to the spell book but every time i click on those spells to try to learn them it crashes the game
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: LoG Framework (new: AD&D style spell book and 14 spells)

Post by JKos »

New version:
onEquipItem and onUnequipItem hooks implemented and now they DO receive the item(self) as a first argument, so they are different than the native hooks.

native hooks:
onEquipItem(champion, slot)
onUnequipItem(champion, slot)

Framework hooks:
onEquipItem(item,champion, slot)
onUnequipItem(item,champion, slot)

Also some minor bug fixes.
Default_spells should work now, but I noticed that for some reason it still breaks the save games so that they can't be loaded any more, so DON'T use it :), I'm not fixing it because i'm going to redo the spell book with gui features.

Thanks for the feedback anyway JayFight.
- 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