Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Frekvens1

How to use multiple note blocks

Question

Hello!

 

As stated in the title, I need help with a good way to access multiple 'component.note_block' s. I'm pretty new to OC, as I started a few days ago. But what I've found out is that the components are registered, with the same refrence id, but with different uuid's in the 'component'.

 

Yea, I've searched google for some time, and was hoping you guys could help me solve my problem!

 

 

For those who are curious, I'm making a 'radio' script, which will play different note block songs. I have four different note blocks, for each sound type (dirt, sand, cobble and planks). I'm actually using the iron note block (From mod: MiscPeripherals), as it can play chords like the vanilla can't. But that shouldn't be much of a difference (I guess). Any clues to my problem?

 

With kind regards,

- Frek

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Solution

To access multiple components of the same type, you'll need to get the proxy for the components mannually, since there can only be one primary component after all. To do that, either use component.proxy(address) with manually providing the addresses or use component.list("note_block") to iterate the list of connected components, e.g.

for address in component.list("note_block") do
  local proxy = component.proxy(address)
  proxy.trigger() -- or whatever else you want to do with the component
end
Link to post
Share on other sites
  • 0

 

To access multiple components of the same type, you'll need to get the proxy for the components mannually, since there can only be one primary component after all. To do that, either use component.proxy(address) with manually providing the addresses or use component.list("note_block") to iterate the list of connected components, e.g.

for address in component.list("note_block") do
  local proxy = component.proxy(address)
  proxy.trigger() -- or whatever else you want to do with the component
end

Hmm... Interesting! This was exactly what I was looking for. Thanks for taking interest, and thanks for your good answer!

 

With kind regards,

- Frek

Link to post
Share on other sites

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
Answer this question...

×   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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.