Q1. I have some aliases which start off with the same pattern. Will they go through faster if I collapse it into one alias?
db (command: drink bromide)
df (command: drink fire)
...
dm (command: drink mana)
collapse into
alias: d(b|f|...|m)
script: --if statement to send correct command
Q2. What is an event? Can an event only have one handler?
I was thinking of having an OnEquilibrium event to be handled differently depending on the situation--fighting, debating, or influencing. Could I have three event handlers each in it's own script and enable the script corresponding to the situation? Or do I have to use one event handler and use an if statement inside to respond according to the situation?
Optimizing and Events
Re: Optimizing and Events
Q1:
Due to the nature of alias, there is no need whatsoever to worry about alias optimization - even if you plan on defining several thousand aliases. Trigger sets, by contrast, should be designed with speed criteria in mind (chosing the fastest possible trigger pattern type).
Q2:
a) http://en.wikipedia.org/wiki/Event-driven_programming
b) Yes, an event may have many handlers in different scripts. When an event is raised all event handler functions for this event will be called.
Due to the nature of alias, there is no need whatsoever to worry about alias optimization - even if you plan on defining several thousand aliases. Trigger sets, by contrast, should be designed with speed criteria in mind (chosing the fastest possible trigger pattern type).
Q2:
a) http://en.wikipedia.org/wiki/Event-driven_programming
b) Yes, an event may have many handlers in different scripts. When an event is raised all event handler functions for this event will be called.
Re: Optimizing and Events
Instead of an elseif statement, consider a listXikue wrote: alias: d(b|f|...|m)
script: --if statement to send correct command
In a script object:
drinkables={
f = "fire",
b = "bromide"
}
In the alias:
send("drink " .. drinkables[ matches[2] ])