So verwenden Sie Vizzy zum Erstellen dynamischer Variablen in Juno: Neue Ursprünge

Describes how to (abuse) Vizzy to create dynamic variables and fakestructvariables within Vizzy.

Haftungsausschluss

This guide uses an undocumented feature of Vizzy and may therefore break in future Juno releases without warning. This is verified to work on version 1.1.109.0 (the current PC version as of 9/9/23).

Einführung

Vizzy supports three data types:

  • Floating point numbers,
  • Vectors, which are three floating point numbers,
  • Strings

Zusätzlich, Vizzy supports a list data type, and each entry on a list can be any of the three above types (there is no requirement for all items in the list to be of the same type).

For most purposes this is sufficient, Aber… For some applications, it would be helpful to store a list of values ohne using the list data type.

Why avoid the list data type?

  1. The main reason is that it is very, very slow. I’m aware that 1.1.109 claims to have improved the performance of lists — jedoch, by the time that this version was released I had discovered and fully committed to this implementation, So…
  2. Zusätzlich, the Vizzy blocks for working with lists are awkwardly large. They may be easy to understand, especially for users without a programming background, but if you are planning on writing complex applications in Vizzy the large size becomes an issue.
  3. Lists can not be accessed via FUNK expressions. For more complex mathematical expressions, it is advantageous to place the math in a FUNK expression rather than constructing it with Vizzy blocks. If your equation uses lists, jedoch, this option will be far, far less attractive.
  4. In complex applications, the explicitly declared variable list (the green blocks) will become awkwardly large. Or even absurdly large. Anything that can remove items from this list is highly desirable in complex applications.
  5. It is possible to create a complex data structure that contains another complex structure. EIN “List of Lists”, as it were. This is the only thing that this technique can do that lists cannot do.

Wie man

Hoffentlich, you are very familiar with theset variable [] zu []” Vizzy block. The logic is simpleyou define a variable (via theCreate Variable” Taste) which creates a green block, which you then drag to first blank in theset variable [] zu []” Block, then put whatever you want on the right hand side to tell Vizzy what value to set the variable to.

Aber…

What if you didn’t define and place a green block in the first blankwhat if you did Dies stattdessen:

Die Antwort ist “The value of ‘1is assigned to the variable ‘Active_Craft_ID’.” — put another way, it does the exact same thing as the first example.

What if you have not defined (via theCreate Variable” Taste) a variable ‘Active_Craft_ID”? Brunnen, the value still gets assigned to a variable named ‘Active_Craft_IDbut you obviously cannot retrieve the value via a green block. More on this in a bit.

What about this:

This also works as you would hope — Am Ende, du wirst haben 10 variables, namedTesting1” – “Testing10”, all assigned a value of 1.

The next question isHow do I access a variable that was created this way?” This will not work, offensichtlich:

This assigns the stringTesting1to the variableActive_Craft_IDwhen we were hoping to assign the value of the variableTesting1” zu “Active_Craft_ID.

Jedoch, FUNK can solve the problem — standardmäßig, if you specify a variable name in a FUNK string, it is interpreted as a variable name. Daher, Dies does arbeiten:

There are two significant caveats to this, jedoch:

  1. FUNK expressions have NEIN support for strings. This even applies to variables. If you specify the name of a variable that contains a string and then try to access it via a FUNK expression, the result will be the number 0. Daher, while you can assign strings to dynamic variables (as described above) but unless you use theCreate Variablebutton to create a green block for the variable you will not be able to access the value.
  2. FUNK expressions assume variables are floating point numbers unless told otherwise. If you have stored a vector in a dynamic variable, you will need to prefix the variable name with “v:” to tell FUNK that the variable contains a vector.

This is the correct way to access a vector stored in a dynamic variable:

This code will assign vectors to 10 variables, then output the 10 vectors to the local log:

Endlich, I have verified that dynamic variables

Tunget serialized when a craft is saved (via examining the XML file). I have not yet verified that the values are restored properly, although I’m 99.9 % certain that they are.

More advanced topics

It is highly useful to definehelper functionsthat make it easier to extract specific values from a group of similar values. Das sieht so aus:

All of these functions accept a single parameter, which is a string that represents a group of related variables, then returns one specific variable from the collection.

If you want to do math with dynamic variables, I recommend using FUNK expressions (rather than the helper expressions) when feasible. Das sieht so aus:

It is also possible to achieve the same result via the “Format” Block (rather than theJoin” Block), although I believe the join block is faster. Das sieht so aus:

Fazit

That’s all folksnow you too can dynamically define your Vizzy variables, freeing you from the need to add tons and tons of variables to your variable list.

Dieser Leitfaden über Juno: Neue Ursprünge wurde geschrieben von mreed2. Von hier aus können Sie die Originalveröffentlichung besuchen Verknüpfung. Wenn Sie Bedenken bezüglich dieses Leitfadens haben, Bitte zögern Sie nicht, uns zu erreichen hier.

Über den Autor