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

Post Reply
User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

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

Post 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()?
Last edited by Jules on Thu Jan 20, 2011 3:24 pm, edited 2 times in total.

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Using Events with Functions Found in Tables

Post by Jules »

Nevermind, I figured it out for myself. It should, in fact, be called fireTurret, and not aethercraft:fireTurret!

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

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

Post 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?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

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

Post 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.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

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

Post by Vadi »

Event handlers can't call functions that are inside tables.

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

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

Post 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!

Post Reply