If you don't use curly braces, only the line immediately following the "if" (where the line ends at the first semicolon) is actually part of the if statement.
What you wrote is equivalent to this:
var oldValue = ogscript.getObject('0x10CD-Old');
var xpt = params.getValue(0x10CD,0);
if (oldValue == xpt)
return;
ogscript.putObject('0x10CD-Old', xpt);
if (xpt == 1005)
{
rosstalk.sendMessage('172.16.0.102', 7788, 'MEM 01');
}
rosstalk.sendMessage('172.16.0.103', 7788, 'MEM 01');
if (xpt == 1007)
{
rosstalk.sendMessage('172.16.0.102', 7788, 'MEM 02');
}
rosstalk.sendMessage('172.16.0.103', 7788, 'MEM 02');
if (xpt == 0)
{
ogscript.reveal('CHANGE-1');
}
Where what you really want is more like this:
var oldValue = ogscript.getObject('0x10CD-Old');
var xpt = params.getValue(0x10CD,0);
if (oldValue == xpt)
return;
ogscript.putObject('0x10CD-Old', xpt);
if (xpt == 1005)
{
rosstalk.sendMessage('172.16.0.102', 7788, 'MEM 01');
rosstalk.sendMessage('172.16.0.103', 7788, 'MEM 01');
}
if (xpt == 1007)
{
rosstalk.sendMessage('172.16.0.102', 7788, 'MEM 02');
rosstalk.sendMessage('172.16.0.103', 7788, 'MEM 02');
}
if (xpt == 0)
{
ogscript.reveal('CHANGE-1');
}
#DashBoard