Attribute Chaining Rules
In 3D Basic, you can attach attributes to an object using dot notation. However, there are strict rules to keep the code readable and unambiguous.
--------------------------------------------------------------------------------------------------
Maximum Number of Attributes
An object can have at most two attributes in sequence.
Syntax:
ObjectName.attribut1.attribut2 = value/literal
--------------------------------------------------------------------------------------------------
Using Surface Names
You can also target a specific surface of an object:
ObjectName.surfaceName.attribut1.attribut2 = value/literal
In this case, surfaceName is not counted as an attribute. It simply specifies a part of the object. So even here, there are still only two attributes maximum.
--------------------------------------------------------------------------------------------------
Why This Limitation Exists
The limitation is intentional:
-
It keeps the code easy to read
-
It prevents ambiguity in how the interpreter understands the code
-
Long chains of attributes would quickly become confusing and error-prone
If you need to apply multiple properties to an object, you should use multiple lines instead of chaining.
--------------------------------------------------------------------------------------------------
Important Rule
Even though two attributes are allowed, only specific combinations are valid.
You cannot combine any two attributes arbitrarily—the interpreter only accepts predefined combinations.
--------------------------------------------------------------------------------------------------
Valid Example
box1.animate.rotate = (0,0,0) to (0,360,0)
Here, animate and rotate are a valid combination, allowing rotation animation.
--------------------------------------------------------------------------------------------------
Invalid Example
The following code is not valid:
10 box1.size.color.move.animate = (2,2,2) red (0,1,0) (0,0,0) to (5,0,0) : box1.draw
The interpreter cannot understand this because too many attributes are chained together.
Correct Approach
To achieve the same result, split the code into multiple lines:
10 box1.size = (2,2,2)
20 box1.color = red
30 box1.move = (0,1,0)
40 box1.animate = (0,0,0) to (5,0,0)
50 box1.draw
This approach is clearer, easier to maintain, and fully supported by the interpreter.