How Hscript and Expressions are different?

   4956   6   2
User Avatar
Member
28 posts
Joined: 9月 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
スタッフ
6169 posts
Joined: 7月 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
8525 posts
Joined: 7月 2007
Online
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: 1月 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
28 posts
Joined: 9月 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: 1月 2013
Offline
Ah when I say shell, I mean how you would type in a Linux (or Mac) command line terminal.
User Avatar
Member
177 posts
Joined: 8月 2018
Offline
It would be so helpful if the Houdini documentation dealing with HScript contained a first page introduction based on jlait's post above. It would save so much time and frustration for new users.
  • Quick Links