RUBY SCRIPT INTERMEDIATE

MIXED SCRIPT

The mixed script are a kind of script applied to the model and works thanks physical objects and scripting at the same time.They are very important because are the main source to do complex action and algoritm.The script below are the exential knowledges to applicate mixed script:

-Switch On\Off;

-Jonh compass;

-Setter boxes.

Here it is the explication of this scripts.

SWITCH ON\OFF

It's the script with the hugest application and my favourite one.It's complicated on its semplicity,are 3 boxes,2 of these are on air setted on static and one it's on the floor.The 2 boxes,that we'll call A and B,has 2 different script:

OnTouch\

```setVar('a',1)
```

and the B box:

OnTouch\

```setVar('a',0)
```

The C box must have the blue axis that look at A box(or B box if you prefer).Then set the C box:

Thruster\

```key('#insert an X key#')+key('#insert an Y key#')*-1
```

or if you prefer:

Thruster\

```key('#insert an X key#')-key('#insert an Y key#')
```

Where when you press an X key you touch tha A box you set the Var('a')==1,if you press the Y key you set the Var('a')==1;else the Var('a)'==0.It's very useful when you have to do an action during the time or after a specific action.There are a lot variation of this basical system,for example in my Derek's berlina the A box was connected to the car and the C box to a spring in a car,and the B box was on the floor,then when the car had a impact the inertia did touch the box A and after that the B box reset the Value of Var('a')==0.

JONH COMPASS

It's a very particular M script,it consist in a box with a motor connected on a corner with all around boxes in circle with this code:

OnTouch\

```setVar('#insert different Var for each box#',1)
```

Then when the rotating box turn and touch the boxes(on air,setted static) setVar(' #Var X# ')==1.

It was projected by a friend of mine, jonh,but the first application is the orandif 's escalator;where the compass start with an imput key and finish with a closing Var on the last box of this circle.

SETTER BOXES

It's a fondamental system to setVar.It's very simple;a boxes has this setting:

OnTouch\

```setVar('a',1)
```

Then when the box touch set Var('a')==1,but be careful because if the box is OnTouch since the start of simulation start the freeze effect,in short terms the box doesn't set the Var,to resolve this problem set the box on NoAutoFreeze(UI).Remember this 2 thing:

-A Var unsetted it's ==0,

-When a Var is setted,is setted till will get an other value,

to resolve the second problem you have to make another box NoAutoFreeze with this script:

OnTick\

```setVar('a',0)
```

Then when the a box touch Var('a')==1;else B box setVar('a')==0.

A lot of models use this thing,but the first was the sofie9536's magnetic rocket,that uses an OnTouch cilinder to start The magnet Thruster.

I'VE TALKED ABOUT MODELS AND MODELLER THAT I KNOW AND I'VE TRIED ALL IS DESCRIBED IN THIS SECTION,BUT NO ONE SAY THAT YOU CAN'T MODIFY THIS ARTICLE!