Magnus Pettersson Posted June 23, 2009 Share Posted June 23, 2009 Im very beginner at scripting inside of houdini but i must do something completly wrong! And i think im a little confused to what scripting language is active in diffrent places. I want to make a custom function that checks if the a number (like for example $F) is equal to an array. The reason is that i just want to write "2, 20, 24, 45" and so on in a variable thats linked up for activation of particle emission instead of having to do write $FF == 2 || $FF == 20 || $FF == 24 ... and so on wich is tedious and take longer to edit when i have to make changes. I write this code at exressions tab in "edit -> aliases and variables": float matchNum(float numOne, float array numTwo) { foreach (i; numTwo) { if ( numOne == numTwo[i] ) return 1; } return 0; } First question, why do i get error when i try to declare my array in the function as float numTwo[] when i press "apply changes" ? Second how do i call this function? i tried texport and writing echo `matchNum(1,float(array(1,2,3)))` ... i tried alot of diffrent ways to write my array but i just get errors. Third, maybe im on the completley wrong track of solving the initial problem of wanting to write just the frame numbers i want emission activated? Thanks for your help and sorry if i overlooked some post here or some simple thing thats in the help. Quote Link to comment Share on other sites More sharing options...
mawi Posted July 27, 2009 Share Posted July 27, 2009 Hi. Maybe you have already solved this, but there is a expression that kind of does this. strmatch("2,20,24,45",$FF) in Impulse Activision will do it for you. 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.