This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
4rpl:commands:pingpong [2024/05/23 00:34] – created Karsten75 | 4rpl:commands:pingpong [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
:!: Available in version 2.5 and later. | :!: Available in version 2.5 and later. | ||
- | ====== | + | ====== |
PingPong (<-t < | PingPong (<-t < | ||
Line 15: | Line 15: | ||
===== Examples ===== | ===== Examples ===== | ||
<code 4rpl> | <code 4rpl> | ||
- | # need worked | + | # An example |
+ | # The brightness of the unit and beam fluctuates while paused. | ||
+ | # The interval of t is 60+60 frames = 4 seconds. | ||
+ | |||
+ | :once | ||
+ | # Running the code in :PostUpdate allows it to work while paused when inside a unit script. | ||
+ | RegisterForMSG(" | ||
+ | |||
+ | # To Differentiate against other units of the same type, the pulse time is set out of sync: | ||
+ | self getunittype 0 getunitsbytype -> | ||
+ | < | ||
+ | # tickcount instead of updatecount since this will run while paused. | ||
+ | |||
+ | # Creating a beam between the unit and another unit | ||
+ | " | ||
+ | < | ||
+ | < | ||
+ | |||
+ | : | ||
+ | <-t 1 add dup ->t 60 pingpong -> | ||
+ | self " | ||
+ | < | ||
</ | </ | ||
< | < |