# 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:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gusi](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/g/9fc29f/32.png) [@gusi](https://forum.vassalengine.org/u/gusi)\
**Post date:** [February 22, 2026, 7:37am UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918/1 "2026-02-22T07:37:26Z")

</div>

I have a marker property called Initiative.

I can refer to it in a Beanshell expression in a report action as  
$Initiative$

{Initiative}

Initiative.toString()

GetProperty(“Initiative”)

it works fine.

When I add it to a larger debug popup, it errors with a Bad Data in Module Piece error.  
I find the properties pop handy for debugging.  
It works fine without the initiative lines.

{  
out = “”;

out = out + "PieceName = " + GetProperty(“PieceName”) + “\n”;  
out = out + "BasicName = " + GetProperty(“BasicName”) + “\n”;

out = out + "LocationName = " + GetProperty(“LocationName”) + “\n”;  
out = out + "OldLocationName = " + GetProperty(“OldLocationName”) + “\n”;

out = out + "CurrentX = " + GetProperty(“CurrentX”) + “\n”;  
out = out + "CurrentY = " + GetProperty(“CurrentY”) + “\n”;  
out = out + "OldX = " + GetProperty(“OldX”) + “\n”;  
out = out + "OldY = " + GetProperty(“OldY”) + “\n”;

out = out + "MapName = " + GetProperty(“MapName”) + “\n”;  
out = out + "CurrentMap = " + GetProperty(“CurrentMap”) + “\n”;  
out = out + "CurrentBoard = " + GetProperty(“CurrentBoard”) + “\n”;

out = out + "DeckName = " + GetProperty(“DeckName”) + “\n”;  
out = out + "Layer = " + GetProperty(“Layer”) + “\n”;

out = out + "Initiative = " + Initiative.toString() + “\n”;  
out = out + "Initiative = " + GetProperty(“Initiative”) + “\n”;

Alert(out);  
“”  
}

cheers

Gus

---

<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_

---

<div class="post-metadata">

**Author:** ![gusi](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/g/9fc29f/32.png) [@gusi](https://forum.vassalengine.org/u/gusi)\
**Post date:** [February 22, 2026, 11:50am UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918/3 "2026-02-22T11:50:27Z")

</div>

Hi Christian,

Thanks for your explanation.

This works (woohoo 🙂 )  
out += "Initiative = " + GetString(“Initiative”) + “\n”;

I am not in VASSAL often and I find that the debug window really helps.

I’ll check out the error log as well.

Thanks

Gus

---

<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, 12:17pm UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918/4 "2026-02-22T12:17:31Z")

</div>

> [@gusi](#):
>
> I am not in VASSAL often and I find that the debug window really helps.

I often define a boolean `Debug` [Preference](https://vassalengine.org/doc/latest/ReferenceManual/Preferences.html#top) and then have `reportFormat` or `report` like

```auto
{Debug ? ("~"+PieceName+" has ....") : ""}

```

and attach a bunch of [Report Action](https://vassalengine.org/doc/latest/ReferenceManual/ReportChanges.html#top) traits to various actions. Then, if I set the preference to `true`, I can get a trace of the actions taken in the chat log. If I turn off the debugging, I get nothing (the tertiary expression `<condition> ? <then> : <else>`). Very useful when hunting down things that doesn’t work as expected.

I don’t often use the `Alert` feature, because it requires user interaction 🙂

See [most of the modules I’ve made](https://vassalengine.org/library/search?owner=cholmcc) for examples.

Yours,  
_Christian_

---

<div class="post-metadata">

**Author:** ![gusi](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/g/9fc29f/32.png) [@gusi](https://forum.vassalengine.org/u/gusi)\
**Post date:** [February 23, 2026, 12:02pm UTC](https://forum.vassalengine.org/t/marker-values-in-beanshell-and-debug-popup/89918/5 "2026-02-23T12:02:16Z")

</div>

That is a good idea, I’ll give it a go.

I did a lot of unix/c programming in the 90s but, never touched java.  
These days it is mostly sql.

That is an impressive list of modules.

cheers

Gus
