20.08.2015 Views

1 Scripting

1 Scripting - Digital Cinema Arts

1 Scripting - Digital Cinema Arts

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The <strong>Scripting</strong> LanguageGUESSING GAMEThe following is a simple script which illustrates the use of loops, conditional execution,and variables. For more examples, see the <strong>Scripting</strong> section of the UserGuide.# Houdini command script for the guessing game (guess.cmd)# First, let’s get a random seedset foo = `system(date)`set seed = `substr($foo, 14, 2)``substr($foo, 17, 2)`# Then, pick a random numberset num = `int(rand($seed)*100)+1`set guess = -1echo Guess a random number between 1 and 100.while ( “$guess” != “$num” )echo -n Enter guess (q to quit): “read guessif ( “$guess” == q || “$guess” == ““) thenbreak;endif# Ensure they entered a number - i.e. convert to a numberset iguess = `atof($guess)`if ( $iguess < $num ) thenecho Too lowelse if ( $iguess > $num ) thenecho Too highelseecho Spot on!endifend# Come here if they selected “q” to quit:echo The number to guess was $num88 1 Houdini 6.0 Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!