How Hscript and Expressions are different?

   629   5   2
User Avatar
Member
27 posts
Joined: Sept. 2019
Offline
Hi, I'm new to houdini and found concept of Hscript and Expressions quite confusing for me. I could find out there were several languages such as Python, VEX, Hscript etc for Houdini. Maybe this is a stupid question but it's pretty confusing to me whether Hscript is Expressions or they're different while they're compatible each other (like Expressions as a distinct language itself). I googled and found some answers but I couldn't get clear answer yet. In some sources it seemed they were explaining as if Hscript was something distinguishable from Expressions while it seemed some others were explaining otherwise. I was studying Hscript and felt like I couldn't put this curiosity back anymore.
User Avatar
Staff
4737 posts
Joined: July 2005
Offline
It isn't a stupid question.

hscript is a shell-like language, similar to csh or bash.

However, when you use back-ticks to escape it doesn't run shell commands, but a separate expression language. This is also the language that is used by default in parameters.

If you open a textport in Houdini (Windows::Textport) and type
3 + 2
it doesn't work because it tries to run the command 3

But
echo `3 + 2`
will invoke the expression language and evaluate 3+2.

I tend to call the expression language EXPR, but most people will just call it HScript. But I think it is simplest to think of there being Python VEX, Hscript, and Hscript Expressions as separate languages to learn. It is likely you don't have to learn HScript, only Hscript expressions, for example. Most of what hscript did is better done with python.

Our goal was to remove both Hscript and Hscript expressions and replace them with Python. Due to performance issues, however, HScript Expressions are likely to stick around.
User Avatar
Member
4964 posts
Joined: July 2007
Offline
jlait
Due to performance issues, however, HScript Expressions are likely to stick around
for this reason it would be nice to expand docs a bit to describe syntax of hscript expressions, since the art of doing {} multiline hscript expressions is almost lost because there are no docs for it and one can't just use ‘if’ syntax from HScript
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
178 posts
Joined: Jan. 2013
Offline
I “rediscovered” Hscript a little bit recently when using it to run Houdini in terminal mode instead of Hython. As a shell-like experience I find it nicer than using Python as the syntax is cleaner and easier to type, for example when listing the contents of a network and rendering:

Python:
o = hou.node('/out')
print o.children()
o.node('mantra1').render()


Hscript:
cd /out
ls
render mantra1
User Avatar
Member
27 posts
Joined: Sept. 2019
Offline
I don't have much experience in programming or computer science (just a bit of C) so I don't know what exactly ‘shell-like’ means, but these helped me a lot to get an outline of my study afterward, thank you!
User Avatar
Member
178 posts
Joined: Jan. 2013
Offline
Ah when I say shell, I mean how you would type in a Linux (or Mac) command line terminal.
  • Quick Links