dictionary:events:createevent
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
dictionary:events:createevent [2014/02/23 19:05] – external edit 127.0.0.1 | dictionary:events:createevent [2021/02/15 13:26] – [Passing Parameters To A Handler Example] James Sentman | ||
---|---|---|---|
Line 15: | Line 15: | ||
**with no script** (perform the action, but dont run the unit scripts)\\ | **with no script** (perform the action, but dont run the unit scripts)\\ | ||
**weekdays** (7 character string in the form of " | **weekdays** (7 character string in the form of " | ||
+ | **handler** (string, name of the handler) If executing a script you can optionally specify the handler to call rather than just running the script. This value is ignored unless the event is to execute a script. | ||
+ | **parameter** A list of items to be optionally passed to the handler. Only valid if you are executing a handler in the script. The number of parameters in the list must be the same as expected by the handler. | ||
===Examples: | ===Examples: | ||
Line 28: | Line 30: | ||
create event " | create event " | ||
</ | </ | ||
+ | |||
+ | ==Passing Parameters To A Handler Example== | ||
+ | if you had a global script named “meal manager” with a handler named “mealLogger” like this: | ||
+ | < | ||
+ | on mealLogger( theName, theEvent) | ||
+ | write log theName & “ has had “ & theMeal | ||
+ | end doThing | ||
+ | </ | ||
+ | |||
+ | and then created an event such as this: | ||
+ | |||
+ | < | ||
+ | create event “breakfast” that executes script “meal manager” handler “mealLogger" | ||
+ | </ | ||
+ | |||
+ | in 10 minutes you would see output in the log like: | ||
+ | |||
+ | **jamie has had breakfast** | ||
+ | ===History: | ||
+ | The optional “handler” parameter was added in XTension 9.4.21 |
dictionary/events/createevent.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1