Module: SWED 3.2 Vassal: 3.2.16
I was editing the buildFile for Star Wars Epic Duels so I could add a prototype to every card by using “search and replace.” I copied the exact line from a card with a prototype that I previously added inside Vassal itself. Here is the contents of my initial card:
<VASSAL.build.widget.CardSlot entryName="Anger" gpid="25" height="0" width="0">+/null/prototype;Cards report;70\,130;$playerName$ ($playerSide$) flips $newPieceName$ *;;;Flip Card\ obs;70,130;AS-Cardback.jpg;Flip Card;Gnull;Anakin Skywalker Card;player:;Peek\\ piece;;;AS-Anger.jpg;Anger/ -1\ null;\\ null;0;0;25</VASSAL.build.widget.CardSlot>
I used the exact same prototype line in another card in Luke Skywalker’s deck:
<VASSAL.build.widget.CardSlot entryName="Children Of The Force" gpid="86" height="0" width="0">+/null/prototype;Cards report;70\,130;$playerName$ ($playerSide$) flips $newPieceName$ *;;;Flip Card obs;70,130;LS-Cardback.jpg;Flip Card;Gnull;Luke Skywalker Card;player:;Peek\ piece;;;LS-ChildrenOfTheForce.jpg;Children Of The Force/-1 null;\ null;0;0;86</VASSAL.build.widget.CardSlot>
I didn’t touch anything else at all except for adding the new prototype line. I save the buildFile, place it back into the archive and replace the old file with my new file. I change my extension back to .vmod and then open the module up in the editor. Here’s a picture of what happens.
What it SHOULD look like is this:
[attachment=1]BuildFile issues 1.png[/attachment]
Instead, what I get is this:
[attachment=0]BuildFile issues 2.png[/attachment]
For some reason, Vassal doesn’t interpret the white space as a break after the “prototype;Cards” line, and instead decides to just add the next line that reports a card flip into the text box for the prototype. I don’t understand why it would do this when as far as I can tell, it is the exact same information in the exact same syntax. The only difference as far as I can tell is that I used the editor for one, and the buildFile for the other. Why would it recognize the code for the first card but not the second?
Thanks for any help or advice on this issue. I hope it’s just something really simple that I somehow overlooked.
Are you certain the whitespace is identical? I’m not certain if VASSAL uses hard tabs as separators; if so, perhaps you accidentally changed them to soft tabs (e.g., spaces), instead?,
Edit: Looking closer, I see a backslash after “Flip Card” on the first entry, but not on the second.
This was my suspicion as well. Viewed in Atom, they look like hard tabs to me.
That’s the thing. The coding style seems so random throughout the file. Some lines will have a tab, and in the same spot on a different card, it will be 1 space. Some have 2 spaces or even 3. Some things have backslashes and some don’t. I can’t find much consistency. It would make sense to use the same basic syntax on blocks of code that are practically identical except for a few name and image swaps. For instance, this is the code for the very first card in Anakin Skywalker’s deck:
<VASSAL.build.widget.CardSlot entryName="Anger" gpid="24" height="0" width="0">+/1588820708900/prototype;Cards report;70\,130;$playerName$ ($playerSide$) flips $newPieceName$ *;;;Flip Card\ obs;70,130;AS-Cardback.jpg;Flip Card;Gnull;Anakin Skywalker Card;player:;Peek\\ piece;;;AS-Anger.jpg;Anger/ -1\ 1qa0ok2ws9ij;false|0\\ null;0;0;24</VASSAL.build.widget.CardSlot>
Right before the prototype trait, there is this number between slashes: /1588820708900/
For literally every other card in the rest of his deck, as well as every other deck in the game, it instead says: /null/
Can anyone make sense of this for me? I’ve tried using various spaces, backslashes and tabs and every time they all give me the same failed result.
Don’t try and make sense of it. It is not a format that was designed to be interpreted or edited manually. If the Vassal editor put it there, it needs to be there. While it is possible to do so, unless you fully understand EXACTLY what you are doing, there are only a few things you can change with stuffing things up. You can match the strings you see in the definition with the strings you see in the Vassal editor to get a sense of what they mean.
- Firstly, ensure the editor you are using is not breaking or wrapping long lines.
- You can Copy a whole line or set of lines and paste them somewhere else that makes sense to duplicate components. This assumes you know what makes sense. This is the safest edit.
- You can do a global search replace of a string that you know the meaning of with something else. For example, you could change all ‘Flip Card’ command to ‘Flip A Card’ commands. This is a reasonably safe edit.
- You can manually change individual items on a line where you know what they mean. e.g. you could change ‘entryName=“Anger”’ to entryName=“Anger2” and ‘AS-Anger.jpg’ to ‘AS-Anger2.jpg’. Starting to walk on thin ice now, but will usually work. However, I usually go back into Vassal to finish these sort of edits. much safer.
Yes, the string is full of Tab (Ctrl-I) characters which are used to delimit fields and they look like spaces or are changed to spaces in many editors. If you do not preserve the exact number and sequence of these, your edits will break the module.
Make minimal changes at a time. Save often. I am one of the Vassal developers and I hesitate to edit the buildfile unless I really need to.
Man, if one of the developers fears going into this file then I know it really is dangerous territory hahaha. What would you recommend as the best program to edit this in? I’m just using standard Notepad. Are you aware of Notepad causing problems with the Tabs or anything like that? I’m wondering if just loading it in Notepad seemed to cause a lot of this mess.
Also, I managed to get my prototype to work, but it also meant I had to modify other parts of Luke’s code block to match Anakin’s. Like the fact that Anakin’s card has a backslash after Flip, but Luke’s does not as pointed out by jrwatts. For some reason this works as is, but after adding the prototype line I had to add that backslash or it would delete the card image in game. Really weird interactions going on.
I appreciate the reply and all the advice. Thanks! I’m sure I’ll be back here in the not too distant future.
Notepad is one of the most featureless editors in existence–it’s almost impossible to pick a free open source editor that’s worse. I’ve tried a bunch over time, Notepad++ and a couple others, but eventually settled on Atom.
Thus spake JoelCFC25 via messages:
Notepad is one of the most featureless editors in existence–it’s almost
impossible to pick a free open source editor that’s worse. I’ve tried a
bunch over time, Notepad++ and a couple others, but eventually settled
Notepad might also screw up your line endings. I would not use Notepad.
I use SciTE on a windows system,
I use XMLSPY which is beyond fantastic but very expensive - I just happen to have it for professional reasons.