Page 1 of 1

Change icon when ignition on

Posted: Wed Jan 17, 2018 9:58 am
by bertagnan
Hi all,
I created an event for "ignition on" and then during this event wanted to change the icon according to the ignition state.

I thus used Client script acquiring the ignition signal through the "Argument" as well explained in the blog.

Code: Select all

var quadro = Core.resolveInput('Quadro');

Core.log("Quadro:");

Core.log(quadro);


if (quadro) {
   Map.setMarkerIcon('car_yellow.png');
   Map.setMarkerColor('FF0000');
}

else

{
   Map.setMarkerIcon('car_white.png');
   Map.setMarkerColor('00FF00');

}
"Quadro" is the argument for [SIGNAL_IGNITION]

Where in the code you find "if (quadro)" I have tried every possible expression (boolean, text, integer) to try to make it work. The event is running always (start, pending, finish) as I expect the icon to be restored at the last step.


I should be making some big conceptual mistake.

Is anyone willing to help? Where I am terribly wrong? :roll:

Re: Change icon when ignition on

Posted: Fri Mar 23, 2018 5:36 am
by BSO
Hi bertagnan,

Ignition parameter is string format and the values are 'True' or 'False'
also, please update your core plugin to latest update

Please try this, it's working for me :D :

Code: Select all

var quadro= Core.resolveInput('Quadro');

if(quadro == 'True')
{
//if ignition On, marker change color to green
  Map.setMarkerColor('00FF00');
}
else if(quadro == 'False')
{
//if ignition Off, marker change color to black
  Map.setMarkerColor('000000');
}