Wow, I forgot about that issue, maybe I can fix that... (it is mostly an artifact of the old, brain-dead, way I used to expand variables in early versions of Rubble, so it may be fixable now)
Is there a way to loop over all materials of a certain type (eg. Layer stones, alloys?)
Not really, but if you want to badly enough you can use the raw parser to examine each item in the shared object list, but it would be kinda hard to do... The Rubble 7 API is very different from the Rubble 6 API, so I don't really feel comfortable giving hints as to how it would be done when I am not sure which version you will want to use it in. For either version all I can say is look at how the templates are implemented, that should tell you how the data is stored.