diff --git a/docs/javascripts/goboscript.tmGrammar.yml b/docs/javascripts/goboscript.tmGrammar.yml index aee7ae05..4644b9ae 100644 --- a/docs/javascripts/goboscript.tmGrammar.yml +++ b/docs/javascripts/goboscript.tmGrammar.yml @@ -31,7 +31,7 @@ patterns: - name: support.function.builtin match: "\\b(move|turn_left|turn_right|goto_random_position|goto_mouse_pointer|goto|glide|glide_to_random_position|glide_to_mouse_pointer|point_in_direction|point_towards_mouse_pointer|point_towards_random_direction|point_towards|change_x|set_x|change_y|set_y|if_on_edge_bounce|set_rotation_style_left_right|set_rotation_style_do_not_rotate|set_rotation_style_all_around|say|think|switch_costume|next_costume|switch_backdrop|previous_backdrop|random_backdrop|next_backdrop|set_size|change_size|change_color_effect|change_fisheye_effect|change_whirl_effect|change_pixelate_effect|change_mosaic_effect|change_brightness_effect|change_ghost_effect|set_color_effect|set_fisheye_effect|set_whirl_effect|set_pixelate_effect|set_mosaic_effect|set_brightness_effect|set_ghost_effect|clear_graphic_effects|show|hide|goto_front|goto_back|go_forward|go_backward|play_sound_until_done|start_sound|stop_all_sounds|change_pitch_effect|change_pan_effect|set_pitch_effect|set_pan_effect|change_volume|set_volume|clear_sound_effects|broadcast|broadcast_and_wait|wait|stop_all|stop_this_script|stop_other_scripts|delete_this_clone|clone|ask|set_drag_mode_draggable|set_drag_mode_not_draggable|reset_timer|erase_all|stamp|pen_down|pen_up|set_pen_color|change_pen_size|set_pen_size|set_pen_hue|set_pen_saturation|set_pen_brightness|set_pen_transparency|change_pen_hue|change_pen_saturation|change_pen_brightness|change_pen_transparency|rest|set_tempo|change_tempo)\\b" - name: entity.name.type - match: "\\b(x_position|y_position|direction|size|costume_number|costume_name|backdrop_number|backdrop_name|volume|distance_to_mouse_pointer|distance_to|touching_mouse_pointer|touching_edge|touching|key_pressed|mouse_down|mouse_x|mouse_y|loudness|timer|current_year|current_month|current_date|current_day_of_week|current_hour|current_minute|current_second|days_since_2000|username|online|touching_color|color_is_touching_color|answer|random|contains)\\b" + match: "\\b(x_position|y_position|direction|size|costume_number|costume_name|backdrop_number|backdrop_name|volume|distance_to_mouse_pointer|distance_to|touching_mouse_pointer|touching_edge|touching|key_pressed|mouse_down|mouse_x|mouse_y|loudness|timer|current_year|current_month|current_date|current_day_of_week|current_hour|current_minute|current_second|days_since_2000|username|online|touching_color|color_is_touching_color|answer|random|contains|tempo)\\b" - name: punctuation match: ",|;" - name: keyword.operator diff --git a/docs/language/reporters/music.md b/docs/language/reporters/music.md new file mode 100644 index 00000000..e211aea5 --- /dev/null +++ b/docs/language/reporters/music.md @@ -0,0 +1,11 @@ +# Music Reporters + +### tempo + +```goboscript +current_tempo = tempo(); +``` + +```scratchblocks +(tempo) +``` diff --git a/editors/code/syntaxes/goboscript.tmLanguage.json b/editors/code/syntaxes/goboscript.tmLanguage.json index 62dfae1c..045cc5d7 100644 --- a/editors/code/syntaxes/goboscript.tmLanguage.json +++ b/editors/code/syntaxes/goboscript.tmLanguage.json @@ -160,7 +160,7 @@ }, { "name": "support.function.builtin.goboscript", - "match": "\\b(x_position|y_position|direction|size|costume_number|costume_name|backdrop_number|backdrop_name|volume|distance_to_mouse_pointer|distance_to|touching_mouse_pointer|touching_edge|touching|key_pressed|mouse_down|mouse_x|mouse_y|loudness|timer|current_year|current_month|current_date|current_day_of_week|current_hour|current_minute|current_second|days_since_2000|username|online|touching_color|color_is_touching_color|answer|random|contains)\\b" + "match": "\\b(x_position|y_position|direction|size|costume_number|costume_name|backdrop_number|backdrop_name|volume|distance_to_mouse_pointer|distance_to|touching_mouse_pointer|touching_edge|touching|key_pressed|mouse_down|mouse_x|mouse_y|loudness|timer|current_year|current_month|current_date|current_day_of_week|current_hour|current_minute|current_second|days_since_2000|username|online|touching_color|color_is_touching_color|answer|random|contains|tempo)\\b" }, { "name": "support.function.goboscript", diff --git a/editors/notepad++/goboscript.udl.xml b/editors/notepad++/goboscript.udl.xml index 2217339e..7802a989 100644 --- a/editors/notepad++/goboscript.udl.xml +++ b/editors/notepad++/goboscript.udl.xml @@ -31,7 +31,7 @@ on onflag onkey onclick onbackdrop onloudness ontimer onclone on show hide add to delete insert at of as and or move turn_left turn_right goto_random_position goto_mouse_pointer goto glide glide_to_random_position glide_to_mouse_pointer point_in_direction point_towards_mouse_pointer point_towards_random_direction point_towards change_x set_x change_y set_y if_on_edge_bounce set_rotation_style_left_right set_rotation_style_do_not_rotate set_rotation_style_all_around say think switch_costume next_costume switch_backdrop next_backdrop set_size change_size change_color_effect change_fisheye_effect change_whirl_effect change_pixelate_effect change_mosaic_effect change_brightness_effect change_ghost_effect set_color_effect set_fisheye_effect set_whirl_effect set_pixelate_effect set_mosaic_effect set_brightness_effect set_ghost_effect clear_graphic_effects show hide goto_front goto_back go_forward go_backward play_sound_until_done start_sound stop_all_sounds change_pitch_effect change_pan_effect set_pitch_effect set_pan_effect change_volume set_volume clear_sound_effects broadcast broadcast_and_wait wait stop_all stop_this_script stop_other_scripts delete_this_clone clone ask set_drag_mode_draggable set_drag_mode_not_draggable reset_timer erase_all stamp pen_down pen_up set_pen_color change_pen_size set_pen_size set_pen_hue set_pen_saturation set_pen_brightness set_pen_transparency change_pen_hue change_pen_saturation change_pen_brightness change_pen_transparency rest set_tempo change_tempo - x_position y_position direction size costume_number costume_name backdrop_number backdrop_name volume distance_to_mouse_pointer distance_to touching_mouse_pointer touching_edge touching key_pressed mouse_down mouse_x mouse_y loudness timer current_year current_month current_date current_day_of_week current_hour current_minute current_second days_since_2000 username online touching_color color_is_touching_color answer random contains + x_position y_position direction size costume_number costume_name backdrop_number backdrop_name volume distance_to_mouse_pointer distance_to touching_mouse_pointer touching_edge touching key_pressed mouse_down mouse_x mouse_y loudness timer current_year current_month current_date current_day_of_week current_hour current_minute current_second days_since_2000 username online touching_color color_is_touching_color answer random contains tempo 00" 01\" 02" 03 04 05 06``` 07 08``` 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 diff --git a/gdsl.txt b/gdsl.txt index aa9fcb47..15c5bf2c 100644 --- a/gdsl.txt +++ b/gdsl.txt @@ -200,3 +200,5 @@ answer answer | [operator]=======================================================|====================|= random random FROM,TO | | contains contains STRING1,STRING2| | +[music]==========================================================|====================|= +tempo getTempo | | diff --git a/mkdocs.yml b/mkdocs.yml index 619d4e00..4a9a21bc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -37,6 +37,7 @@ nav: - Looks: language/reporters/looks.md - Sound: language/reporters/sound.md - Sensing: language/reporters/sensing.md + - Music: language/reporters/music.md - Custom Blocks: language/custom-blocks.md - Functions: language/functions.md - Enums: language/enums.md diff --git a/src/blocks.rs b/src/blocks.rs index 385a4a60..ba5b77be 100644 --- a/src/blocks.rs +++ b/src/blocks.rs @@ -1134,6 +1134,7 @@ pub enum Repr { Answer, Random, Contains, + Tempo, } impl Repr { @@ -1220,6 +1221,7 @@ impl Repr { ("answer", _) => Some(Self::Answer), ("random", _) => Some(Self::Random), ("contains", _) => Some(Self::Contains), + ("tempo", _) => Some(Self::Tempo), _ => None, } } @@ -1261,6 +1263,7 @@ impl Repr { Self::Answer => "answer", Self::Random => "random", Self::Contains => "contains", + Self::Tempo => "tempo", } } @@ -1301,6 +1304,7 @@ impl Repr { "answer", "random", "contains", + "tempo", ] } @@ -1341,6 +1345,7 @@ impl Repr { Self::Answer => "sensing_answer", Self::Random => "operator_random", Self::Contains => "operator_contains", + Self::Tempo => "music_getTempo", } } @@ -1381,6 +1386,7 @@ impl Repr { Self::Answer => &[], Self::Random => &["FROM", "TO"], Self::Contains => &["STRING1", "STRING2"], + Self::Tempo => &[], } } @@ -1421,6 +1427,7 @@ impl Repr { Self::Answer => None, Self::Random => None, Self::Contains => None, + Self::Tempo => None, } } }