 |
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Tue May 06, 2008 1:25 am
[HelpFile] 2.23 - #EVENT and expression triggers |
http://forums.zuggsoft.com/modules/mx_kb/kb.php?mode=doc&page=3&refpage=3&a=cmud_%23ev
I know its just a bit of a blab, some notes to help people out, but I find it a bit misleading and difficult to follow. That said, I certainly appreciate the extra notes being there, so please don't feel like I am criticising it too much. I certainly agree with the use of events to cross package boundaries, communicating with other packages even when the package is published locally (or even unchecked to see the package). I tend to partially disagree with the other quoted use, that being script efficiency in prompt triggers. Then again, I may be misunderstanding it since that is the part of the notes that are the most vague. What I disagree with is its actual efficiency.
Your prompt trigger is possibly something like:
(Not sure if you are also capturing the variables).
#TR {H:(%d) etc} {#RAISEEVENT onprompt {%1 %2 %3 %4 %5 etc}} {prompt|nocr}
Code: |
<event event="onPrompt" priority="3480" name="pstatCapture" id="294">
<value>#IF (%pos(p, %7)) {prone}
#IF (%pos(c, %7)) {deffAdd cloak}</value>
</event> |
and
Code: |
<event event="AutoSip" priority="3480" name="AutoSip" id="294">
<value>#IF (@elixirBal && %1<%eval(@maxHp*0.8)) {sip health}
etc
</value>
</event> |
Then it is more efficient because I can use #T+/- to toggle off the events I am not wishijng to use at a particular time. I'm sure it is efficient, and I like how it is nicely modularised. However, I recently was reading a thread on the Aetolian forum about CMUD, and several people have been using an onPrompt event in exactly this manner, and telling other people that if they buy CMUD they should do this as well.
I was a little disappointed, because as I see it, expression triggers are a more efficient way to manage quite a lot of stuff from the prompt. In the above example, the autosip #IF statement still gets checked every time the prompt is seen. Its true that you could #T- it when you sip and #t+ it when you get elixirBal back, but even then it will get checked every prompt when you have elixir balance and high health.
Code: |
<trigger name="Health_Sip" type="Expression" priority="12280" id="103">
<pattern><![CDATA[@elixirb && (@HP<%eval(@maxHP*0.80))]]></pattern>
<value><![CDATA[sip health]]></value>
</trigger> |
The above expression only gets checked when @elixirb, @HP or @maxHP changes. Being a trigger, it is also more functional through use of trig states.
I recently followed a thread on the Aetolian website about CMUD AND #event. onPrompt was being held up as a selling point for CMUD - and I agree that events are. When I mentioned the change to expression trigs though, one person immediately said they were now serious about considering buying CMUD, and another guy (who had only recently begun to use CMUD) made me go through the creation of an autosipper using them.
On checking the help files, the only part I can find where it states that the expressions in exp trigs are only checked when a variable actually changes, is within the trigger types subsection of the trigger page. Most people never even knew they existed in zmud, and the people that do (that I have spoken to) are unaware that they are now efficient in CMUD. When I mention it, they are actually quite excited.
In summary:
* Eventually it would be nice for the #EVENT help file to be rewritten, however not a huge priority
* Might be a good idea to tout expression trigs a bit, make people aware of their existence. I love them, myself, and think they are a selling point.
* A combination of the two can be used to good effect as well. It might actually be worth a short tutorial on them in the future. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue May 06, 2008 1:47 am |
Mmm, people are under the impression that expression triggers suck, because they pretty much did in zMUD. I know when I changed from using them to using a prompt script, I saw an improvement, whatever the cause might've been. You're right that expression triggers are now great for things like that.
As for a tutorial, the more legwork you do, the less we have to do, and the more likely it is to happen. So post as much of an idea as you have ;) |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue May 06, 2008 3:15 am |
Yeah, Fang beat me too it. Expression Triggers were useless in zMUD, so many people don't think about them anymore. I'll have to add that somewhere to the "changes in CMUD" because I agree that they are very useful and powerful.
Remember that Gurus can update the help files too, so if you post some useful stuff here, you might see it magically appear in the help files at some point. Right now I haven't been spending *any* time on the help files, because I need to fix bugs first. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|