scratch-vm/src/serialization/sb2_specmap.js

1589 lines
36 KiB
JavaScript
Raw Normal View History

2016-08-31 13:56:05 -04:00
/**
* @fileoverview
* The specMap below handles a few pieces of "translation" work between
* the SB2 JSON format and the data we need to run a project
* in the Scratch 3.0 VM.
* Notably:
* - Map 2.0 and 1.4 opcodes (forward:) into 3.0-format (motion_movesteps).
2016-08-31 13:56:05 -04:00
* - Map ordered, unnamed args to unordered, named inputs and fields.
* Keep this up-to-date as 3.0 blocks are renamed, changed, etc.
* Originally this was generated largely by a hand-guided scripting process.
* The relevant data lives here:
* https://github.com/LLK/scratch-flash/blob/master/src/Specs.as
* (for the old opcode and argument order).
* and here:
* https://github.com/LLK/scratch-blocks/tree/develop/blocks_vertical
* (for the new opcodes and argument names).
* and here:
* https://github.com/LLK/scratch-blocks/blob/develop/tests/
* (for the shadow blocks created for each block).
* I started with the `commands` array in Specs.as, and discarded irrelevant
* properties. By hand, I matched the opcode name to the 3.0 opcode.
* Finally, I filled in the expected arguments as below.
2016-08-31 13:56:05 -04:00
*/
/**
* @typedef {object} SB2SpecMap_blockInfo
* @property {string} opcode - the Scratch 3.0 block opcode. Use 'extensionID.opcode' for extension opcodes.
* @property {Array.<SB2SpecMap_argInfo>} argMap - metadata for this block's arguments.
*/
/**
* @typedef {object} SB2SpecMap_argInfo
* @property {string} type - the type of this arg (such as 'input' or 'field')
* @property {string} inputOp - the scratch-blocks shadow type for this arg
* @property {string} inputName - the name this argument will take when provided to the block implementation
*/
/**
* Mapping of Scratch 2.0 opcode to Scratch 3.0 block metadata.
* @type {object.<SB2SpecMap_blockInfo>}
*/
2017-04-17 15:10:04 -04:00
const specMap = {
'forward:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_movesteps',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'STEPS'
2016-08-31 13:56:05 -04:00
}
]
},
'turnRight:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_turnright',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'DEGREES'
2016-08-31 13:56:05 -04:00
}
]
},
'turnLeft:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_turnleft',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'DEGREES'
2016-08-31 13:56:05 -04:00
}
]
},
'heading:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_pointindirection',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_angle',
inputName: 'DIRECTION'
2016-08-31 13:56:05 -04:00
}
]
},
'pointTowards:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_pointtowards',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'motion_pointtowards_menu',
inputName: 'TOWARDS'
2016-08-31 13:56:05 -04:00
}
]
},
'gotoX:y:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_gotoxy',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'X'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'Y'
2016-08-31 13:56:05 -04:00
}
]
},
'gotoSpriteOrMouse:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_goto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'motion_goto_menu',
inputName: 'TO'
2016-08-31 13:56:05 -04:00
}
]
},
'glideSecs:toX:y:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_glidesecstoxy',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SECS'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'X'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'Y'
2016-08-31 13:56:05 -04:00
}
]
},
'changeXposBy:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_changexby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'DX'
2016-08-31 13:56:05 -04:00
}
]
},
'xpos:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_setx',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'X'
2016-08-31 13:56:05 -04:00
}
]
},
'changeYposBy:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_changeyby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'DY'
2016-08-31 13:56:05 -04:00
}
]
},
'ypos:': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_sety',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'Y'
2016-08-31 13:56:05 -04:00
}
]
},
'bounceOffEdge': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_ifonedgebounce',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'setRotationStyle': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_setrotationstyle',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-05-21 12:26:16 -04:00
type: 'field',
fieldName: 'STYLE'
2016-08-31 13:56:05 -04:00
}
]
},
'xpos': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_xposition',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'ypos': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_yposition',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'heading': {
2016-10-24 11:02:19 -04:00
opcode: 'motion_direction',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'say:duration:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_sayforsecs',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'MESSAGE'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SECS'
2016-08-31 13:56:05 -04:00
}
]
},
'say:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_say',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'MESSAGE'
2016-08-31 13:56:05 -04:00
}
]
},
'think:duration:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_thinkforsecs',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'MESSAGE'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SECS'
2016-08-31 13:56:05 -04:00
}
]
},
'think:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_think',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'MESSAGE'
2016-08-31 13:56:05 -04:00
}
]
},
'show': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_show',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'hide': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_hide',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'lookLike:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_switchcostumeto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'looks_costume',
inputName: 'COSTUME'
2016-08-31 13:56:05 -04:00
}
]
},
'nextCostume': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_nextcostume',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'startScene': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_switchbackdropto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'looks_backdrops',
inputName: 'BACKDROP'
2016-08-31 13:56:05 -04:00
}
]
},
'changeGraphicEffect:by:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_changeeffectby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-05-21 12:26:16 -04:00
type: 'field',
fieldName: 'EFFECT'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'CHANGE'
2016-08-31 13:56:05 -04:00
}
]
},
'setGraphicEffect:to:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_seteffectto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-05-21 12:26:16 -04:00
type: 'field',
fieldName: 'EFFECT'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'VALUE'
2016-08-31 13:56:05 -04:00
}
]
},
'filterReset': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_cleargraphiceffects',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'changeSizeBy:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_changesizeby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'CHANGE'
2016-08-31 13:56:05 -04:00
}
]
},
'setSizeTo:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_setsizeto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SIZE'
2016-08-31 13:56:05 -04:00
}
]
},
'comeToFront': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_gotofront',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'goBackByLayers:': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_gobacklayers',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_integer',
inputName: 'NUM'
2016-08-31 13:56:05 -04:00
}
]
},
'costumeIndex': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_costumeorder',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'sceneName': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_backdropname',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'scale': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_size',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'startSceneAndWait': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_switchbackdroptoandwait',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'looks_backdrops',
inputName: 'BACKDROP'
2016-08-31 13:56:05 -04:00
}
]
},
'nextScene': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_nextbackdrop',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'backgroundIndex': {
2016-10-24 11:02:19 -04:00
opcode: 'looks_backdroporder',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'playSound:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_play',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
2016-12-22 14:12:20 -05:00
inputOp: 'sound_sounds_menu',
2016-10-24 11:02:19 -04:00
inputName: 'SOUND_MENU'
2016-08-31 13:56:05 -04:00
}
]
},
'doPlaySoundAndWait': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_playuntildone',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
2016-12-22 14:12:20 -05:00
inputOp: 'sound_sounds_menu',
2016-10-24 11:02:19 -04:00
inputName: 'SOUND_MENU'
2016-08-31 13:56:05 -04:00
}
]
},
'stopAllSounds': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_stopallsounds',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'playDrum': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_playdrumforbeats',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'DRUM'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'BEATS'
2016-08-31 13:56:05 -04:00
}
]
},
'rest:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_restforbeats',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'BEATS'
2016-08-31 13:56:05 -04:00
}
]
},
'noteOn:duration:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_playnoteforbeats',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NOTE'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'BEATS'
2016-08-31 13:56:05 -04:00
}
]
},
'instrument:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_setinstrumentto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'INSTRUMENT'
2016-08-31 13:56:05 -04:00
}
]
},
'changeVolumeBy:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_changevolumeby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'VOLUME'
2016-08-31 13:56:05 -04:00
}
]
},
'setVolumeTo:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_setvolumeto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'VOLUME'
2016-08-31 13:56:05 -04:00
}
]
},
'volume': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_volume',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'changeTempoBy:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_changetempoby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'TEMPO'
2016-08-31 13:56:05 -04:00
}
]
},
'setTempoTo:': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_settempotobpm',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'TEMPO'
2016-08-31 13:56:05 -04:00
}
]
},
'tempo': {
2016-10-24 11:02:19 -04:00
opcode: 'sound_tempo',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'clearPenTrails': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.clear',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'stampCostume': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.stamp',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'putPenDown': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.penDown',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'putPenUp': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.penUp',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'penColor:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.setPenColorToColor',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'colour_picker',
inputName: 'COLOR'
2016-08-31 13:56:05 -04:00
}
]
},
'changePenHueBy:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.changePenHueBy',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
2017-10-31 17:24:12 -04:00
inputName: 'HUE'
2016-08-31 13:56:05 -04:00
}
]
},
'setPenHueTo:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.setPenHueToNumber',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
2017-10-31 17:24:12 -04:00
inputName: 'HUE'
2016-08-31 13:56:05 -04:00
}
]
},
'changePenShadeBy:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.changePenShadeBy',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SHADE'
2016-08-31 13:56:05 -04:00
}
]
},
'setPenShadeTo:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.setPenShadeToNumber',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SHADE'
2016-08-31 13:56:05 -04:00
}
]
},
'changePenSizeBy:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.changePenSizeBy',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SIZE'
2016-08-31 13:56:05 -04:00
}
]
},
'penSize:': {
2017-10-04 18:40:25 -04:00
opcode: 'pen.setPenSizeTo',
2016-10-24 11:02:19 -04:00
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'SIZE'
2016-08-31 13:56:05 -04:00
}
]
},
'whenGreenFlag': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whenflagclicked',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'whenKeyPressed': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whenkeypressed',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
fieldName: 'KEY_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'whenClicked': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whenthisspriteclicked',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'whenSceneStarts': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whenbackdropswitchesto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
fieldName: 'BACKDROP'
2016-08-31 13:56:05 -04:00
}
]
},
'whenSensorGreaterThan': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whengreaterthan',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
fieldName: 'WHENGREATERTHANMENU'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'VALUE'
2016-08-31 13:56:05 -04:00
}
]
},
'whenIReceive': {
2016-10-24 11:02:19 -04:00
opcode: 'event_whenbroadcastreceived',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
fieldName: 'BROADCAST_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'broadcast:': {
2016-10-24 11:02:19 -04:00
opcode: 'event_broadcast',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'event_broadcast_menu',
inputName: 'BROADCAST_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'doBroadcastAndWait': {
2016-10-24 11:02:19 -04:00
opcode: 'event_broadcastandwait',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'event_broadcast_menu',
inputName: 'BROADCAST_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'wait:elapsed:from:': {
2016-10-24 11:02:19 -04:00
opcode: 'control_wait',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_positive_number',
inputName: 'DURATION'
2016-08-31 13:56:05 -04:00
}
]
},
'doRepeat': {
2016-10-24 11:02:19 -04:00
opcode: 'control_repeat',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_whole_number',
inputName: 'TIMES'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK'
2016-08-31 13:56:05 -04:00
}
]
},
'doForever': {
2016-10-24 11:02:19 -04:00
opcode: 'control_forever',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK'
2016-08-31 13:56:05 -04:00
}
]
},
'doIf': {
2016-10-24 11:02:19 -04:00
opcode: 'control_if',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'CONDITION'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK'
2016-08-31 13:56:05 -04:00
}
]
},
'doIfElse': {
2016-10-24 11:02:19 -04:00
opcode: 'control_if_else',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'CONDITION'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK2'
2016-08-31 13:56:05 -04:00
}
]
},
'doWaitUntil': {
2016-10-24 11:02:19 -04:00
opcode: 'control_wait_until',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'CONDITION'
2016-08-31 13:56:05 -04:00
}
]
},
'doUntil': {
2016-10-24 11:02:19 -04:00
opcode: 'control_repeat_until',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'CONDITION'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'SUBSTACK'
2016-08-31 13:56:05 -04:00
}
]
},
'stopScripts': {
2016-10-24 11:02:19 -04:00
opcode: 'control_stop',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
fieldName: 'STOP_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'whenCloned': {
2016-10-24 11:02:19 -04:00
opcode: 'control_start_as_clone',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'createCloneOf': {
2016-10-24 11:02:19 -04:00
opcode: 'control_create_clone_of',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'control_create_clone_of_menu',
inputName: 'CLONE_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'deleteClone': {
2016-10-24 11:02:19 -04:00
opcode: 'control_delete_this_clone',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'touching:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_touchingobject',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_touchingobjectmenu',
inputName: 'TOUCHINGOBJECTMENU'
2016-08-31 13:56:05 -04:00
}
]
},
'touchingColor:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_touchingcolor',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'colour_picker',
inputName: 'COLOR'
2016-08-31 13:56:05 -04:00
}
]
},
'color:sees:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_coloristouchingcolor',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'colour_picker',
inputName: 'COLOR'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'colour_picker',
inputName: 'COLOR2'
2016-08-31 13:56:05 -04:00
}
]
},
'distanceTo:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_distanceto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_distancetomenu',
inputName: 'DISTANCETOMENU'
2016-08-31 13:56:05 -04:00
}
]
},
'doAsk': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_askandwait',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'QUESTION'
2016-08-31 13:56:05 -04:00
}
]
},
'answer': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_answer',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'keyPressed:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_keypressed',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_keyoptions',
inputName: 'KEY_OPTION'
2016-08-31 13:56:05 -04:00
}
]
},
'mousePressed': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_mousedown',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'mouseX': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_mousex',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'mouseY': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_mousey',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'soundLevel': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_loudness',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'senseVideoMotion': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_videoon',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_videoonmenuone',
inputName: 'VIDEOONMENU1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_videoonmenutwo',
inputName: 'VIDEOONMENU2'
2016-08-31 13:56:05 -04:00
}
]
},
'setVideoState': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_videotoggle',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_videotogglemenu',
inputName: 'VIDEOTOGGLEMENU'
2016-08-31 13:56:05 -04:00
}
]
},
'setVideoTransparency': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_setvideotransparency',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'TRANSPARENCY'
2016-08-31 13:56:05 -04:00
}
]
},
'timer': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_timer',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'timerReset': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_resettimer',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'getAttribute:of:': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_of',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_of_property_menu',
inputName: 'PROPERTY'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_of_object_menu',
inputName: 'OBJECT'
2016-08-31 13:56:05 -04:00
}
]
},
'timeAndDate': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_current',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'sensing_currentmenu',
inputName: 'CURRENTMENU'
2016-08-31 13:56:05 -04:00
}
]
},
'timestamp': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_dayssince2000',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'getUserName': {
2016-10-24 11:02:19 -04:00
opcode: 'sensing_username',
argMap: [
2016-08-31 13:56:05 -04:00
]
},
'+': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_add',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM2'
2016-08-31 13:56:05 -04:00
}
]
},
'-': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_subtract',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM2'
2016-08-31 13:56:05 -04:00
}
]
},
'*': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_multiply',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM2'
2016-08-31 13:56:05 -04:00
}
]
},
'/': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_divide',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM2'
2016-08-31 13:56:05 -04:00
}
]
},
'randomFrom:to:': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_random',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'FROM'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'TO'
2016-08-31 13:56:05 -04:00
}
]
},
'<': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_lt',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND2'
2016-08-31 13:56:05 -04:00
}
]
},
'=': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_equals',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND2'
2016-08-31 13:56:05 -04:00
}
]
},
'>': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_gt',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'OPERAND2'
2016-08-31 13:56:05 -04:00
}
]
},
'&': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_and',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'OPERAND1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'OPERAND2'
2016-08-31 13:56:05 -04:00
}
]
},
'|': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_or',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'OPERAND1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'OPERAND2'
2016-08-31 13:56:05 -04:00
}
]
},
'not': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_not',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputName: 'OPERAND'
2016-08-31 13:56:05 -04:00
}
]
},
'concatenate:with:': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_join',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'STRING1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'STRING2'
2016-08-31 13:56:05 -04:00
}
]
},
'letter:of:': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_letter_of',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_whole_number',
inputName: 'LETTER'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'STRING'
2016-08-31 13:56:05 -04:00
}
]
},
'stringLength:': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_length',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'STRING'
2016-08-31 13:56:05 -04:00
}
]
},
'%': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_mod',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM1'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM2'
2016-08-31 13:56:05 -04:00
}
]
},
'rounded': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_round',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM'
2016-08-31 13:56:05 -04:00
}
]
},
'computeFunction:of:': {
2016-10-24 11:02:19 -04:00
opcode: 'operator_mathop',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-05-21 12:26:16 -04:00
type: 'field',
fieldName: 'OPERATOR'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'NUM'
2016-08-31 13:56:05 -04:00
}
]
},
'readVariable': {
2016-10-24 11:02:19 -04:00
opcode: 'data_variable',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-05-21 12:26:16 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'VARIABLE',
variableType: ''
2016-08-31 13:56:05 -04:00
}
]
},
'setVar:to:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_setvariableto',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-06-14 16:31:29 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'VARIABLE',
variableType: ''
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'VALUE'
2016-08-31 13:56:05 -04:00
}
]
},
'changeVar:by:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_changevariableby',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-06-14 16:31:29 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'VARIABLE',
variableType: ''
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_number',
inputName: 'VALUE'
2016-08-31 13:56:05 -04:00
}
]
},
'showVariable:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_showvariable',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-06-14 16:31:29 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'VARIABLE',
variableType: ''
2016-08-31 13:56:05 -04:00
}
]
},
'hideVariable:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_hidevariable',
argMap: [
2016-08-31 13:56:05 -04:00
{
2017-06-14 16:31:29 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'VARIABLE',
variableType: ''
2016-08-31 13:56:05 -04:00
}
]
},
'contentsOfList:': {
opcode: 'data_listcontents',
2016-10-24 11:02:19 -04:00
argMap: [
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
}
]
},
'append:toList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_addtolist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'ITEM'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'deleteLine:ofList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_deleteoflist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_integer',
inputName: 'INDEX'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'insert:at:ofList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_insertatlist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'ITEM'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_integer',
inputName: 'INDEX'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'setLine:ofList:to:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_replaceitemoflist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_integer',
inputName: 'INDEX'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'ITEM'
2016-08-31 13:56:05 -04:00
}
]
},
'getLine:ofList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_itemoflist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'math_integer',
inputName: 'INDEX'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'lineCountOfList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_lengthoflist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'list:contains:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_listcontainsitem',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
},
{
2016-10-24 11:02:19 -04:00
type: 'input',
inputOp: 'text',
inputName: 'ITEM'
2016-08-31 13:56:05 -04:00
}
]
},
'showList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_showlist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'hideList:': {
2016-10-24 11:02:19 -04:00
opcode: 'data_hidelist',
argMap: [
2016-08-31 13:56:05 -04:00
{
2016-10-24 11:02:19 -04:00
type: 'field',
2017-11-13 14:24:30 -05:00
fieldName: 'LIST',
variableType: 'list'
2016-08-31 13:56:05 -04:00
}
]
},
'procDef': {
2016-10-24 11:02:19 -04:00
opcode: 'procedures_defnoreturn',
argMap: []
2016-08-31 13:56:05 -04:00
},
'getParam': {
2016-10-24 11:02:19 -04:00
opcode: 'procedures_param',
argMap: []
2016-08-31 13:56:05 -04:00
},
'call': {
2016-10-24 11:02:19 -04:00
opcode: 'procedures_callnoreturn',
argMap: []
2016-08-31 13:56:05 -04:00
}
};
/**
* Add to the specMap entries for an opcode from a Scratch 2.0 extension. Two entries will be made with the same
* metadata; this is done to support projects saved by both older and newer versions of the Scratch 2.0 editor.
* @param {string} sb2Extension - the Scratch 2.0 name of the extension
* @param {string} sb2Opcode - the Scratch 2.0 opcode
* @param {SB2SpecMap_blockInfo} blockInfo - the Scratch 3.0 block info
*/
const addExtensionOp = function (sb2Extension, sb2Opcode, blockInfo) {
/**
* This string separates the name of an extension and the name of an opcode in more recent Scratch 2.0 projects.
* Earlier projects used '.' as a separator, up until we added the 'LEGO WeDo 2.0' extension...
* @type {string}
*/
const sep = '\u001F'; // Unicode Unit Separator
// make one entry for projects saved by recent versions of the Scratch 2.0 editor
specMap[`${sb2Extension}${sep}${sb2Opcode}`] = blockInfo;
// make a second for projects saved by older versions of the Scratch 2.0 editor
specMap[`${sb2Extension}.${sb2Opcode}`] = blockInfo;
};
const weDo2 = 'LEGO WeDo 2.0';
addExtensionOp(weDo2, 'motorOnFor', {
opcode: 'wedo2.motorOnFor',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.motorID',
inputName: 'MOTOR_ID'
},
{
type: 'input',
inputOp: 'math_number',
inputName: 'DURATION'
}
]
});
addExtensionOp(weDo2, 'motorOn', {
opcode: 'wedo2.motorOn',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.motorID',
inputName: 'MOTOR_ID'
}
]
});
addExtensionOp(weDo2, 'motorOff', {
opcode: 'wedo2.motorOff',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.motorID',
inputName: 'MOTOR_ID'
}
]
});
addExtensionOp(weDo2, 'startMotorPower', {
opcode: 'wedo2.startMotorPower',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.motorID',
inputName: 'MOTOR_ID'
},
{
type: 'input',
inputOp: 'math_number',
inputName: 'POWER'
}
]
});
addExtensionOp(weDo2, 'setMotorDirection', {
opcode: 'wedo2.setMotorDirection',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.motorID',
inputName: 'MOTOR_ID'
},
{
type: 'input',
inputOp: 'wedo2.menu.motorDirection',
inputName: 'DIRECTION'
}
]
});
addExtensionOp(weDo2, 'setLED', {
opcode: 'wedo2.setLightHue',
argMap: [
{
type: 'input',
inputOp: 'math_number',
inputName: 'HUE'
}
]
});
addExtensionOp(weDo2, 'playNote', {
opcode: 'wedo2.playNoteFor',
argMap: [
{
type: 'input',
inputOp: 'math_number',
inputName: 'NOTE'
},
{
type: 'input',
inputOp: 'math_number',
inputName: 'DURATION'
}
]
});
addExtensionOp(weDo2, 'whenDistance', {
opcode: 'wedo2.whenDistance',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.lessMore',
inputName: 'OP'
},
{
type: 'input',
inputOp: 'math_number',
inputName: 'REFERENCE'
}
]
});
addExtensionOp(weDo2, 'whenTilted', {
opcode: 'wedo2.whenTilted',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.tiltDirectionAny',
inputName: 'DIRECTION'
}
]
});
addExtensionOp(weDo2, 'getDistance', {
opcode: 'wedo2.getDistance',
argMap: []
});
addExtensionOp(weDo2, 'isTilted', {
opcode: 'wedo2.isTilted',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.tiltDirectionAny',
inputName: 'DIRECTION'
}
]
});
addExtensionOp(weDo2, 'getTilt', {
opcode: 'wedo2.getTiltAngle',
argMap: [
{
type: 'input',
inputOp: 'wedo2.menu.tiltDirection',
inputName: 'DIRECTION'
}
]
});
2016-08-31 13:56:05 -04:00
module.exports = specMap;