Difference between revisions of "Directive-value"

From FreeSpace Wiki
Jump to: navigation, search
m (Notes: typo)
(Example: added note)
 
Line 55: Line 55:
 
  +Trigger Count: 4
 
  +Trigger Count: 4
 
  +Interval: 1
 
  +Interval: 1
 +
 +
===Note on the example===
 +
Notice that in the first event, the conditional reads ( is-disabled-delay 1 ), not ( is-disabled-delay 0 ) like you would script any traditional directive. If you have a dynamic directive-value assigned to your directive text, and you use the delay of 0, your completed directive text will read "Disable Science Vessels [1]" instead of the intended "Disable Science Vessels" (without a number). The delay of 1 ensures that the directive text has a whole second to update itself as soon as the variable turns 0. Note that this is a visual oddity only.
  
 
[[Category:SCP SEXPs]]
 
[[Category:SCP SEXPs]]

Latest revision as of 18:32, 8 May 2021

directive-value
	Causes a value to appear in the directive count
	Always returns true. Takes 1 or more arguments...

	1:	Value
	2:	(Optional) Ignore the directive count set by any earlier SEXPs in the event. If set to false it will add instead

Notes

  • An earlier version was called: directive-is-variable
  • Found in Status --> Mission and must be a subordinate to "and". (see example)
  • If set to 0, no number will appear
  • A variable is typically paired with this SEXP. In this case, the value does not require a trigger/repeat count—the event that does the counting, on the other hand, does.

Example

$Formula: ( when-argument 
   ( every-of 
      "Newton" 
      "Novalis" 
      "Restoration" 
      "Lytcha" 
   )
   ( and 
      ( is-disabled-delay 1 "<argument>" ) 
      ( directive-value 
         @faustus-disable-num[4] 
      )
   )
   ( do-nothing ) 
)
+Name: Disable dir
+Repeat Count: 1
+Interval: 1
+Objective:  XSTR("Disable Science Vessels", -1)
$Formula: ( when-argument 
   ( any-of 
      "Newton" 
      "Novalis" 
      "Restoration" 
      "Lytcha" 
   )
   ( is-disabled-delay 0 "<argument>" ) 
   ( modify-variable 
      @faustus-disable-num[4] 
      ( - @faustus-disable-num[4] 1 ) 
   )
   ( protect-ship "<argument>" ) 
   ( ship-invulnerable "<argument>" ) 
   ( add-remove-escort "<argument>" 0 ) 
   ( invalidate-argument "<argument>" ) 
)
+Name: faustus-disable-num
+Repeat Count: -1
+Trigger Count: 4
+Interval: 1

Note on the example

Notice that in the first event, the conditional reads ( is-disabled-delay 1 ), not ( is-disabled-delay 0 ) like you would script any traditional directive. If you have a dynamic directive-value assigned to your directive text, and you use the delay of 0, your completed directive text will read "Disable Science Vessels [1]" instead of the intended "Disable Science Vessels" (without a number). The delay of 1 ensures that the directive text has a whole second to update itself as soon as the variable turns 0. Note that this is a visual oddity only.