Okay: What am I doing wrong? I've cut the code down to the bare bones to show you my problem. Very simple. Save this code as anything (say test.efs) and then load it into a chart:
var init = true;
function preMain() {
var x = new FunctionParameter("TP", FunctionParameter.BOOLEAN);
with(x) {
setName("Test Param");
setDefault(true);
}
init = true;
}
function main(TP) {
if(init) {
debugPrintln("TP is: " + TP);
if(TP) {
debugPrintln("TP in true condition");
}
else {
debugPrintln("TP in false condition");
}
init = false;
}
}
Now in the output window after loading the script and then right clicking the advanced chart and changing the single parameter to false I get:
TP is: true
TP in true condition
TP is: fase
TP in true condition
In other words, even though TP appears to be "false" it doesn't go into the false part of the clause. I've also attached the file to this message. Please could someone else also load this and let me know if I've done something stupid. I can't see what I've done wrong here...?
Many thanks
var init = true;
function preMain() {
var x = new FunctionParameter("TP", FunctionParameter.BOOLEAN);
with(x) {
setName("Test Param");
setDefault(true);
}
init = true;
}
function main(TP) {
if(init) {
debugPrintln("TP is: " + TP);
if(TP) {
debugPrintln("TP in true condition");
}
else {
debugPrintln("TP in false condition");
}
init = false;
}
}
Now in the output window after loading the script and then right clicking the advanced chart and changing the single parameter to false I get:
TP is: true
TP in true condition
TP is: fase
TP in true condition
In other words, even though TP appears to be "false" it doesn't go into the false part of the clause. I've also attached the file to this message. Please could someone else also load this and let me know if I've done something stupid. I can't see what I've done wrong here...?
Many thanks
Comment