Did you check the errorLog. Often it will give a bit more information about that is possibly wrong.
You should be able to simply do
out = out + "PieceName = " + PieceName +"\n";
or even
out += "PieceName = " + PieceName + "\n"
Which specific line makes the code fail?
You could try
out += "Initiative = " + GetString("Initiative") + "\n";
If Initiative has type of something that does not have the toString method, then the above could fail. The BeanShell function GetString will check for such circumstances and take appropriate actions.
Another possible explanation is that the properties are not defined in the context in which your code is executed. In all other cases than Initiative you retrieve the property values with GetProperty which is fault tolerant if the property isn’t defined. You could try - though I’m not sure it is supported by BeanShell - the code
try {
out += "Initiative = " + Initiative.toString() + "\n";
} catch (Exception e) {
out += "Initiative = unknown\n"
}
Yours,
Christian