magneto Posted December 29, 2011 Share Posted December 29, 2011 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. Quote Link to comment Share on other sites More sharing options...
Andz Posted December 29, 2011 Share Posted December 29, 2011 Did you try to press Alt + E to edit the field contents? Quote Link to comment Share on other sites More sharing options...
magneto Posted December 29, 2011 Author Share Posted December 29, 2011 Did you try to press Alt + E to edit the field contents? Yes that's what I did, but after clicking Apply or Accept, turns the node into error state saying "unable to evaluate expression, syntax error" Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted December 29, 2011 Share Posted December 29, 2011 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. Quote Link to comment Share on other sites More sharing options...
magneto Posted December 29, 2011 Author Share Posted December 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 29, 2011 Author Share Posted December 29, 2011 I found it thanks to Symek who shows it here: { float dist = distance(0,0,0, $TX, $TY, $TZ); float div = dist / 5; return div; } 2 Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted December 29, 2011 Share Posted December 29, 2011 If your using hscript then you use the if() statement, which is a function that takes three arguments. There is also the ifs() for strings. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 30, 2011 Author Share Posted December 30, 2011 Thanks man, I didn't know they had that function either. It's all very useful. Quote Link to comment Share on other sites More sharing options...
Wout Posted October 25, 2021 Share Posted October 25, 2021 Thank youuuuuuuuu Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.