String value inside IF statement in HScript

   5613   2   1
User Avatar
Member
34 posts
Joined: Jan. 2017
Offline
I have an issue with this code, using string value:

if(ch("../../show_units") == 1, 
chs("../../units"),
"zero")

However when I use numeric value, or if I use string outside if statement, it runs ok

if(ch("../../show_units") == 1, 
ch("../../units"),
0)

I'm using this expression script inside a Text parameter of Font SOP.
User Avatar
Member
1908 posts
Joined: Nov. 2006
Online
You just need to use the ifs() expression to return a string; the if() expression is for numerical values.
ifs(ch("../../show_units"), chs("../../units"), "zero")
Edited by graham - Feb. 5, 2017 13:29:57
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
34 posts
Joined: Jan. 2017
Offline
Curious singularity a specific conditional statement for numeric and for string in HScript.

Thank you so much for clarification graham!
  • Quick Links