The response script also requires changes to the targeted response event, and processing of the choices specified in the intial script. The changes to the code are displayed in bolded text below:
###################################################################
# Script: HelloWorld/HANDLER/response
#
# This is where we'll handle script responses.
#
##################################################################
#/////////////////////////////////////////////////////////////////# This is the main entry point for this script. Whenever a response
# event occurs, this script is called. This will get called for
# EACH recipient.
#/////////////////////////////////////////////////////////////////main:
# only log information if debug is set
IF (EXISTS($event.debug))
@script::log("Response script called with response event " & $response.response_event)
ENDIF
# has a response has been received?
IF ( $response.response_event =="RECEIVED_RESPONSE" )
# only log information if debug is set
IF (EXISTS($event.debug))
@script::log("Response from recipient " & $response.recipient_target & ": " & $response.reply)
ENDIF
# since a response has been receive from this device,
# decrement the target device count
$main.targetDevices = $main.targetDevices - 1
# if the target device counter is zero, it means responses have
# been received from all targeted devices, and the event can now
# be flagged as complete
IF ($main.targetDevices == 0)
# set continue to true (causes HelloWorld/PROCESS/initial
# to continue)
$main.continue = TRUE
ENDIF
ENDIF
### DONE: main ###