An othe idea for Global Agent Method

Call this method form anywhere, and forget about the size of the ballon…

globals.callAgent(‘This is a test for the agent…bla…bla…’);

The method is

plugins.agent.show();

//Determines correct size of the baloon, depending on the amount of text.

var number_of_letters= arguments[0].length;

var c = 0;
var i = 0;
while ((i=arguments[0].indexOf("\n",i))!=-1) {
	i++;
	c++;
}


var hight = (((number_of_letters / 28)+c) * 16) + 21;

plugins.agent.setBalloonSize(200,hight);
plugins.agent.speak(arguments[0]);

//Servoy will automatically hide the baloon (time not adjustable, servoy handles it automatically. Not very good...)
//But the image of the agent will still be displayed, after the baloon hides.
//To hide the image, do this:
//The number is in seconds * 1000

var startDate = new Date();
startDate.setTime(startDate.getTime()+5000);
plugins.scheduler.addJob('HideAgent'+ startDate.getTime(),startDate,globals.hideAgent);

The method globals.hideAgent is:

plugins.agent.hide();

What this is missing is been able to hide BOTH the baloon an Agent at the same time. (of course an adjustable time. !!!)
Any ideas ???
Maybe this should all be a funtion of servoy ???

The plug-ins we provide for free are meant as examples. They are FUNCTIONAL examples, but examples nonetheless.

The source of this bean is open. You can change it however you want via Java.