New program to help set up VASL scenarios

uckelman

Senior Member
Joined
Sep 12, 2011
Messages
714
Reaction score
439
Location
Durham
Country
llUnited Kingdom
I suspect you're seeing this Java bug. The stack trace is the same from javax.swing.plaf.basic.BasicHTML.updateRenderer() onward. The bug report claims that it's fixed in Java 14. VASSAL 3.3 uses Java 14 by default on Windows and Macs, and can use Java 14 on Linux, so you shouldn't see this problem anymore once VASL is able to run on VASSAL 3.3.

The trigger for the bug appears to be an <img> element with an empty src attribute.
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
The trigger for the bug appears to be an <img> element with an empty src attribute.
Thanks for that. However, the <img> tags are all well-formed and have a src attribute, so it looks like it's something else.

I get the crash on Fedora 30, using 1.8.0_232-b09, but using 8u201-x64 on Windows 10, it's OK. Gotta love this job sometimes... :-/
 

uckelman

Senior Member
Joined
Sep 12, 2011
Messages
714
Reaction score
439
Location
Durham
Country
llUnited Kingdom
My guess is that you're triggering the same bug in a different way, in that case.
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
My guess is that you're triggering the same bug in a different way, in that case.
Yes, possibly. This could also explain the problem von Marwitz reports about VASSAL not being able to load scenarios that reference images that are no longer available. It's quite plausible that there's a bug in the code such that, if it's unable to get the image data (either because there's no src attribute or the URL is 404'ing), it ends up with a null reference somewhere and tries to use it.

But in my case, the HTML is generated programatically, so the HTML structure is the same, only the values have been changed. There is a valid src attribute, that is available, so it's a bit harder to explain how the code might not be able to get the image data. Race condition getting it from the cache? Something about the image itself, perhaps? There was another problem where the renderer was unhappy if the height and width wasn't set, so the code is a bit finicky. But we knew that already :) The code is ancient, it's not worth worrying about; let's just see how things go with the new version of VASSAL.
 

uckelman

Senior Member
Joined
Sep 12, 2011
Messages
714
Reaction score
439
Location
Durham
Country
llUnited Kingdom
There was another problem where the renderer was unhappy if the height and width wasn't set, so the code is a bit finicky.
That's for SVG only, because we have to have a size in pixels.

If you can reproduce the problem reliably, you could get a test build of VASL and try that with VASSAL 3.3:
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
We may not be talking about the same thing. I don't recognize anything on that thread. What's it from?
It's the same thread we're on now :)

There was a problem a while back where images were being rendered as a tiny black dot, and Will Fleming tracked it down to the <img> tag only having a width or height attribute, but not both. If it had both, it rendered properly.

Of course, I just tested it now and things work properly with only one attribute, so who knows what's going on :-/ However, I did have to try a few different image URL's before I got one that worked. The ones that failed were all https://, but it's hardly surprising if Java 8 can't handle newer TLS protocols, which could be a reason why it's not able to get the image data, and thus triggering the bug you linked to before.
 

uckelman

Senior Member
Joined
Sep 12, 2011
Messages
714
Reaction score
439
Location
Durham
Country
llUnited Kingdom
But what is it? I still don't recognize the thing in the screen shots, this thread or not.
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
But what is it? I still don't recognize the thing in the screen shots, this thread or not.
???
This entire thread is dedicated to a program I've written called vasl-templates. It generates HTML that can be inserted into a VASL label, containing useful information that can be referred to during the course of a game. One of the features of vasl-templates is that it can launch VASSAL and automatically insert the labels into a scenario, instead of the user having to manually create each label and copy the HTML in. VASSAL sometimes crashes during this process, so one of the changes in the latest beta is a workaround for that.
 

uckelman

Senior Member
Joined
Sep 12, 2011
Messages
714
Reaction score
439
Location
Durham
Country
llUnited Kingdom
Ah. I hadn't read up the thread, or at least if I had, I no longer remembered doing that.

I'll be interested to hear if you still have the problem with Java 14.
 

Jplott94

