Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: djibvongenf on April 24, 2022, 10:07:35 PM

Title: Window expression error
Post by: djibvongenf on April 24, 2022, 10:07:35 PM
Hello,

(https://www.youtube.com/watch?v=bhICkZ3873A&ab_channel=iTooSoftware)
im following this tutorial, works fine so far but im now facing a problem where this expression ->

if(YSplinePosition = 0,3,
if(YSplinePosition = 1,1,2))

is getting an error ->
Parse error. Expected ')' or ',' in argument list at line 1:
if(YSplinePosition=0,3,

the vertical middle window part does not work due to the error on the script. I guess. Since i have no knowledge into scritping, even basic.

thank you
Title: Re: Window expression error
Post by: Dragan on April 25, 2022, 12:05:21 AM
Hi. This is old tutorial for previous RC.
Now you need to start with "Return" and end with ";" to send the results. Also, use double "==" for if statement.

Return
if(YSplinePosition == 0,3,
if(YSplinePosition == 1,1,2));


https://docs.itoosoft.com/railclone/style-editor/operators?_gl=1

RailClone 3 included a new expressions engine. Be aware that there are a couple of key changes to remember.

The new version uses a double == for conditional tests
The way you write numbers is now important, for example in RailClone 3:

1 = an integer
1.0 = a float

This means that in RailClone 3 the expressions:

return 1/2;
Will result in 0, because both values are integers.

To return a float value you would use:
Return 1.0/2.0;
To send a value to the arithmetic node's output you must add a return command, for example:

return degToRad(90);