Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   catchEvent() For Dynamic Events (https://forums.graalonline.com/forums/showthread.php?t=76773)

Inverness 09-13-2007 10:44 PM

catchEvent() For Dynamic Events
 
Why does catchEvent() not work with dynamic events (the ones you make) and only static? That is so irritating :whatever: I would like if it could be made to work with dynamic functions.

Skyld 09-14-2007 12:37 AM

You mean to catch function calls of self-defined functions? Have you tried triggering an onFunction using obj.trigger() instead?

Inverness 09-14-2007 01:13 AM

I've tried trigger() and scheduleEvent() and can't catch them using catchEvent().

Twinny 09-14-2007 01:15 AM

I think he meant try what I said over AIM: just use a function in your event to call any other function you want. Works fine :p

Inverness 09-14-2007 01:18 AM

Quote:

Originally Posted by Twinny (Post 1347626)
I think he meant try what I said over AIM: just use a function in your event to call any other function you want. Works fine :p

No, that destroys encapsulation. The Gui Controls allow you to use them without modifying the script to call events to your scripts, I want my stuff to work like that too >:o

I do not like using alternatives to stuff that should be simple.

Twinny 09-14-2007 01:32 AM

You have a working method right now though... you don't need to add a higher level layer over gs2: use what you have and what works fine >_<

zokemon 09-14-2007 02:38 AM

Efficiency.

Inverness 09-14-2007 02:47 AM

Hard-coded event catching would be more efficient.

I practice encapsulation in my scripting and I don't like having to use another system to handle dynamic events when Graal can already handle static ones.

I really dislike how Stefan is the only one capable of editing the engine.

Twinny 09-14-2007 03:24 AM

I don't think it would be a smart financial move to make it open source.... Also, efficiency and encapsulation don't go together :p

coreys 09-14-2007 03:52 AM

Perhaps he meant that maybe someone other than Stefan, such as a GST should be able to edit it?

Inverness 09-14-2007 03:58 AM

Twinny, stop trying to convince me to use a different method. catchEvent() is one function needed to do what I want, I don't like using a system that requires a TStaticVar or something clientside to contain a list of objects so I can trigger events on them.

And Twinny, Efficiency and Hard-Coding do go together, and since the GuiControls are hard-coded I have to say that their support of the catchEvent() is also, that same functionality should be extended to dynamic functions.
Quote:

Originally Posted by coreys (Post 1347651)
Perhaps he meant that maybe someone other than Stefan, such as a GST should be able to edit it?

Thats exactly what I meant, Skyld being the one I would choose obviously.

My World system organizes levels based on their name prefix and stores information such as if they're interior or exterior levels, the time offset, how the weather should work for them if they're outside, what music to play while in the levels, and also the default lighting (seteffect()). This function is called onPlayerEnters() and will trigger onWorldCheck() each time and onWorldChange() when there is a difference.

I want to be able to do a simple this.catchEvent(System, "onWorldChange", "onWorldChange"); to allow my script to detect that for whatever purpose rather than making some fancy-pants system for it which I don't even like.

Inverness 09-24-2007 11:31 PM

Bump.

Can I get some official response?

Inverness 03-10-2008 02:33 AM

Bump #2.

zokemon 03-10-2008 05:01 AM

Yeah, still would be nice to get this.

Robin 05-02-2008 03:57 PM

I suggested a method, addEventListener, in the Future Improvements forum. It would bring GS2 closer to ECMAScript standards too.


All times are GMT +2. The time now is 01:24 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.