Set Reference: Difference between revisions
-u ndefined- (talk | contribs) (Rework on example, with meaningful image names, use existing templates) |
(Added references to the List page) |
||
Line 8: | Line 8: | ||
}} | }} | ||
Like [[Set Variable]], but with an additional input for the variable to store the value in. This enables you to store a variable in a [[List | Like [[Set Variable]], but with an additional input for the variable to store the value in. This enables you to store a variable in a [[List]] by connecting [[List Element]] to the Variable port, or make custom [[Script Block|script block]]s that modify variables. | ||
In the early days of Fancade, this was the only way to set a variable's value. | In the early days of Fancade, this was the only way to set a variable's value. | ||
Line 16: | Line 16: | ||
== Example == | == Example == | ||
You can find an example of making lists in the [[List | You can find an example of making lists in the [[List]] page. This page will focus on another use. | ||
We will recreate the [[Increase Number]] block (by using a script block): | We will recreate the [[Increase Number]] block (by using a script block): | ||
Line 32: | Line 32: | ||
== Related == | == Related == | ||
* [[List]] | |||
* [[List Element]] | * [[List Element]] | ||
* [[Set Variable]] | * [[Set Variable]] | ||
[[Category:Blocks]] | [[Category:Blocks]] |
Latest revision as of 21:20, 4 July 2024
Like Set Variable, but with an additional input for the variable to store the value in. This enables you to store a variable in a List by connecting List Element to the Variable port, or make custom script blocks that modify variables.
In the early days of Fancade, this was the only way to set a variable's value.

Example
You can find an example of making lists in the List page. This page will focus on another use.
We will recreate the Increase Number block (by using a script block):

This script block takes a variable, either by Get Variable or List Element. We have the increased number, now we have to set that value to the input variable, but how?
Set Variable cannot work in this case as it can only modify the variable as deemed by the user for the entire duration. And worse, it is by default local and so the variable we would like to increment remains unchanged. Other variable modes are impractical as well.
Therefore, we will have to use a more versatile script block. Set Reference allows to modify the variable on the left-hand side as named by the user:
