How to access attributes from previous multiparm iteration?

   1958   2   1
User Avatar
Member
19 posts
Joined: July 2012
Offline
Hi there!

I'm trying to make a simple multiparm set-up for creating blocks that will stack on top of each other.

I can control the number of blocks and the height of each block but I have no clue how I can read the height of each box from each iterations.

I made an attribute within the multiparm itself to store the height of the block but I have no idea how I can call out that parameter from the previous iteration into my current iteration for usage.

Any help and ideas will be great!

Attachments:
roughRef.jpg (76.8 KB)
multiparmTest.JPG (171.0 KB)

Game on!
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
If you name your multiparm block parm as “myparmName”, it will be automatically converted to myparmName1, myparmName2, as you add new instances…
So you can access a specific a multiparm block instance parm by compositing the general parm name + the instance id.
string instanceName = "myparmName" + itoa(id);  // itoa() converts int to string
float height = ch("path/to/controlNode/" + instanceName);


one thing to rmb is that multiparm instances indices generally start from 1. So keep that in mind when you compose the name.
Edited by Andr - Oct. 29, 2019 07:37:00
User Avatar
Member
19 posts
Joined: July 2012
Offline
Thank you Andr!

I was looking for a way to get attributes within each multiparm instead of the parameter input itself because I realize that I needed to add constantly add up the values with every instance and store them somewhere as an attribute but I do not know how I can read it.

With what you suggested, getting the parameter itself, I can just run a for loop through every instance and get the parameters into a list and add them up during every instance. It's a bit tedious but that's what I can think of now, and it works!

Thanks again!
Game on!
  • Quick Links