|
Hazram Wanderer
Joined: 24 May 2005 Posts: 71
|
Posted: Tue Sep 06, 2011 1:18 am
Run script when variable changes |
What's the best way to run a script when the value of a variable changes? There seems to be no way to match MXP entity publication with an MXP trigger, which is rather what I'm after, but running on a value change would actually be better.
It seems clear that button captions that are variables, as well as gauges, update themselves when the associated value changes, so I'm hoping to add similar functionality to a script, somehow. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4702 Location: Pensacola, FL, USA
|
Posted: Tue Sep 06, 2011 1:26 am |
A trigger of type expression is what you want, with the variable as the pattern
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Hazram Wanderer
Joined: 24 May 2005 Posts: 71
|
Posted: Tue Sep 06, 2011 1:30 am |
Aha. That looks like it will work perfectly. Thanks again Shalimar.
|
|
|
|
janibeg Newbie
Joined: 11 May 2011 Posts: 3
|
Posted: Fri Sep 16, 2011 7:53 am |
Can smb post any example pls
|
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Fri Sep 16, 2011 3:07 pm |
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger type="Expression" priority="28310" copy="yes">
<pattern>@test</pattern>
<value>#SAY The value of the test variable changed!</value>
</trigger>
</cmud> |
Then on the command line, type test = 1, test = 2, test = "abc", etc. |
|
|
|
|
|