Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: 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.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4702
Location: Pensacola, FL, USA

PostPosted: Tue Sep 06, 2011 1:26 am   
 
A trigger of type expression is what you want, with the variable as the pattern
_________________
Discord: Shalimarwildcat
Reply with quote
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Tue Sep 06, 2011 1:30 am   
 
Aha. That looks like it will work perfectly. Thanks again Shalimar.
Reply with quote
janibeg
Newbie


Joined: 11 May 2011
Posts: 3

PostPosted: Fri Sep 16, 2011 7:53 am   
 
Can smb post any example pls
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net