|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Thu Oct 29, 2009 7:07 pm
Whats the difference between an alias and an event? |
i created an event called LootCorpse and i raise it when i get exp.
i guess i could create an alias called LootCorpse and do the same thing.
i was just wondering what the differences are and are there benefits do doing it one way or the other? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Oct 29, 2009 7:55 pm |
Events are like triggers in alias form. When you raise an event, all defined events with that event name are executed.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Thu Oct 29, 2009 8:04 pm oh |
so i can have the same event name in multiple places in my code programmed to do different things?
and when i raise the event. all those events will run? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Oct 29, 2009 8:33 pm |
That is correct. You can also #raise an event with one or more arguments, which can be accessed in the event objects with %1, etc. This is especially powerful if you give IDs to the event objects or put them into classes, and use #t+ and #t- to enable and disable which ones are actually active at any time. When you #raise myEvent, all of the enabled myEvent objects will fire, in order of priority number. A great feature.
|
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Thu Oct 29, 2009 9:02 pm |
wow thats sounds really cool.
how do you use the id to turn things on and off with #T- and #T+ i always used the name of the thing i was turning on and off which makes it so that i have to not use spaces in my names. but if i could use the id that would be cleaner. |
|
|
|
Tarken Aurelius Apprentice
Joined: 23 Oct 2008 Posts: 120 Location: Cincinnati, Ohio
|
Posted: Thu Oct 29, 2009 11:02 pm |
You have to first assign the trigger/class/setting an ID which can be done when you create it:
Code: |
#TRIGGER id {pattern} {commands} classname options |
or there is a box labeled "ID" inside the trigger editor where you can assign it an ID. Personally, I use the number you can see on the XML tab for simplicity, then something like this would work:
Code: |
#TRIGGER 26 {^(%w) tells you} {#BEEP} "tells" |
With the following to turn it on/off:
I hope this helps! |
|
_________________ Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org) |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Fri Oct 30, 2009 12:54 am yeah it does |
thanks
|
|
|
|
|
|