/

Tutorial - Getting and setting part properties

instructions

Instructions

In this tutorial, we'll set up a simple flowchart that checks the state of a chip pan and turns a smoke alarm on if the chip pan is on fire.
  1. From the Parts pane drag on a button then right click and using the properties window select + then navigate to common on school croc images house (inside) pan on onto your scene. Next you need a smoke alarm animation the animation comes from outputs, drag on an animation part then right click, properties + button and navigate to common the animations and smoke alarm.
  2. From the Parts pane, add a start flowchart part.
  3. We need to check the value of the pan button (that is, whether it is on or off) and then set the smoke alarm animation so that it is on. Drag on a get property part from the Parts pane inputs and outputs so that it connects directly with the start part.
  4. Associate the get property part to the pan using the target tool. Now click on 'Property' to select the property of the pan button whose value will be stored in the variable x. Select 'Value'.
  5. The 'value' property of a button is of Boolean type, so it is TRUE when the button is pressed and FALSE when it is not pressed. So to test whether the button is pressed (and the pan is on fire), drag on a test variable part from decisions and connect it directly to the set variable part.
  6. We want to see whether x is TRUE, so click on the '0' on the test variable part and enter 'TRUE' instead. (Make sure you use upper case letters, or the flowchart will not run as expected.)
  7. If x is not TRUE, we need to keep checking the state of the button until it is pressed, so connect the 'N' output of the test variable part to the input of the get property part.
  8. If x is TRUE, then we want to set the fire alarm animation so that the alarm is on. Drag on a call action part from inputs and outputs and connect it directly to the 'Y' output of the test variable part.
  9. Associate the call action part to the smoke alarm animation and, selection the animation "Smoke alarm on" from its action menu.
  10. Add a delay part from the Parts pane and connect it directly to the set property part.
  11. Add a call action part to the scene and connect it directly to the delay part. Use it to change back to the "smoke alarm off" animation.
  12. Add a stop part and connect it directly to the last set property part.
  13. Now run the flowchart. Click on the pan to change its state. If the pan is on fire, the smoke alarm sounds for five seconds and then goes off.