Itoo Software Forum

Author Topic: Expressions?  (Read 768 times)

Macker

  • Jr. Member
  • **
  • Posts: 89
Expressions?
« on: June 14, 2016, 10:53:11 AM »
Hey guys, I've seen in a lot of the styles and tutorials that expressions are used to make certain things happen, but not being from a coding/mathematics background I look at them and genuinely have no idea what's going on. I have no idea whether it's written in a certain type of code (maxscript?) or what the syntax is, or what things I can control with it, etc.

Are there any tutorials around to help with this? I'm sure I can't be the only one.

iToo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3291
    • iToo Software
Re: Expressions?
« Reply #1 on: June 14, 2016, 04:55:09 PM »
Hi. No, it's not Maxscript. We actually use the same engine for Expression Controllers in Max. You can find a reference here. In next updates we have plans to replace it for our own language, used actually for Forest Effects.

There is not a specific tutorial for expressions, but you can find several resources there:

- RailClone guide->Parameters and attributes->Exercise: Exporting Attributes and simple maths with the Arithmetic operator.
- RailClone guide->Creating Conditional Relationships->Exercise: Creating conditions using the Selector operator and expressions.

The full list of functions and properties is available from the Expressions Editor.

I hope that helps, if you need more specific help, please don't hesitate to ask.
Carlos Quintero
iToo Software

viktaZ

  • Newbie
  • *
  • Posts: 2
Re: Expressions?
« Reply #2 on: June 05, 2018, 12:43:06 PM »
Hi there,
now, I am not new to programming and i've just started to use expressions, more like tried, really: what I've noticed is that my version of railclone doesn't really accept anything as an expression.

Example 1:
"Next Steps with Railclone" chapter 3 - Parameters and Attributes -> Exercise: Using Expressions, the floor tile model
Typing in the expression shown in the tutorial doesn't work, not even by copy-pasting the code in the expression, it returns a parse error. See "railclone_expression_parse_error.jpg" attached.

Example 2:
Since I could not get the expression work in example 1, I wanted to see if your parametric bridge tutorial works, shown here:  https://www.itoosoft.com/tutorials/bridge1
Replicating the same structure and input to Railclone as instructed in the tutorial returns the same parse error. See "railclone_expression_bridge.jpg" attached.

Neither did I have any luck trying to come up with simple expressions like "Input1+Input1", input 1 being a constant, with a value of 2. See attached "simple_expression.jpg"

I am using 3dsMax 2017 and Railclone Pro 3.1.0
I did notice that the expressions UI has changed since either of the tutorials above, maybe the syntax did too?
What am I doing wrong?

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 722
    • iToo
Re: Expressions?
« Reply #3 on: June 05, 2018, 01:03:59 PM »
Hi viktaZ,

Thank You for spotting this! This guide was done for RailClone v2. We should update this part.
Since RailClone 3 we have more powerful expression editor, though it requires a little modifications from v2.

expression "-1*(Input/4)" in v2 should be written in v3 like this:
return -1*(Input/4);

You should add "return" in start of "expression" and end it with ";"
Rokas
iToo Software

viktaZ

  • Newbie
  • *
  • Posts: 2
Re: Expressions?
« Reply #4 on: June 05, 2018, 01:52:52 PM »
Hi Rokas,

Thanks a lot, unsurprisingly, my expressions work now!

Another question is whether the iToo team would consider a full tutorial on expressions? It would be nice to have a complete written manual at least.
Just off the top of my head I have a few new questions:
- I assume that "return" is some kind of special function that outputs the expression, since it has to be named in the expression. What other "special" functions are there like "return"?
- As a semicolon has to be used, is it possible to give multiple expressions at the same time?

I understand that the expressions and functions do have their descriptions, but that doesn't help much with learning the syntax for example.
Anyway, thanks again!

Rokas

  • iToo Software
  • Hero Member
  • *****
  • Posts: 722
    • iToo
Re: Expressions?
« Reply #5 on: June 08, 2018, 01:50:35 PM »
Full tutorial? No plans in near future but feel free to ask questions.

We have some documentation here.

special functions like "return" ?
"Print" this prints output to evaluator instead of outputting it through the wire.
; ? Yes multiple expressions all the way!

example:

Code: [Select]
#declare vars:
real a =e; #e=2.71...
int b =2;
real In = Input1;

#compute:
real c= a*b*In;
print c;
return c;
Rokas
iToo Software