# Marker values in Beanshell and debug popup

**URL:** <https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918>\
**Category:** Module Design\
**Created:** [February 22, 2026, 7:37am UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918 "2026-02-22T07:37:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cholmcc](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/cholmcc/32/8319_2.png) [@cholmcc](https://forum.vassalengine.org/u/cholmcc)\
**Post date:** [February 22, 2026, 8:13am UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918/2 "2026-02-22T08:13:21Z")

</div>

> [@gusi](#):
>
> When I add it to a larger debug popup, it errors with a Bad Data in Module Piece error.

Did you check the [errorLog](https://forum.vassalengine.org/t/where-is-my-error-log/79314). Often it will give a bit more information about that is possibly wrong.

> [@gusi](#):
>
> It works fine without the initiative lines.
> 
> ```auto
> {
> out = “”;
> 
> out = out + "PieceName = " + GetProperty(“PieceName”) + “\n”;
> 
> ```

You _should_ be able to simply do

```auto
out = out + "PieceName = " + PieceName +"\n";

```

or even

```auto
out += "PieceName = " + PieceName + "\n"

```

> [@gusi](#):
>
> ```auto
> out = out + "Initiative = " + Initiative.toString() + “\n”;
> out = out + "Initiative = " + GetProperty(“Initiative”) + “\n”;
> 
> ```

Which _specific_ line makes the code fail?

You _could_ try

```auto
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

```auto
try { 
  out += "Initiative = " + Initiative.toString() + "\n";
} catch (Exception e) {
  out += "Initiative = unknown\n"
}

```

Yours,  
_Christian_

---

_[View the full topic](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918)._
