Discuss Scratch

martinlaoshi
Scratcher
25 posts

Bug in Music Extension

My browser / operating system: Windows NT 10.0, Chrome 76.0.3809.100, No Flash version detected
Problem occurs in Music extension
Frequency of occurrence: Always
Gravity : Medium
Description :

the block Set instrument to

Set instrument to (piano)

works only once after clicking the green flag if I want to change it during the script it does not change.

I did a workaround in the project https://scratch.mit.edu/projects/324558018/ by setting a variable but I have to click again on the green flag to do the change.

By the way does anyone knows how to simulate a click on the green flag by program (like the java instruction Button.doClick() ) ?

Thanks!
banana439monkey
Scratcher
1000+ posts

Bug in Music Extension

CNR. My browser / operating system: Windows NT 10.0, Chrome 76.0.3809.100, No Flash version detected
Script:

when gf clicked
set instrument to [(1) Piano v]
play note (60) for (0.25) beats
set instrument to [(5) Electric Guitar v]
play note (60) for (0.25) beats

Banana
martinlaoshi
Scratcher
25 posts

Bug in Music Extension

I have solved my problem by setting the instrument just before playing the note.

I thought that the instrument setting was something like a public variable but apparently it is a private variable.
In other words, if I use a play function in the script of one sprite I cannot modify its instrument in the script of another sprite.

To find a solution, I set a vaiable instrument which is a public variable (accessible by all sprites) and test this variable in each sprite to set the instrument before playing a note. (and doing so it works fine!)

So this bug report should be discard as irrelevant. I apologize for my initial misunderstanding of the process.

I hope that could help other people!
ScratchCat3141
Scratcher
100+ posts

Bug in Music Extension

martinlaoshi wrote:

My browser / operating system: Windows NT 10.0, Chrome 76.0.3809.100, No Flash version detected
Problem occurs in Music extension
Frequency of occurrence: Always
Gravity : Medium
Description :

the block Set instrument to

Set instrument to (piano)

works only once after clicking the green flag if I want to change it during the script it does not change.

I did a workaround in the project https://scratch.mit.edu/projects/324558018/ by setting a variable but I have to click again on the green flag to do the change.

By the way does anyone knows how to simulate a click on the green flag by program (like the java instruction Button.doClick() ) ?

Thanks!


it works offline

Powered by DjangoBB