Jump to content

Is there a way to use multi-line expressions?


magneto

Recommended Posts

One of the expression I need to use requires multiple lines, but since it's very specific, I don't want to create an expression function for it.

Can I use multi-line statements using the expression editor? I tried this but didn't work:

float CalculateSize ()
{
    return 1;
}

CalculateSize();

It's hscript.

Thanks.

Link to comment
Share on other sites

The expression editor does allow you to using multiple lines. It will save the expression with a \n as the newline character, but it still has to all be part of a single line expression.

As a work around, break your expression down into multiple parts and create a few custom parameters. Each custom parameter can eval part of the expression. I sometimes do this, and it makes it easier to read/debug.

Link to comment
Share on other sites

The expression editor does allow you to using multiple lines. It will save the expression with a \n as the newline character, but it still has to all be part of a single line expression.

As a work around, break your expression down into multiple parts and create a few custom parameters. Each custom parameter can eval part of the expression. I sometimes do this, and it makes it easier to read/debug.

Thanks, that would work too. But I still need to use an if conditional to chose which value to use. Do you know the if syntax for single line expressions?

Because using this didn't work either:

if ($TX < 1) 0.5 else 1

Link to comment
Share on other sites

  • 9 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...