add(get(serial),1);
However it would not change the actual get(serial) value how could that?? The confusion is because the add function works over the variable that is passed as the first argument ( like by reference in programming languages). But by doing the last action nothing is changed, what I mean is that if I use the following code:
OK
viewer.addVariable("serial",1);
this would be nothing more than a string equaling 1
unless you do
var serial = 1;
in your js
viewer.addVariable("serial",serial);
to pass a real js variable into krpano.
if want to change the value of serial of your js you could do
js(setval(serial,2));
js only calls a function so we need one setup for us
javascript function
function setval(var) {
serial = var;
krpano.set("serial", serial);
}
and our js function updates the krpano value.
I have no idea what you are trying to do. So there are probably easier methods. But at least you can cross talk from krpano, to js and back again.
see here for more details.
http://krpano.com/docu/js/