User Tools

Site Tools


prpl:operatewhilepaused

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
prpl:operatewhilepaused [2016/12/02 18:33] – external edit 127.0.0.1prpl:operatewhilepaused [2018/06/14 18:10] (current) – fixed link kajacx
Line 1: Line 1:
-<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#everything_else_2|Everything Else 2]]+<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#Scripts|Scripts]]
  
-=====  OPERATEWHILEPAUSED  =====+=====  OperateWhilePaused =====
  
 ^Arguments^Result^Notation^ ^Arguments^Result^Notation^
-| | | [ - ] |+bool | | [ bool - ] |
  
  
 === Description === === Description ===
 +Set whether the Core will operate while the game is paused. Good for animations or buttons.
 +
 +This may need to be called in :awake to guard against save/load. (Untested, may work without)
 +
 +This command is per script, not per Core. So, should a Core carry multiple copies of a script, or muliple different scripts, some may OperateWhilePaused while others do not.
 +
 +[[.:ispaused|IsPaused]] is useful to combine with this command.
 +
 +Note: This command must be run before taking effect - place in [[,:awake|:awake]], [[.:gameloaded|:GameLoaded]] or just unpause until this command executes.
 +
 +Note: It is recommended to disable this mode in [[,;destroyed|:destroyed]] if used, to prevent the carryover issues that CRPL sometimes had with it. It may not be necessary.
  
 === Examples === === Examples ===
-<code> operateWhilePaused = GetIntFromStack() == 1;  +<code prpl
-  +once 
-</code>+    @awake #On recompile, do what would be done when the game is loaded. 
 +    0 ->CirclePoint 
 +endonce
  
 +GetMousePosition CurrentPixelCoords Distance 6 lt if #Mouseover
 +    "Hello" SetText
 +endif
 +
 +IsPaused if
 +    return #Only go on if the game is running
 +endif
 +
 +
 +#We shall move in a circle around the lower-left corner of the map. But not if the game is paused.
 +<-CirclePoint 0.03 add ->CirclePoint
 +Self
 +<-CirclePoint cos 20 mul
 +<-CirclePoint sin 20 mul
 +SetUnitPixelCoords
 +
 +:awake
 +    1 OperateWhilePaused
 +    
 +:destroyed
 +    0 OperateWhilePaused
 +</code>
prpl/operatewhilepaused.1480721632.txt.gz · Last modified: 2017/07/06 06:05 (external edit)