Advertisement
JademusSreg

Register Button Trigger Demo

Mar 5th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. // Constant pseudo-enums
  2. const bool DataTableScopeGlobal = true;
  3. const bool DataTableScopeLocal  = false;
  4.  
  5. const bool TriggerTestConditions   = true;
  6. const bool TriggerIgnoreConditions = false;
  7.  
  8. const bool TriggerRunInSeparateThread = false;
  9. const bool TriggerRunInSameThread     = true;
  10.  
  11. // Constant
  12. const string RegisterButtonKeyPrefix = "TriggerButton";
  13.  
  14. // Function to register a button to run a specific trigger
  15. void RegisterButtonForTriggerExecution (int button, trigger buttonTrigger)
  16. {
  17.     DataTableSetTrigger(DataTableScopeGlobal,RegisterButtonKeyPrefix+IntToString(button),buttonTrigger);
  18. }
  19.  
  20. // Example trigger action
  21. bool ExampleButtonTriggerAction (bool textConditions, bool runActions)
  22. {
  23.     int player = EventPlayer();
  24.     int button = EventDialogControl();
  25.     string key = RegisterButtonKeyPrefix+IntToString(button);
  26.     if (DataTableValueExists(DataTableScopeGlobal,key))
  27.     {
  28.         TriggerExecute(DataTableGetTrigger(DataTableScopeGlobal,key),TriggerTestConditions,TriggerRunInSeparateThread);
  29.     }
  30.     return true;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement