|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Nov 04, 2004 5:52 pm
Executing commands on variable value change |
I've been using the status window to show certain stats for a while, but recently changed to using #makewindow because you can se more than one window at once, and can set it to float similarly to how the status window is displayed. The question I have is based around how often the variables being displayed change and being able to automatically show changes without having to force a refresh each time.
For example, a variable I use called chealth (current health).
I have a small alias (updateScore) that will clear and repost the contents of a window to update with the latest chealth value. The problem I have is that there are a lot of messages that contain your current health, and it's not hugely efficient to tell every trigger that contains the current health to run updateScore.
For example, the mud prompt is:
1523>
(where 1523 is my current health)
If I'm hit then I might see:
Your health is at 1476
I bleed:
Your health is 1469
I check my score
You have 1469 of 1600 health remaining.
There are a number of other differently phrased messages that display current health and I've put in "chealth = %1" where appropriate, but I'd like to be able to have a completely separate check that does:
#if {chealth changes} {updateScore}
rather than putting 'updateScore' into every trigger concerning a change in current health.
I know the status window would do this, but chealth isn't the only thing that updates, and I'd like to be able to display different frequently updating variables in separate places without having to tell zmud to run the alias on every trigger.
So it's really a case of having something constantly check a variable and when it changes then run an alias.
Hope that makes sense, any help is much appreciated.
Guinn |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Thu Nov 04, 2004 8:45 pm |
#TRIGGER {@chealth} {updateScore}
An expression trigger. Whenever the value is changed the trigger commands fire.
This might not totally be the correct way to write it, but it sounds like what you're wanting. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Nov 04, 2004 11:33 pm |
Just the ticket. Thanks
Would think that after a few years using zMud I'd have noticed expression triggers earlier. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
|
|