Skip to content

Instantly share code, notes, and snippets.

@stefania11
Created September 3, 2017 19:24
Show Gist options
  • Save stefania11/2b9966ee44590690a4e69684faa29010 to your computer and use it in GitHub Desktop.
Save stefania11/2b9966ee44590690a4e69684faa29010 to your computer and use it in GitHub Desktop.
'use strict';
Blockly.Blocks['jibo_playAnim'] = {
init: function() {
this.jsonInit({
"message0" : "Play Animation: %1",
"args0" : [
{
"type": "field_dropdown",
"name": "ANIMATION",
"options" : [
["Greeting", "greeting.keys"],
["Carlton", "Carlton_02_audio.keys"],
["Celebrate", "Celebrate_05.keys"],
["Robotic", "Robotic_01_audio.keys"],
["Twerking", "Twerking_01_audio.keys"],
["Happy", "Happy_Lucky_01_01.keys"],
]
}
],
"previousStatement" : null,
"nextStatement" : null,
colour : "#295BE2"
})
}
}
Blockly.Blocks['jibo_say'] = {
init: function() {
this.jsonInit({
"message0" : "Jibo say: %1",
"args0" : [
{
"type": "field_input",
"name" : "TEXT_TO_SAY",
"check" : "String",
"text" : " "
}
],
colour : "#295BE2",
"previousStatement" : null,
"nextStatement": null
})
}
}
Blockly.Blocks['jibo_say_var'] = {
init: function() {
this.jsonInit({
"message0" : "Jibo say: %1",
"args0" : [
{
"type": "input_value",
"name" : "VAR_TO_SAY",
"check" : "String",
}
],
colour : "#295BE2",
"previousStatement" : null,
"nextStatement": null
})
}
}
Blockly.Blocks["jibo_lookAt"] = {
init: function() {
this.jsonInit({
"message0" : "Look at: %1",
"args0" : [
{
"type" : "field_dropdown",
"name" : "LOOKAT",
"options" : [
["left", "left"],
["center", "center"],
["right", "right"]
]
}
],
colour : "#295BE2",
"previousStatement" : null,
"nextStatement": null
})
}
}
Blockly.Blocks["jibo_lookAt3D"] = {
init: function() {
this.jsonInit({
"message0": "Look at: x:%1 y:%2 z:%3",
"args0": [
{
"type": "field_number",
"name": "LOOKAT_X",
"value": 1,
// "min": min,
// "max": max,
// "precision": precision
},
{
"type": "field_number",
"name": "LOOKAT_Y",
"value": 0,
// "min": min,
// "max": max,
// "precision": precision
},
{
"type": "field_number",
"name": "LOOKAT_Z",
"value": 0.5,
// "min": min,
// "max": max,
// "precision": precision
}
],
colour: "#295BE2",
"previousStatement": null,
"nextStatement": null
})
}
}
Blockly.Blocks["jibo_attention"] = {
init: function() {
this.jsonInit({
"message0" : "Turn Attention %1",
"args0" : [
{
type: "field_dropdown",
name: "ATTENTION",
options: [
["OFF", "off"],
["ON", "idle"]
]
}
],
previousStatement : null,
nextStatement : null,
colour : "#295BE2",
})
}
}
Blockly.Blocks["jibo_wait"] = {
init: function() {
this.jsonInit({
"message0" : "wait(sec) %1",
"args0" : [
{
type : "field_number",
name : "TIME",
check : Number,
value : 0.1
}
],
colour: "#295BE2",
previousStatement : null,
nextStatement : null
})
}
}
Blockly.Blocks["jibo_key"] = {
init: function() {
this.jsonInit({
"message0" : "Key %1 was pressed",
"args0" : [
{
"type" : "field_dropdown",
"name" : "KEY",
"options" : [
["space", "32"],
["w", "119"],
["a", "97"],
["s", "115"],
["d", "100"],
["left arrow", "37"],
["up arrow", "38"],
["right arrow", "39"],
["down arrow", "40"],
]
}
],
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "KEY_DO"}
],
colour : "#295BE2"
})
}
}
// Heard using the apiai
Blockly.Blocks["jibo_heard_apiai"] = {
init: function() {
this.jsonInit({
"message0" : "Jibo heard-api: %1",
"args0" : [
{
"type" : "input_value",
"name" : "HEARDAPI",
"check": "String",
}
],
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "HEARDAPI_DO"}
],
colour : "#295BE2"
})
}
}
Blockly.Blocks['jibo_remote_mim'] = {
init: function() {
this.jsonInit({
"message0" : "Remote MIM: %1",
"args0" : [
{
"type": "field_input",
"name" : "REMOTEMIM",
"check" : "String",
"text" : " "
}
],
colour : "#295BE2",
"previousStatement" : null,
"nextStatement": null
})
}
}
Blockly.Blocks["jibo_screen_touch"] = {
init: function() {
this.jsonInit({
"message0" : "Jibo on screen touch:",
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "SCREEN_DO"}
],
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_head_touch"] = {
init: function() {
this.jsonInit({
"message0" : "Jibo on head touch:",
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "HEAD_DO"}
],
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_hey_jibo"] = {
init: function() {
this.jsonInit({
"message0" : "On Hey Jibo: ",
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "HEYJIBO_DO"}
],
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_speaker_id"] = {
init: function() {
this.jsonInit({
"message0" : "Speaker ID: %1",
"args0" : [
{
"type" : "field_dropdown",
"name" : "SPEAKERID",
"options" : [
["Andrew", "Andrew"],
["Astro", "Astro"],
["Jordi", "Jordi"],
["Dimitris", "Dimitris"],
["Sergio", "Sergio"]
]
}
],
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "SPEAKERID_DO"}
],
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_smalltalk"] = {
init: function() {
this.jsonInit({
"message0" : "Small talk is %1",
"args0" : [
{
type: "field_dropdown",
name: "SMALLTALK",
options: [
["OFF", false],
["ON", true]
]
}
],
previousStatement : null,
nextStatement : null,
colour : "#295BE2",
})
}
}
Blockly.Blocks["jibo_intent"] = {
init: function() {
this.jsonInit({
"message0" : "intent is: %1 ",
"args0" : [
{
"type" : "field_dropdown",
"name" : "INTENT",
"options" : function(){
return Blockly.Blocks['jibo_intent'].intentGenerator;
}
}
],
colour : "#295BE2",
"output": "Boolean",
})
}
}
Blockly.Blocks['jibo_intent'].intentGenerator = [["no-intents", "no-intents"]];
Blockly.Blocks["jibo_flow_throw"] = {
init: function() {
this.jsonInit({
"message0" : "Flow %1 throw",
"args0" : [
{
"type": "field_input",
"name" : "FLOW_THROW",
"check" : "String",
"text" : " "
}
],
colour : "#3BAF3D",
previousStatement : null,
})
}
}
Blockly.Blocks["jibo_flow_catch"] = {
init: function() {
this.jsonInit({
"message0" : "Flow %1 catch",
"args0" : [
{
"type": "field_input",
"name" : "FLOW_CATCH",
"check" : "String",
"text" : " "
}
],
"message1": "do %1",
"args1": [
{"type": "input_statement", "name": "FLOW_CATCH_DO"}
],
colour : "#3BAF3D"
})
}
}
Blockly.Blocks["jibo_mim"] = {
init: function() {
this.jsonInit({
"message0" : "Remote mim: %1",
"args0" : [
{
"type" : "field_input",
"name" : "REMOTEMIM",
"check": "String",
text: " "
}
],
nextStatement : null,
previousStatement: null,
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_ring_color"] = {
init: function() {
this.jsonInit({
"message0": "Set ring colour: %1",
"args0": [
{
"type": "field_colour",
"name": "RINGCOLOUR",
"colour": "#25F2FF"
}
],
nextStatement : null,
previousStatement: null,
colour : "#295BE2"
})
}
}
Blockly.Blocks["jibo_blink"] = {
init: function() {
this.jsonInit({
"message0": "Jibo blink",
nextStatement: null,
previousStatement: null,
colour: "#295BE2"
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment