Page 1 of 1

[I Need Help] Using Events with Functions Found in Tables

Posted: Sun Jan 16, 2011 6:07 pm
by Jules
If I'm going to be using an Event, say... "onAetherBalance" on a function called aethercraft:fireTurret(), would I name the Script aethercraft:fireTurret() or fireTurret()?

Re: Using Events with Functions Found in Tables

Posted: Sun Jan 16, 2011 6:08 pm
by Jules
Nevermind, I figured it out for myself. It should, in fact, be called fireTurret, and not aethercraft:fireTurret!

Re: [I Need Help] Using Events with Functions Found in Table

Posted: Thu Jan 20, 2011 3:28 pm
by Jules
Okay, now this isn't working properly...

I added an event onPrompt to my dragonfly:cureAffliction() function, so I don't have to call it directly on the prompt. When I open up the Errors screen, I get the (amazingly unhelpful) error of:
[ERROR:] object:<event handler function> function:<cureAfflictions>
<onPrompt>
Any ideas?

Re: [I Need Help] Using Events with Functions Found in Table

Posted: Thu Jan 20, 2011 4:47 pm
by Heiko
I can't get you any better error messages, but it's simple to debug this if you call your event handler directly from a script. This will produce the kind of error message you're looking for.

Re: [I Need Help] Using Events with Functions Found in Table

Posted: Thu Jan 20, 2011 7:49 pm
by Vadi
Event handlers can't call functions that are inside tables.

Re: [I Need Help] Using Events with Functions Found in Table

Posted: Fri Jan 21, 2011 8:05 pm
by Jules
Well damn, that's no fun! Thanks a ton, Heiko and Vadi. I'll just distinguish functions with a prefix, so not a big deal!