Some useful Hscript commands (test in Hscript textport):
- abs()
- atof(): converts a string to a float
- bbox()
- ceil()
- centroid()
- clamp(value, min, max)
- fit()
- floor()
- frac() -> only keep fraction of an integer
- if(condition, float if true, float if false)
ifs(condition, string if true, string if false) - max(a, b) -> often use to set the min threshold
min(a, b) -> often use to set the max threshold - opcreator(“.”): returns path to its parent node
- opdigits: return numeric digit of node name
Ex:
opdigits(“.”) => digit number of node self - opfile: returns the type of the node
- opinputpath: returns full path to the node connected to a certain node
Ex:
opinputpath(“.”, 0) - opname(“.”) = $OS
- opparm: get/set parameters on a node
opparm [-q] [-r] [-C] [-V version] operator_pattern [-v [-p | -i]] parameters value -> sets parameter values
Ex:
opparm /obj/geo1/null1/ seed 10 -> sets seed to 10
opparm -l /obj/geo1/transform1 *x *y *z
opparm -d /obj/geo1/* *x
opparm -r /obj/geo1/transform1/ ty 5 -> trace back to original reference and set to 5 - padzero( : pad a number with leading zeros
Ex:
padzero(5, 1234) -> 01234
padzero(7, 9499) -> 0009499 - point(“node”, ptnum, attrib, index)
- pythonexprf(Python expr) -> returns float
pythonexprs(Python expr) -> returns string - rand()
- round()
- sqrt()
- stamp(“node”, “variable name”, value) -> stamp an attribute downstream
- strlen(string): returns length of string
- strmatch(“*pattern to match*”, string): bool function to find if there’s a match in given string, pattern does take wildcard
strcasematch -> case insensitive version of strmatch - strreplace(string, old str, new str)
- substr(string, start, length): returns a substring of a string
- trunc() -> ignore the fraction part of an integer