Broadcast message functionality (works with creating new messages, and switching back and forth between them as well). This commit includes a temporary workaround for the issue where the default broadcast message, 'message1' wasn't triggering a var_create event (filed in ).

This commit is contained in:
Karishma Chadha 2017-11-21 16:48:48 -05:00
parent d5acdbe983
commit 0a15190b85
5 changed files with 52 additions and 4 deletions
src/engine

View file

@ -171,6 +171,19 @@ const execute = function (sequencer, thread) {
if (!fields.hasOwnProperty(fieldName)) continue;
if (fieldName === 'VARIABLE' || fieldName === 'LIST') {
argValues[fieldName] = fields[fieldName].id;
} else if (fieldName === 'BROADCAST_OPTION') {
// TODO KARISHMA (scratch-blocks #1258) this will change when we
// upstream blockly issue #1395 is fixed.
// we need both the id and the name here, because
// this object eventually gets passed to scratch3_event.broadcast
// which will create the message for the first time if one with the
// given id doesn't exist
// (e.g. default broadcast message, 'message1')
argValues[fieldName] = {
id: fields[fieldName].id,
name: fields[fieldName].value
};
} else {
argValues[fieldName] = fields[fieldName].value;
}