![](templates/Classic/images/spacer.gif) |
ashii Newbie
Joined: 29 Jan 2010 Posts: 5
|
|
|
![](templates/Classic/images/spacer.gif) |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Feb 11, 2010 5:55 am |
#trigger {pattern} {one set of code}
#trigger {pattern} {a different set of code}
Is that what you're looking for?
You can also do it like this:
#trigger {pattern} {#raise some_event_name}
#event {some_event_name} {one set of code}
#event {some_event_name} {different set of code} |
|
_________________ EDIT: I didn't like my old signature |
|
|
![](templates/Classic/images/spacer.gif) |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Feb 11, 2010 8:52 pm |
As Matt said, you can have as many triggers using the same pattern as you want. If you need to distinguish between them, for instance for enabling or disabling them separately, you can either put them into separate classes and control the classes, or give each one a unique id. This works perfectly well, especially if you only have a few triggers with the same pattern.
Using events, as in Matt's second option, is an even cleaner form of modularization. In the first option, with multiple triggers, cmud needs to test the pattern of _each_ trigger against each input line, which means a lot of extra work if you have many triggers with the same pattern. It probably wouldn't noticeably slow you down because cmud is so fast, but it can add up. Using events, you only need to test the pattern against the line once. Raising an event name causes every enabled event with that name to be executed. |
|
|
![](templates/Classic/images/spacer.gif) |
ashii Newbie
Joined: 29 Jan 2010 Posts: 5
|
Posted: Fri Feb 12, 2010 7:59 pm |
thanks, i figured out too i had messed up my priorities =)
|
|
|
![](templates/Classic/images/spacer.gif) |
|
|