Member
Joined
Jun 13, 2019
Messages
179
Reaction score
284
Location
Asheville, NC
First name
Jon
Country
llUnited States
Just got VASL Templates up and running, alongside VASSAL 3.2.17 and VASL 6.5. Really liking what I'm able to put together on the screen now! Haven't quite got the Chapter H stuff going, but will do that next. BIG thanks to Pacman Ghost for all the heavy lifting!
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
The next beta is available now. Please PM me if you'd like to take it for a spin.

The main new feature is support for National Capabilities. There are buttons for each player, which will create snippets listing their national capabilities.
14106

I realize some people won't want these, so labels for these aren't created automatically, but if you like them, you can turn them on in the User Settings dialog.

There is also a new "OBA" icon that you hover the mouse over, and it will tell you how many black/red chits each side gets, if they have OBA:
14104

Other changes and bug fixes:
  • Added templates for Finnish, Hungarian and Romanian PF's.
  • Changed the default ELR and SAN.
  • Allow {{USER-FILES}} and {{CHAPTER-H}} to used in snippets (i.e. hyphens can be used as well as underscores).
  • Use all the space at the bottom of the playing area when creating labels.
  • Changed how we check if the program is already running.
  • Allow user files to be accessed from a Docker container.
  • Allow snippet images to be generated from inside a Docker container.
  • Check both label fields when identifying player-owned labels in a VASL save file.
  • Changed how truncated webdriver screenshots are detected.
  • Minor UI changes.
 
Last edited:

LHMG

Member
Joined
Apr 21, 2011
Messages
131
Reaction score
20
Location
USA
Any advice for a newb how to get the pictures to work in a Notes snippet I am trying to create? No matter what I try the best I can get is the broken link icon to appear with the text. Thanks.
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
Any advice for a newb how to get the pictures to work in a Notes snippet I am trying to create?
Are you trying to embed your own pictures? If they're out on the internet, just include a <img> tag as per normal.

If they're on your computer, you need to configure the "User files" directory in the Server Settings (from the File menu), then reference the files relative to that directory in the <img> tag.

Post examples of what you're doing, if you still can't get it to work.

Also: you will almost certainly need to restart VASSAL (not VASL) each time. It caches images very aggressively, even broken ones :-/ The easiest way to resolve problems like this is to look at the generated HTML to see if it looks right, without pasting it into VASL.
 

LHMG

Member
Joined
Apr 21, 2011
Messages
131
Reaction score
20
Location
USA
<html> <!-- vasl-templates:id {{SNIPPET_ID}} -->

<head>
<meta charset="utf-8">
<style> {{CSS:common}} </style>
</head>

<table>

<tr>
<td style="
{%if SCENARIO_NOTE_WIDTH%} width: {{SCENARIO_NOTE_WIDTH}} ; {%endif%}
">
<img src="{{USER_FILES}}/Patton.png"> {{SCENARIO_NOTE}}

</table>

</html>

Thanks for responding. This is what I have tried so far with many different variations and I did configure the User Files to C:/ASL/Pictures before attempting to create note with a picture in it. I have tried placing the img string in a lot of different places but the best I get is the broken image icon necxt to any text.
 

Pacman Ghost

Senior Member
Joined
Feb 25, 2017
Messages
590
Reaction score
298
Location
A maze of twisty little passages, all alike
Country
llAustralia
This is not the generated HTML. It looks like you've edited a template file, which means that any changes you make will be applied to every Notes label you create.

You probably just want the picture in a single Notes label, so restart vasl-templates, and in the Notes panel, click on the "Add" button and enter the following:
Code:
Test image: <img src="{{USER_FILES}}/Patton.png">
You will see a new entry in the Notes panel - click on the icon on the right of it.

In you clipboard, you will see a bunch of HTML, and near the end, you should see this:
Code:
Test image: <img src="C:/ASL/Pictures/Patton.png">
Restart VASSAL, create a label and paste this in, and your picture should appear.
 

LHMG

Member
Joined
Apr 21, 2011
Messages
131
Reaction score
20
Location
USA
Great! Thanks a lot that's exactly what I wanted to do. Will that work if I want to add an image to the front of my text in other snippets in other tabs like the start of an SSR?
 

LHMG

Member
Joined
Apr 21, 2011
Messages
131
Reaction score
20
Location
USA
Okey Dokey. Thanks again for the help. Great program! Take care.
 
Top