Blocks documentation

Categories

control

Call the given block with the given args.
Return the given block without executing it
Run the given block with the given list of args.
Return myself
send a broadcast message ans wait for all receivers finish their work.
Forever loop if the given condition is true
Following blocks are executed when the green flag is pressed
If the given arg is true, execute the first list of blocks, else the second
Stop all the scripts for the given event
Save the current project
Stop the current block!
Do nothing; just wait until the given condition.
Launch the given block in another thread.
Pause the main process and wait the user click on the OK button
If the given arg is true, execute the following blocks
Launch the given block in another thread with the given list of args.
Stop everything!
Broadcast the given event name.
Forever loop
Answer the given result.
Make like if the user presses the Green flag.
Return the given block with args without executing it
Call the given block with a list of args.
Answer the first string if the given condition is true, otherwise answer the second.
Answer true if the given event is received.
Repeat the given number times the included blocks
Return the given script without executing it
Repeat until the given condition
Launch the given block in another thread with the given args.
Delete the given sprite
Following blocks are executed when the given event is received
Run the given block with the given args.
Following blocks are executed when the given sprite is clicked
Following blocks are executed when the given key is pressed
Answer the first boolean if the given condition is true, otherwise answer the second.
Do nothing; just wait for the time interval to elapse.
WARNING: this block closes Phratch !
Stop the current script
Run the given block
Return the given script with arguments without executing it
Call the given block
Duplicate me: My duplication is registered in the environment
Following blocks are executed when the given sprite is created
Clone me without registering me in the environemnt
Delete me only if I am a clone
Return true if I am a clone

operators

Answer the given string as an integer.
Divider operator. It combines two numbers and returns a number
Addition operator. It returns the addition of two numbers
Return true if the given object is a kind of given type
Return the number of characters of the given string
Return the power n of the given number.
Returns the negation of a number
Multiplication operator. It returns the multiplication of two numbers
boolean operator ‘&’. It combines two booleans and returns a boolean
Return true if the given number is in the Fibonacci sequence
Answer a random number within the given range. If both min and max are integers, the result is rounded to the nearest integer.
Return the rounded value of the given argument
Modulo operator. It returns the modulo of two numbers
Convert an ascii number into a letter
Return the value of the given constant
It gives the ascii code of a character
Return the date and time current value
Return the result of computing the given mathematical function on the given number.
Return the index of the given value in the given list starting at a given index
Substraction operator. It returns the substraction of two numbers
Answer the given string as a boolean.
Comparator. It returns true if the first element is greater than the second
Return true if the given value is an integer
Verify if the given value is nil
Comparator. It returns true if the first element is smaller than the second
Not operator. It is applied on a boolean
Return the letters in a string from the start index through the end index.
Boolean operator ‘OR’
Comparator. It returns true if the first element is equals to the second
Return the boolean False
Compute the factorial of the given number
Return the boolean True
Answer the ith letter of the given string. Answer the empty string if the index is out of bounds.
Return true if the given integer is prime
Concatenate two strings. Arguments are converted to strings.

variables

Get the variable or list with the given name
Add a new variable with the given name locale to the object. Do nothing if the variable already exists or is built in.
Change the value of the given variable of this object by the given amount.
Hide the watcher(s) for the given variable. If the receiver is a sprite and both it and and the stage have the given variable, hide both. Do nothing if the variable does not exist or is already hidden.
Show the watcher(s) for the given variable. If the receiver is a sprite and both it and and the stage have the given variable, show both. Do nothing if the variable does not exist or is already showing.
Set the value of the given variable of this object to the given value.
Set the given watcher layout of the variable to the given style
Move the watcher of the given variable at the position x,y. Do nothing if the watcher is hidden
Delete the variable with the given name. It can remove a global or local variable. Do nothing if the variable doesn’t exist.
Answer the value of the given variable.

colors

Give the value of the red in the RGB representation of the color
Give the value of the brightness of the given color
Return the color with the given name
Give the value of the hue of the given color
Give the value of the blue in the RGB representation of the color
Mix the two colors with the given ratios
Give the value of the saturation of the given color
Answer the given HSB color.
Hide the watcher(s) for the given color. If the receiver is a sprite and both it and and the stage have the given color, hide both. Do nothing if the color does not exist or is already hidden.
select the color of the given pixel
Mix the two colors
Convert the given string into a color
Give the value of the green in the RGB representation of the color
Answer the given RGB color.
Answer the value of the given color variable of this object or its parent.
Give the RGB string representation of the given color
Show the watcher for the given color. If the receiver is a sprite and both it and and the stage have the given color, hide both. Do nothing if the color does not exist or is already hidden.
Set the given color attribute to the given value
Delete the color variable with the given name. Do nothing if the variable doesn’t exist.
Add a new random color with the given name to this object.

files

