set () to ()

From PenguinMod Wiki (Official)
Set () to () (Variables)
Jump to navigation Jump to search

This article is about the block in the Variables subcategory. For other uses, see set (disambiguation).

The set () to () block is a stack block in the Variables subcategory that sets the selected variable to the inputted value. It originates from Scratch.

It can be used to reset values when the blue flag or an event occurs:

when gf clicked
set [score v] to (0)

Or:

when I receive [start level v]
set [seconds remaining v] to [100]
go to x: (startX::grey) y: (startY::grey)

Workaround

This block can be worked around by using the change () by () block with the () - () block used in the input (the 1st input of the () - () block would be the value that one is trying to set the variable to, while the 2nd input would be the variable used):

define set variable to (value)
change [variable v] by ((value) - (variable))

However, this workaround only works with numbers.