%xml{:id => 'toolbox', :style => 'display: none'} - category = 'motion' %category{:name => tt('.motion')} -# ( )歩動かす %block{:type => "#{category}_move"} = toolbox_number_value('STEP', 10) -# 時計回りに( )度回す %block{:type => "#{category}_rotate_right"} = toolbox_number_value('ANGLE', 15) -# 反時計回りに( )度回す %block{:type => "#{category}_rotate_left"} = toolbox_number_value('ANGLE', 15) -# ( )度に向ける %block{:type => "#{category}_set_angle"} = toolbox_number_value('ANGLE', 90) -# [▼]へ向ける %block{:type => "#{category}_point_towards_character"} -# マウスポインターへ向ける %block{:type => "#{category}_point_towards_mouse"} -# x座標を( )、y座標を( )にする %block{:type => "#{category}_set_x_y"} = toolbox_number_value('X') = toolbox_number_value('Y') -# [▼]へ行く %block{:type => "#{category}_go_to_character"} -# マウスポインターへ行く %block{:type => "#{category}_go_to_mouse"} -# ( )秒でx座標を( )、y座標を( )に変える -#%block{:type => "#{category}_glide_to_x_y"} -# = toolbox_number_value('SEC', 1) -# = toolbox_number_value('X') -# = toolbox_number_value('Y') -# x座標を( )ずつ変える %block{:type => "#{category}_change_x_by"} = toolbox_number_value('X', 10) -# x座標を( )にする %block{:type => "#{category}_set_x"} = toolbox_number_value('X', 0) -# y座標を( )ずつ変える %block{:type => "#{category}_change_y_by"} = toolbox_number_value('Y', 10) -# y座標を( )にする %block{:type => "#{category}_set_y"} = toolbox_number_value('Y', 0) -# もし端に着いたら、跳ね返る %block{:type => "#{category}_turn_if_reach_wall"} -# 跳ね返る %block{:type => "#{category}_turn"} -# [▼水平(X)]方向に跳ね返る %block{:type => "#{category}_turn_xy"} -# 回転方法を[▼]にする %block{:type => "#{category}_set_rotation_style"} -# 変数:x座標 %block{:type => "#{category}_self_x"} -# 変数:y座標 %block{:type => "#{category}_self_y"} -# 変数:向き %block{:type => "#{category}_self_angle"} - if current_preferences["toolbox__default__enabled_hardware_blocks"] - category = 'hardware' - subcategory = 'servo' -# サーボ[▼PIN]を( )度(5~180)にする %block{:type => "#{category}_#{subcategory}_set_position"} = toolbox_number_value('POS', 90) - subcategory = 'motor_driver' -# (モータードライバ[▼PIN]で)モーターを[▼正転させる] %block{:type => "#{category}_#{subcategory}"} = toolbox_pin_field('D6') %field{:name => 'METHOD'}< forward -# (モータードライバ[▼PIN]の)モーターの速度を%にする %block{:type => "#{category}_#{subcategory}_set_speed"} = toolbox_pin_field('D6') = toolbox_number_value('SPEED', 100) - if current_preferences["toolbox__default__enabled_2wd_car_blocks"] - subcategory = 'two_wheel_drive_car' -# 2WD車[▼PIN]を( )秒[▼コマンド] %block{:type => "#{category}_#{subcategory}_run"} = toolbox_pin_field('D5') = toolbox_number_value('SEC', 1) %value{:name => 'COMMAND'} %block{:type => "#{category}_#{subcategory}_commands"} -# [▼コマンド] %block{:type => "#{category}_#{subcategory}_commands"} %field{:name => 'COMMAND'}< forward -# 2WD車[▼PIN]を進める %block{:type => "#{category}_#{subcategory}_forward"} = toolbox_pin_field('D5') -# 2WD車[▼PIN]をバックさせる %block{:type => "#{category}_#{subcategory}_backward"} = toolbox_pin_field('D5') -# 2WD車[▼PIN]を左に曲げる %block{:type => "#{category}_#{subcategory}_turn_left"} = toolbox_pin_field('D5') -# 2WD車[▼PIN]を右に曲げる %block{:type => "#{category}_#{subcategory}_turn_right"} = toolbox_pin_field('D5') -# 2WD車[▼PIN]を止める %block{:type => "#{category}_#{subcategory}_stop"} = toolbox_pin_field('D5') -# 2WD車[▼PIN]の[▼LOR]の速度を%にする %block{:type => "#{category}_#{subcategory}_set_speed"} = toolbox_pin_field('D5') = toolbox_number_value('SPEED', 100) - if current_preferences["toolbox__default__enabled_smalrubot_v3_blocks"] - category = 'hardware' - subcategory = 'smalrubot_v3' %block{type: "#{category}_#{subcategory}_action"} %field{name: 'ACTION'}< forward %block{type: "#{category}_#{subcategory}_action_with_sec"} %field{name: 'ACTION'}< forward = toolbox_number_value('SEC', 0.5) %block{type: "#{category}_#{subcategory}_dc_motor_set_power_ratio"} = toolbox_number_value('SPEED', 100) - if current_preferences["toolbox__default__enabled_smalrubot_s1_blocks"] - category = 'hardware' - subcategory = 'smalrubot_s1' %block{type: "#{category}_#{subcategory}_action"} %field{name: 'ACTION'}< forward %block{type: "#{category}_#{subcategory}_action_with_sec"} %field{name: 'ACTION'}< forward = toolbox_number_value('SEC', 0.5) %block{type: "#{category}_#{subcategory}_dc_motor_set_power_ratio"} = toolbox_number_value('SPEED', 100) - category = 'looks' %category{:name => tt('.looks')} -# [ ]と( )秒言う -#%block{:type => "#{category}_say_second"} -# = toolbox_text_value('TEXT', 'こんにちは!') -# = toolbox_number_value('SEC', 2) -# [ ]と言う %block{:type => "#{category}_say"} = toolbox_text_value('TEXT', tt('.hello')) -# [ ]と( )秒考える -#%block{:type => "#{category}_think_second"} -# = toolbox_text_value('TEXT', 'ふーん') -# = toolbox_number_value('SEC', 2) -# [ ]と考える -#%block{:type => "#{category}_think"} -# = toolbox_text_value('TEXT', 'ふーん') -# 表示する %block{:type => "#{category}_show"} -# 隠す %block{:type => "#{category}_hide"} -# 消滅する %block{:type => "#{category}_vanish"} -# 大きさを( )%ずつ変える -#%block{:type => "#{category}_change_scale_by"} -# = toolbox_number_value('SCALE', 10) -# 大きさを( )%にする -#%block{:type => "#{category}_set_scale"} -# = toolbox_number_value('SCALE', 100) -# 変数:大きさ -#%block{:type => "#{category}_self_scale"} -# [▼プリセット画像] -#%block{:type => "#{category}_preset_images"} - if current_preferences["toolbox__default__enabled_hardware_blocks"] - category = 'hardware' - subcategory = 'led' -# LED[▼PIN]をオンにする %block{:type => "#{category}_#{subcategory}_turn_on"} -# LED[▼PIN]をオフにする %block{:type => "#{category}_#{subcategory}_turn_off"} - subcategory = 'rgb_led' -# RGB LED[▼アノード]コモン[▼PIN]を[カラー]にする %block{:type => "#{category}_#{subcategory}_set_color"} -# RGB LED[▼アノード]コモン[▼PIN]をオフにする %block{:type => "#{category}_#{subcategory}_turn_off"} - subcategory = 'seven_segment_display' -# 7セグディスプレイに[▼0-9]を表示する %block{:type => "#{category}_#{subcategory}_show"} -# 7セグディスプレイをオフにする %block{:type => "#{category}_#{subcategory}_off"} - subcategory = 'lcd' -# LCDに( )を表示する %block{:type => "#{category}_#{subcategory}_puts"} = toolbox_text_value('TEXT', 'Hello') -# LCDをクリアする %block{:type => "#{category}_#{subcategory}_clear"} - if current_preferences["toolbox__default__enabled_smalrubot_v3_blocks"] - category = 'hardware' - subcategory = 'smalrubot_v3' %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"} %field{name: 'OOO'}< turn_on - if current_preferences["toolbox__default__enabled_smalrubot_s1_blocks"] - category = 'hardware' - subcategory = 'smalrubot_s1' %block{type: "#{category}_#{subcategory}_led_turn_on_or_off"} %field{name: 'OOO'}< turn_on - category = 'sound' %category{:name => tt('.sound')} -# [▼プリセット音声]の音を鳴らす %block{:type => "#{category}_play"} %value{:name => 'NAME'} %block{:type => "#{category}_preset_sounds"} -# すべての音を止める -#%block{:type => "#{category}_stop"} -# 変数:ボリューム -#%block{:type => "#{category}_volume"} - category = 'pen' %category{:name => tt('.pen')} -# ペンを下ろす %block{:type => "#{category}_down_pen"} -# ペンを上げる %block{:type => "#{category}_up_pen"} -# ペンの色を[カラー]にする %block{:type => "#{category}_set_pen_color"} %category{name: tt('.data'), custom: 'VARIABLE'} - category = 'events' %category{:name => tt('.events')} -# まずは %block{:type => "#{category}_on_start"} -# キーボードの[▼キー]が[▼押された/押され続けている]とき %block{:type => "#{category}_on_key_push_or_down"} = toolbox_key_field = toolbox_pod_field -# キャラクターがクリックされたとき %block{:type => "#{category}_on_click"} -# [▼キャラクター]にぶつかったとき %block{:type => "#{category}_on_hit"} - category = 'control' %category{:name => tt('.control')} -# ( )秒待つ %block{:type => "#{category}_sleep"} = toolbox_number_value('SEC', 1) -# ほんの少し待つ %block{:type => "#{category}_await"} -# ( )回繰り返す %block{:type => "#{category}_times"} = toolbox_number_value('COUNT', 10) -# ずっと %block{:type => "#{category}_loop"} -# もし< >なら %block{:type => "#{category}_if"} -# もし< >なら~でなければ %block{:type => "#{category}_if_else"} -# < >まで待つ %block{:type => "#{category}_await_until"} -# < >まで繰り返す %block{:type => "#{category}_until"} -# 繰り返しから脱出する %block{:type => "#{category}_break"} -# 次の繰り返しにジャンプする %block{:type => "#{category}_next"} -# 現在の繰り返しをやり直す %block{:type => "#{category}_redo"} - category = 'sensing' %category{:name => tt('.sensing')} -# 条件:[▼キャラクター]に触れた %block{:type => "#{category}_hit"} -# 条件:端に触れた %block{:type => "#{category}_reach_wall"} -# [ ]と聞いて待つ -#%block{:type => "#{category}_ask"} -# = toolbox_text_value('TEXT', 'あなたのお名前は?') -# 変数:答え -#%block{:type => "#{category}_answer"} -# 条件:キーボードの[▼キー]が[▼押された] %block{:type => "#{category}_input_key_push_or_down"} = toolbox_key_field = toolbox_pod_field -# 条件:マウスの[▼左ボタン]が[▼押された] %block{:type => "#{category}_input_mouse_push_or_down"} = toolbox_pod_field -# 変数:マウスのx座標 %block{:type => "#{category}_input_mouse_pos_x"} -# 変数:マウスのy座標 %block{:type => "#{category}_input_mouse_pos_y"} -# 変数:タイマー -#%block{:type => "#{category}_timer_count"} -# タイマーをリセット -#%block{:type => "#{category}_timer_reset"} -# 変数:[▼キャラクター]の[▼プロパティ] %block{:type => "#{category}_character_property"} -# 変数:現在の[▼時] %block{:type => "#{category}_time_now"} -# 変数:2000年からの日数 %block{:type => "#{category}_days_since_2000"} - if current_preferences["toolbox__default__enabled_hardware_blocks"] - category = 'hardware' -# センサー[▼PIN] %block{:type => "#{category}_sensor_value"} = toolbox_pin_field('A0') -# 条件:ボタン[▼PIN]が[▼押された] %block{:type => "#{category}_button_pressed_or_released"} = toolbox_pin_field('D3') -# (モータードライバ[▼PIN]の)モーターの速度(%) %block{:type => "#{category}_motor_driver_speed"} = toolbox_pin_field('D6') - if current_preferences["toolbox__default__enabled_2wd_car_blocks"] - category = 'hardware' -# 2WD車[▼PIN]の[▼LOR]の速度% %block{:type => "#{category}_two_wheel_drive_car_speed"} = toolbox_pin_field('D5') - if current_preferences["toolbox__default__enabled_smalrubot_v3_blocks"] - category = 'hardware' - subcategory = 'smalrubot_v3' %block{type: "#{category}_#{subcategory}_sensor_value"} %block{type: "#{category}_#{subcategory}_dc_motor_power_ratio"} - if current_preferences["toolbox__default__enabled_smalrubot_s1_blocks"] - category = 'hardware' - subcategory = 'smalrubot_s1' %block{type: "#{category}_#{subcategory}_sensor_value"} %block{type: "#{category}_#{subcategory}_dc_motor_power_ratio"} - category = 'operators' %category{:name => tt('.operators')} -# 数値 %block{:type => 'math_number'} %field{:name => 'NUM'}< 0 -# テキスト %block{:type => 'text'} %field{:name => 'TEXT'}< = tt('.text') -# 変数:( ) + ( ) %block{:type => "#{category}_add"} -# 変数:( ) - ( ) %block{:type => "#{category}_minus"} -# 変数:( ) * ( ) %block{:type => "#{category}_multiply"} -# 変数:( ) / ( ) %block{:type => "#{category}_divide"} -# 変数:( )から( )までの乱数 %block{:type => "#{category}_rand"} = toolbox_number_value('A', 1) = toolbox_number_value('B', 10) -# 条件:( ) < ( ) %block{:type => "#{category}_compare_lt"} -# 条件:( ) <= ( ) %block{:type => "#{category}_compare_lte"} -# 条件:( ) = ( ) %block{:type => "#{category}_compare_eq"} -# 条件:( ) >= ( ) %block{:type => "#{category}_compare_gte"} -# 条件:( ) > ( ) %block{:type => "#{category}_compare_gt"} -# 条件:< > かつ < > %block{:type => "#{category}_and"} -# 条件:< > または < > %block{:type => "#{category}_or"} -# 条件:< > ではない %block{:type => "#{category}_negate"} -# 変数:( )の( )番目 %block{:type => "#{category}_index_of"} = toolbox_text_value('A', tt('.world')) = toolbox_number_value('INDEX', 1) -# 変数:( )の長さ %block{:type => "#{category}_length"} = toolbox_text_value('A', tt('.world')) -# 変数:( )を( )で割った余り %block{:type => "#{category}_modulo"} = toolbox_number_value('A', 5) = toolbox_number_value('B', 2) -# 変数:( )を四捨五入 %block{:type => "#{category}_round"} = toolbox_number_value('A', 0.5) -# 変数:( )の[▼数学関数] %block{:type => "#{category}_math_method"} = toolbox_number_value('NUM', 9) %field{:name => 'METHOD'}< Math.sqrt(%num%) -# 条件:真 %block{:type => "#{category}_true"} -# 条件:偽 %block{:type => "#{category}_false"} %category{:name => tt('.etc')} - category = 'ruby' -# 文 %block{:type => "#{category}_statement"} -# 式 %block{:type => "#{category}_expression"} -# コメント %block{:type => "#{category}_comment"} -# p %block{:type => "#{category}_p"} - if !current_preferences["enabled_auto_init_hardware"] && (current_preferences["toolbox__default__enabled_hardware_blocks"] || current_preferences["toolbox__default__enabled_smalrubot_v3_blocks"] || current_preferences["toolbox__default__enabled_smalrubot_s1_blocks"]) - category = 'hardware' -# ハードウェアを準備する %block{:type => "#{category}_init_hardware"}