chrsmith Posted February 9, 2005 Share Posted February 9, 2005 Hi there, I'm trying to run hscript commands at different points in my animation, including calling tk and manipulating objects. How is this done without typing it into the textport? Where do you put scripts/commands that will run at certain times? Thanks, Christine Smith Northrop Grumman Engineering Visualization Resource Quote Link to comment Share on other sites More sharing options...
Jason Posted February 21, 2005 Share Posted February 21, 2005 I missed this one completely! Did you get an answer? (LogicCHOP is usually the best choice).. Quote Link to comment Share on other sites More sharing options...
michael Posted February 21, 2005 Share Posted February 21, 2005 it also has the coolest icon... Quote Link to comment Share on other sites More sharing options...
pbowmar Posted April 6, 2005 Share Posted April 6, 2005 Hi Christine, You can run any script pretty much anywhere you want. For example, you could put it in an unused channel. Let's say you had a simple script in $HOME/houdini7.0/scripts you wantred to run, let's call it "testmessage.cmd" that has this in it: message This is frame $F That's all it does So, if you type "testmessage.cmd" in the textport it tells you what frame you're on. Now, all you have to do is create a little wrapper custom expression. Open up the Alias/Variables dialog, and go to the Expressions tab. Type this in: string runner(float curframe, frameToRun) { if(curframe == frameToRun) { run("testmessage.cmd"); } } Now, you can use the runner() expression in an unused channel. For example, I used the Renderman Cs in an Object, since I am not using Renderman, I don't need it. I just enter: runner($F,50) and on frame 50 the script is run! You have to wrap the running of the script in a custom expression, or else the script is run at times you don't want. When testing this, I first tried: if($F == 50, run("testmessage.cmd"), 0) however, this runs the testmessage.cmd A LOT which is annoying. The custom expression is the way to go. Actually, now that I think about it, here's what the expression should really be: string runner(float curframe, frameToRun; string script) { if(curframe == frameToRun) { run(script); } } So you then have a generic "runner" script that takes the current frame, the frame you want to run the script on, and the script itself, like so: runner($F, 50, "testmessage.cmd") Much more useful. Cheers, Peter B Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.