#include "Behaviors/StateMachine.h"

$nodeclass Example2 : StateNode {

      $nodeclass ReportButton : StateNode : doStart {
              size_t button = event->getSourceID();
                  if ( button < RobotInfo::NumButtons )
                            cout << "Sensed the " << button << " button." << endl;
                                else
                                          cout << "Event had invalid button number: " << button << endl;
                                            }

                                              $setupmachine{
                                                      speak: SpeechNode("Press a button")
                                                          bark: SoundNode("barkmed.wav")
                                                              report: ReportButton

                                                                  speak =B=> report =N=> bark =C=> speak
                                                                    }

}

REGISTER_BEHAVIOR(Example2);
