Selected_Instrument.name_Observable.value==True ?

I’d really like to do a next_instrument if the name_observable has a value. if i try and print it (when it has no value) i get zero lines output. how do i say “if zero lines output, then keep to the sample, if non-zero lines output, go to next sample”?

I don’t really understand this.

The name is stored as [instrument].name while [instrument].name_observable is for binding hook functions to be called when the name is changed.

What are you trying to do?

ok seems that i solved it with sample_buffer.has_sample_data instead of trying to read if the instrument name had a name…

Instrument names never guarantee whether there is sample data (or any instrument data, could be VST) at all! You can rename to nothing or have a name on a blank instrument as a separater (EG “—Drums—” or “—Basses—”)

You seemed to have realised that has_sample_data is the way to go. What if it is a VST though, and thus has no sample data?

to tell if it’s a vsti/au try print plugin_properties.plugin_loaded
this will tell you the currently selected instrument is a plugin

print (renoise.song().instruments[renoise.song().selected_instrument_index].plugin_properties.plugin_loaded)  

will have to think about that, because it might be that one might want to have a plugin + a sample recorded to same instrument. in this again, the “instrument.name != nil” would help but if it’s worked out or if the plugin_loaded or midi_instrument set are worked out of the scrip, then one can but use this in one way. i’ll have to think about it. i’m yet to configure keyboard shortcuts which would open up a specific vst-instrument, but it’s on my list of things to do (rhino2)

you can’t rely on name’s because that’s just a string not a boolean if it’s a proper instrument of each type.

what are you trying to do here?

Thank you. I will look at this.

I was trying to use the name of the instrument in order to detect which instrument should be chosen. That was probably the most confusing way of voicing it.
Basically I’ve been fiddling with this: When recording a sample, go to an empty slot. If the slot has an instrument name, go to the next slot. If you’ve run out of empty slots, add 8 instrument box slots. But, unfortunately, I only know how to recognize sample_buffer, so if there’s no sample_buffer but there is a plugin_loaded, or a midi_instrument loaded, a sample will be written to that instrument box , and while it will quite possibly result in happy accidents, it would be better to make it so that a new instrument is created if there’s a sample, a plugin or a mididevice on that instrument box.