CONTENTS
Part 1: Introduction: What does the Script object do ?
Part 2: How the Script object is related to the objects, linked to it ?
Part 3: Understanding the code: float Score (variable)
Part 4: Understanding the code: void Main
Part 5: Understanding the code: IN_22
Part 6: Understanding the code: OUT_0
Part 1: Introduction: What does the Script object do ?
We don't write a new script here, we'll try to understand the one that comes with 3DRad.
So I took as a basis ScoreDemo.3dr sample project, that comes with 3DRad.
It contains a script. If we open the script, we'll see the code:
float Score = 0;
void Main()
{
if (IN_22 > 0)
{
Score = Score + 1;
}
OUT_0 = Score;
}
What does this stuff mean ?
What is...
- ... float ?
- ... Score ?
- ... void Main() ?
- ... if ?
- ... IN_22 ?
- ... OUT_0 ?
- ... { } (brackets)?
1) The first thing one need to understand is how the Script object is related to other objects in the project.
Let's click once on the Script object - it must become highlighted with red.
(see 'RelatedObjects' picture below)
We see that if the script is highlighted with red, then the objects, which are related to the script, are checked (EventOnContact and ValuePrint in the project).
So the Script object is like a PC: it gets data from other objects and sends data to them.
(see 'DataInOut' picture below)
(to be continued...Part 2)
Part 1: Introduction: What does the Script object do ?
Part 2: How the Script object is related to the objects, linked to it ?
Part 3: Understanding the code: float Score (variable)
Part 4: Understanding the code: void Main
Part 5: Understanding the code: IN_22
Part 6: Understanding the code: OUT_0
Part 1: Introduction: What does the Script object do ?
We don't write a new script here, we'll try to understand the one that comes with 3DRad.
So I took as a basis ScoreDemo.3dr sample project, that comes with 3DRad.
It contains a script. If we open the script, we'll see the code:
float Score = 0;
void Main()
{
if (IN_22 > 0)
{
Score = Score + 1;
}
OUT_0 = Score;
}
What does this stuff mean ?
What is...
- ... float ?
- ... Score ?
- ... void Main() ?
- ... if ?
- ... IN_22 ?
- ... OUT_0 ?
- ... { } (brackets)?
1) The first thing one need to understand is how the Script object is related to other objects in the project.
Let's click once on the Script object - it must become highlighted with red.
(see 'RelatedObjects' picture below)
We see that if the script is highlighted with red, then the objects, which are related to the script, are checked (EventOnContact and ValuePrint in the project).
So the Script object is like a PC: it gets data from other objects and sends data to them.
(see 'DataInOut' picture below)
(to be continued...Part 2)