Dynamic Variables/fr: Difference between revisions

From Resonite Wiki
Created page with "Les '''variables dynamiques''' vous permettent de lire et écrire des information depuis un simple nom. Elles rendent simple la gestion de données dans des systèmes larges; chaque bout de données est étiquetée correctement que vous pouvez décomposer en plusieurs '''espaces'''."
 
Created page with "En utilisant les variables dynamiques, il y a quelques restrictions sur le nommage sur les variables et espaces."
Line 8: Line 8:


== Restrictions de noms ==
== Restrictions de noms ==
<span lang="en" dir="ltr" class="mw-content-ltr">When using Dynamic Variables there are some restrictions and limitations on naming both spaces and variables within those spaces.</span>
En utilisant les variables dynamiques, il y a quelques restrictions sur le nommage sur les variables et espaces.


<span lang="en" dir="ltr" class="mw-content-ltr">Space and Variable Names '''cannot contain''':</span>
Les noms de variables et espaces '''ne peuvent pas contenir''':
* <span lang="en" dir="ltr" class="mw-content-ltr">Any symbols</span>
* Des symboles
** <span lang="en" dir="ltr" class="mw-content-ltr">As defined in C# [https://docs.microsoft.com/en-us/dotnet/api/system.char.issymbol?view=net-5.0 Char.IsSymbol]</span>
** Comme défini en C# avec [https://docs.microsoft.com/en-us/dotnet/api/system.char.issymbol?view=net-5.0 Char.IsSymbol]
* <span lang="en" dir="ltr" class="mw-content-ltr">Any Punctuation / Whitespace</span>
* Ponctuation / WhiteSpaces
** <span lang="en" dir="ltr" class="mw-content-ltr">As defined in C# [https://docs.microsoft.com/en-us/dotnet/api/system.char.ispunctuation?view=net-5.0 Char.IsPunctuation] and C# [https://docs.microsoft.com/en-us/dotnet/api/system.char.iswhitespace?view=net-5.0 Char.IsWhiteSpace]</span>
** Comme défini en C# avec [https://docs.microsoft.com/en-us/dotnet/api/system.char.ispunctuation?view=net-5.0 Char.IsPunctuation] et [https://docs.microsoft.com/en-us/dotnet/api/system.char.iswhitespace?view=net-5.0 Char.IsWhiteSpace]
* <span lang="en" dir="ltr" class="mw-content-ltr">'''Except''' for period (.), underscore (_) and space ( ).</span>
* '''Excepté''' pour les points (.), underscore (_) et espaces ( ).


== <span lang="en" dir="ltr" class="mw-content-ltr">Usage</span> ==
== Utilisation ==


<span lang="en" dir="ltr" class="mw-content-ltr">Optionally, the name can be prefixed by the name of a '''space''', terminated by a /, to choose a specific variable space to use. This is useful to distinguish between unrelated systems that all use dynamic variables.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Optionally, the name can be prefixed by the name of a '''space''', terminated by a /, to choose a specific variable space to use. This is useful to distinguish between unrelated systems that all use dynamic variables.</span>

Revision as of 12:00, 25 January 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Aperçu

Les variables dynamiques vous permettent de lire et écrire des information depuis un simple nom. Elles rendent simple la gestion de données dans des systèmes larges; chaque bout de données est étiquetée correctement que vous pouvez décomposer en plusieurs espaces.

Restrictions de noms

En utilisant les variables dynamiques, il y a quelques restrictions sur le nommage sur les variables et espaces.

Les noms de variables et espaces ne peuvent pas contenir:

Utilisation

Optionally, the name can be prefixed by the name of a space, terminated by a /, to choose a specific variable space to use. This is useful to distinguish between unrelated systems that all use dynamic variables.

Some valid names include:

  • Health -- no space defined, named Health
  • World/Color -- named Color, in the World space
  • MyCoolSystem/Score -- named Score, in the MyCoolSystem space

Spaces

Dynamic variables can live anywhere in or under the slot containing a DynamicVariableSpace component.

So, a variable space on the world root can be used from anywhere, whilst a variable space on your avatar can be used from anything stored in your avatar.

Variables

The simplest way to use dynamic variables is to use the DynamicValueVariable<T> and DynamicReferenceVariable<T> components. These are for value (int, float, String, etc.) and reference (Slot, User, etc.) types, respectively.

These components store a value or reference directly. If two variable components have the same name, then they will have identical contents.

Fields

If you want to use an existing field or reference as the contents of a dynamic variable, you can use the DynamicField<T> or DynamicReference<T> components. Instead of storing something directly, they point at a field that contains a value or reference type, respectively.

(TODO: clarify value vs. reference types; I think this isn't fully correct)

Drivers

You can use the contents of a dynamic variable to drive a field or reference, using the DynamicValueVariableDriver<T> and DynamicReferenceVariableDriver<T> components.

Unlisted types

When creating a dynamic variable component, you will be given a list of "common types". If the type you seek is not in that list, you will have to enter it by hand. See Complex Types in Components.

Warning

Creating, duplicating, or moving a dynamic variable requires binding that variable to its space. This usually takes a small amount of time, before which the dynamic variable can appear to be present, but not be readable or writable. Therefore, if you create a dynamic variable using the Create Dynamic Variable or Write Or Create Dynamic Variable ProtoFlux Node, or cause it to be duplicated using the Duplicate Slot ProtoFlux Node, or cause it to be moved using the Set Parent ProtoFlux Node, you may find it necessary to add an Updates Delay or Updates Delay With Value ProtoFlux Node afterwards in order to ensure the dynamic variables have been bound by the time you use them. A delay of 1 to 3 updates usually suffices.