Set the break event with Scilab figure
imbreakset()
This function set the event handle for a figure and listen to the "Esc" key. The global variable "breakloop" is set to true if Esc key detected and break from the loop prematured or break from the infinite loop.