String action = element.attributeValue("action");
String varName = element.attributeValue("varname");
if (varName == null) varName = "SCORE";
varName.trim();
String varVal = element.getText();
Variable var = vars.getVariable(varName);
if (var == null) throw new RuntimeException("var "+varName+" is in setvar, but was not declared ");
if (action.equals("Set")) {
var.setValue(varVal);
} else {
// we are doing Integer or float arithmetic
// Add | Subtract | Multiply | Divide
if (action.equals("Add")) {
var.add(varVal);
} else if (action.equals("Subtract")) {
var.subtract(varVal);
} else if (action.equals("Multiply")) {
var.multiply(varVal);
} else if (action.equals("Divide")) {
var.divide(varVal);
}
}
}
// set displayfeedback
//<displayfeedback feedbacktype = "Response" linkrefid = "Correct"/>