Jump to content

custom function array declaration problems


Magnus Pettersson

Recommended Posts

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.

Link to comment
Share on other sites

  • 1 month later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...