Answer the contents of the given file.
Write the given text in the given file.
Answer the number of lines in the given URL file.
Answer the contents of the given line of the given URL.
Answer the contents of the given URL.
Delete the given file.
Answer the contents of the given line of the given file.
Clear the given file.
Answer the number of lines in the given file.
Create the given file name.

list

Hide the watcher(s) for the given list. If the receiver is a sprite and both it and and the stage have the given list, hide both. Do nothing if the list does not exist or is already hidden.
Give the number of items in the given list
Sort the list using the character order
Return a list of the given arguments. This list is not stored in the environment
Verify if the list contains the given object.
Return the value of given item number in the given list
Return the index of the given value in the given list
Give the contents of the given list
Sort the given list numerically
Insert a value at the given index of the given list
Delete the list variable with the given name. Do nothing if the list doesn’t exist.
Return a copy of the given list
Add a new value to the selected list.
Show the watcher(s) for the given list. If the receiver is a sprite and both it and and the stage have the given list, show both. Do nothing if the list does not exist or is already showing.
Create the given list.
Return the number times that the given value appears in the given list
Remove the given entry of the given list
Replace the given item of the list by the given value

looks

Set the given graphic effect to the given value.
Do the included block while opening the camera
Reset all the graphics filters applied to the sprite
return true if the camera is open
Close the camera. Do nothing if the camera is already close.
Answer the provided graphic effect
Open the camera if close. If it is already open, the block does nothing
Change the given graphic effect by the given value.
Delete the given costume
Set x stretch percent relative to y. For example, a stretch of 200 stretches x by a factor of two relative to y while a stretch of 50 compresses x by a factor of two. As my stretch is changed, my x scale changes but my y scale remains the same.
Decrease my layer by (i.e., move me towards the back by) the given number of layers.
Change my size by the given delta.
Add a new costume to the sprite
Compute the area based on the height and width of the sprite
Put me on front of the display
Return the size percentage of the costume
Show the next costume in my costumes list.
Answer my horizontal stretch.
Present a thought bubble with the given string, during the given time
Return my width
Return true if I am visible.
Make my costume an horizontal flip
Flip vertically myself
Change my Costume
Answer my height.
Present a thought bubble with the given string.
Set y stretch percent relative to x. For example, a stretch of 200 stretches yt by a factor of two relative to x while a stretch of 50 compresses y by a factor of two. As my stretch is changed, my y scale changes but my x scale remains the same.
Present a talk bubble with the given string during the given time.
Return the perimeter based on the width and height
Increase my layer by (i.e., move me towards the back by) the given number of layers.
Stretch vertically myself
Make myself visible.
Set my size to the given percent of the original size. Limit the range to avoid accidentally making me invisibly tiny or really huge. Retain my aspect ratio (i.e., my stretch).
Make myself invisible.
Present a talk bubble with the given string.
Change my horizontal aspect ratio by the given amount.
Change my vertical aspect ratio by the given amount.
Replace the given costume
Change my background.
Replace the given background
Answer the index of my current background.
Change my vertical pan by the given amount.
Show the next background in my backgrounds list.
Remove the given background
Set my horizontal pan to the given offset.
Add a new background
Change my horizontal pan by the given amount.
Set my vertical pan to the given offset.

motion

Point me to a random position
Return my y position
Set my direction to bounce off when touching the given sprite
Go to the given sprite or mouse position.
Make me undraggable during the execution
Return my rotation style
Set my rotation style to #normal, #leftRight, or #none. Styles mean:
#normal — smooth 360 degree rotation
#leftRight — flip about the vertical axis
#none — do not rotate
Make the sprite goes between two positions
Point toward the given sprite.
Turn counter-clockwise the given number of degrees.
Turn clockwise the given number of degrees.
Answer my heading in degrees, a number between -180 and 180.
Move left or right by the given amount.
Return true if I am draggable
Set my heading to point at the given point.
Set my heading in degrees, where 0 degrees is facing up and the heading increases clockwise.
Move up or down by the given amount.
Set my y position
Make a part of the way to the given point
Set my x position
Move the sprite based on the arrow keys
Set my direction to bounce off the edge.
Move the object forward (i.e., the direction of its heading) by the given distance.
Set my direction to bounce off the given condition is true
Return my x position
Interpolate my position from my current postion to the given x and y over the given duration.
Make me draggable during the execution
Go to the given position.

pen

Return my pen color
Put down my drawing pen (i.e. start drawing a pen trail).
Stamp a copy of my current costume on the pen trails layer.
Return my pen shade
Put up my drawing pen (i.e. stop drawing a pen trail).
Set the pen hue to given number between 0 and 200. (That makes 100 the ‘maximum’ distance away from the original color on the color wheel.)
Return my pen size
Change my pen width.
Return my pen hue
Set my pen color.
Change the pen hue by given number.
Set the pen shade (lightness) to given number between 0 and 100. A shade of 0 is black, 100 is white, and 50 is fully saturated color.
Clear the pen trails layer.
Change the pen shade (lightness) by given number
Set my pen width.
Remove my pen trails Form. It will be recreated later if it is needed.

