
' ==========================================================
'   EXTERNAL COMMANDS EXAMPLE
' ==========================================================

Variable Numeric Slot_ExternalCommands = 1
Wait Slot(3) > 500
Beep 1000 100
Beep 1500 100
Beep 2000 100
Stop

Label Event_ExternalCommands
	' --------------------------------- Extract first word
	Select GetSeparatedString(CommandText, 0)
		Case ""
		' -----------------------------
		Case "Beep"
			Beep 440 300
			ClearCommand
		' -----------------------------
		Case "Beep_Multiple"
			ExecBeepMultiple
			ClearCommand
			' -----------------------------
		Case "WaitSlot3"
			ClearCommand
			Wait Slot(3) > 500
			Beep 1000 100
			Beep 800 100
			Beep 500 100
				' --------------------- Commands with parameters
		Case "Say"
			TTS Speak Mid(CFE1, 5)
			Wait TTSready
			ClearCommand
			' ------------------------- Unrecognized command
		CaseElse
			Wait Seconds 0.5
			Beep 200 500
			Print "Unrecognized command: " + CommandText
			Wait Seconds 0.5
			ClearCommand
	EndSelect
Return

Label ClearCommand
	SlotText(Slot_ExternalCommands) = ""
Return

Label ExecBeepMultiple
	For v1 = 1 To 3
		Beep 880 400
		Wait Seconds 0.5
	Next
Return


'WATCH v1
'EXEC DestX = 12