sensing

Answer the variable or built-in attribute value for the given sprite. Answer zero if the given sprite does not have a built-in attribute or variable of the given name.
Reset the timer
Return the value of the given attribute
Answer the variable or built-in attribute value for the given sprite. Answer zero if the given sprite does not have a built-in attribute or variable of the given name.
Set the given attribute to the given value
Return the given sprite
Give the y position of the mouse
Return the timer
Return true if the currently pressed key is the given argument.
Show a popup with the given information. Wait for the user to click on the OK button
Ask for the given question, and wait for an answer
Give the x position of the mouse
Return true if the mouse is pressed
Return the latest answer given by the user. An answer should be given when one of the blocks ‘ask…’ is executed.
Answer the currently pressed key.
Show a popup with the given question. Wait for the answer.
Answer true if any of my non-transparent pixels touch pixels of the given color in the world.
Compute the distance between the sprite and a point.
Change my name to the given string
Return true if any of my pixels of sensitiveColor intersect with pixels of soughtColor in the world.
Open a warning dialogbox
Answer true if any visible part of me touches a visible part of the given sprite.
Answer the distance to the given sprite.

ev3-exp

ev3 sensor

Get the symbol of the given sensor.
Get the min and max value of the given sensor.
Get the name of the given sensor
Get the mode of the given sensor.
Read the Si value of the given sensor.
Get the name of the current mode.
Read the sensor and gives the current value with the unit.
Get the number of Bumps of the given sensor, if available. It the Bumps is not available, it returns 0
Get the changes of the given sensor, if available. It the change is not available, it returns 0
Clean all data of the sensor
Get the figures of the given sensor, if available. It the figure is not available, it returns 0
Get the type of the given sensor.
Clean all changes of the sensor
Return the latest ready Si value
Return the raw data of the sensor.
Get the raw data of the given sensor.
Return the latest ready Pct value
Set the mode of the given sensor. By default, it is set to mode 0
Read the current value of the sensor.

ev3 motor

Returns the number of steps of the given motor
Start the given motor at the preset speed
Move the motor during the given time with a given power
Allow to synchronize 2 motors
Turn the vehicle on the left and reversed when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Reverse the polarity of the motor
Return the current motor speed
set the power of the given motor
Turn the vehicle on the right when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Start two synchronized motors at the given speed for the given degrees with a ratio representing the speed difference between the two motors.
Set to 0 the number of steps of the given motor.
Return true if the motor is currently running
Turn the vehicle on the right when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Turn the vehicle on the right when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Return true if the motor is reversed. It means the polarity is set to false
Move the given motor to a given speed for the given degrees.
Move the motor to a position relative to current position with a given speed
Break stop of the given motor.
Stop the motor by decreasing the speed
Move the motor for the given steps with a given power
Start the given motor to a given speed.
Turn the vehicle on the right and reversed when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Start two synchronized motors at the given speed with a ratio representing the speed difference between the two motors.
Move the synchonized motors during the given time with a given speed.
Move the motor to a position with a given speed
Move the motor during the given time with a given speed.
Turn the vehicle on the right when two motors are synchronized. You have to set the speed, the percentage of difference between the two motors, and the angle in degree that the motors should turn.
Set the speed of the given motor
Set the polarity of the given motor

ev3 UI

Draw a circle on the screen. After sending this command, you need to update the screen view.
Choose a font for the next text displayed on the screen.
Draw a text on the screen. After sending this command, you need to update the screen view.
Draw a line on the screen. After sending this command, you need to update the screen view.
Play a tone with the given frequency at the given volume during the given time.
Draw an horizontal dotted line on the screen. After sending this command, you need to update the screen view.
Draw a rectangle with the inverse screen color. After sending this command, you need to update the screen view.
Draw a vertical dotted line on the screen. After sending this command, you need to update the screen view.
Update the screen view.
Fill the screen. After sending this command, you need to update the screen view.
Stop the current running sound.
Show the top line of the Minstorm screen.
Play a beep sound.
Change the LED behavior.
Clean the screen view. You can give a boolean to show or hide the top line.
Draw a rectangle on the screen. After sending this command, you need to update the screen view.
Clean the screen view.
Draw a pixel on the screen. After sending this command, you need to update the screen view.

ev3 brick

Connect to the given Ev3 IP
Give a list of the files and folders in the given path. The length is the number of characters you want to display.
Disconnect to the selected Mindstorm
Reset all existing connections
Return true if an Ev3 is connected
Stop the current running program.
Returns the firmware number
Start the given program.

One thought on “Blocks documentation

  1. Hy, i have a little problem : the “key XXX pressed” event only occurs once, so when the user continue to press the key, event loops to handle the key are simply ignored… Is there a way to handle “down” and “up” key events, like HTML ?
    Sincerely yours.

Leave a Reply

Your email address will not be published. Required fields are marked *