• Advertisement

Make a small donation to Ye Olde Inn!

Donate via Paypal

Every cent received goes toward Ye Olde Inn's maintenance and allows us to continue providing the best resources for HeroQuest and Fantasy Gaming fans.

Need help editing a board for HeroScribe

Have a HeroQuest related project and need community assistance? Create a thread about your project here and the type of aid you require. Other community members searching this room may be able to assist, or join you on your adventure.

Re: Need help editing a board for HeroScribe

Postby banjo_oz » February 4th, 2022, 9:05 am

Thanks! I was working on this when you replied and had got everything displaying except the gridlines not being overlaid. You're right; I just had them before the room filling, so I swapped them over and everything looks right in the exported eps now! Awesome!

Code is below, for reference (in case I left a big mistake in!):
Code: Select all
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 538 404
%%HiResBoundingBox: 0 0 537.6 403.2
%%LanguageLevel: 2

% Made with/for HeroScribe
% The board layout is (C) Milton Bradley Company
% This eps file is (C) 2003-2021 Flavio and Valerio Chierichetti and Banjo

%/adjacentBoardsOffset offset def
/x 26 def
/y 19 def
/Unit { 19.2 mul } def
/Border 0.15 def

/RoomStroke 2.3 def
/GridStroke 0.1 def

/BorderRGB { 0.40392 0.05098 0.18039 } def
/DarkRGB { 0.75294 0.61961 0.61569 } def
/CorridorRGB { 0.89020 0.86667 0.82353 } def
/RoomRGB { 0.91765 0.90196 0.89412 } def
/TrapRGB { 0.976 0.486 0.200 } def
/UntraceableTrapRGB { 0.757 0.910 0.827 } def

/BoundingBox {
    % Width, Height

    exch
    dup
    1 sub adjacentBoardsOffset mul
    exch
    x 2 add mul
    add Unit

    exch
    dup
    1 sub adjacentBoardsOffset mul
    exch
    y 2 add mul
    add Unit

    2 array astore

    << /PageSize 2 index
    >> setpagedevice

    pop

%    Ghostscript only
%    mark /MediaBox [ 0 0 x 2 add Unit y 2 add Unit ] /PAGE pdfmark
%    mark /CropBox  [ 0 0 x 2 add Unit y 2 add Unit ] /PAGE pdfmark
} def

/horizontalline {
    0 rlineto stroke
} def

/verticalline {
    0 exch rlineto stroke
} def

/HorizontalLineTo {
    % length > 0
   
    currentlinewidth exch currentpoint

    % lw length x y

    currentlinewidth 2 div sub exch

    % lw length (y - lw / 2) x

    currentlinewidth 2 div sub exch

    % lw length (x - lw / 2) (y - lw / 2)

    2 index currentlinewidth add
    currentlinewidth
   
    % lw length (x - lw / 2) (y - lw / 2) (length + lw) lw

    0 setlinewidth
    rectfill

    pop

    setlinewidth

    % [empty]
} def

/VerticalLineTo {
    % length > 0
   
    currentlinewidth exch currentpoint

    % lw length x y

    currentlinewidth 2 div sub exch

    % lw length (y - lw / 2) x

    currentlinewidth 2 div sub exch

    % lw length (x - lw / 2) (y - lw / 2)

    2 index currentlinewidth add
    currentlinewidth

    exch
   
    % lw length (x - lw / 2) (y - lw / 2) lw (length + lw)
   
    0 setlinewidth
    rectfill

    pop

    setlinewidth

    % [empty]
} def

/RectStroke {
    % xs ys width height

    3 index 3 index moveto
    1 index HorizontalLineTo

    3 index 3 index moveto
    0 index VerticalLineTo

    3 index
    3 index 2 index add
    moveto
    1 index HorizontalLineTo

    3 index 2 index add
    3 index
    moveto
    0 index VerticalLineTo

    % xs ys width height

    pop pop pop pop
   
} def

/Grid {
    gsave
    1 Unit 1 Unit translate

    RoomRGB setrgbcolor

    % Central Room
    10 Unit 7 Unit 6 Unit 5 Unit rectfill

    % Lower-Left Rooms
    1 Unit 1 Unit 8 Unit 8 Unit rectfill
    9 Unit 1 Unit 3 Unit 5 Unit rectfill
    5 Unit 1 Unit 4 Unit 5 Unit rectfill
    1 Unit 5 Unit 4 Unit 4 Unit rectfill
    5 Unit 6 Unit 2 Unit 3 Unit rectfill

    % Upper-Left Rooms
    1 Unit 10 Unit 8 Unit 8 Unit rectfill
    1 Unit 10 Unit 4 Unit 8 Unit rectfill
    1 Unit 15 Unit 8 Unit 3 Unit rectfill
    9 Unit 13 Unit 3 Unit 5 Unit rectfill

    % Lower-Right Rooms
    14 Unit 1 Unit 4 Unit 5 Unit rectfill
    18 Unit 1 Unit 7 Unit 4 Unit rectfill
    21 Unit 1 Unit 4 Unit 8 Unit rectfill
    18 Unit 5 Unit 7 Unit 4 Unit rectfill
    17 Unit 6 Unit 8 Unit 3 Unit rectfill

    % Upper-Right Rooms
    14 Unit 13 Unit 3 Unit 5 Unit rectfill
    17 Unit 10 Unit 8 Unit 8 Unit rectfill
    17 Unit 14 Unit 8 Unit 4 Unit rectfill
    17 Unit 10 Unit 4 Unit 8 Unit rectfill
   
    BorderRGB setrgbcolor
    0 setlinejoin

    GridStroke setlinewidth

    0 1 x 1 sub {
   gsave
   Unit 0 translate

   0 0 moveto
   y Unit verticalline

   2 1 10 {
       gsave
       12 div Unit 0 translate

       0 0 moveto
       -1 Border mul Unit verticalline

       0 y Unit moveto
       Border Unit verticalline

       grestore
   } for
   
   grestore   
    } for

    0 1 y 1 sub {
   gsave
   Unit 0 exch translate

   0 0 moveto
   x Unit horizontalline

   2 1 10 {
       gsave
       12 div Unit 0 exch translate

       0 0 moveto
       -1 Border mul Unit horizontalline

       x Unit 0 moveto
       Border Unit horizontalline

       grestore
   } for
   
   grestore   
    } for

    0 0
    x Unit
    y Unit
    % Use RectStroke (the function previously defined) instead of ``rectstroke''
    % for using PDFs of this file as converted by ghostscript with Illustrator
    rectstroke
   
    0 Border sub Unit
    0 Border sub Unit
    2 Border mul x add Unit
    2 Border mul y add Unit
    rectstroke

    RoomStroke setlinewidth

    % Central Room
    10 Unit 7 Unit 6 Unit 5 Unit rectstroke

    % Lower-Left Rooms
    1 Unit 1 Unit 8 Unit 8 Unit rectstroke
    9 Unit 1 Unit 3 Unit 5 Unit rectstroke
    5 Unit 1 Unit 4 Unit 5 Unit rectstroke
    1 Unit 5 Unit 4 Unit 4 Unit rectstroke
    5 Unit 6 Unit 2 Unit 3 Unit rectstroke

    % Upper-Left Rooms
    1 Unit 10 Unit 8 Unit 8 Unit rectstroke
    1 Unit 10 Unit 4 Unit 8 Unit rectstroke
    1 Unit 15 Unit 8 Unit 3 Unit rectstroke
    9 Unit 13 Unit 3 Unit 5 Unit rectstroke

    % Lower-Right Rooms
    14 Unit 1 Unit 4 Unit 5 Unit rectstroke
    18 Unit 1 Unit 7 Unit 4 Unit rectstroke
    21 Unit 1 Unit 4 Unit 8 Unit rectstroke

    17 Unit 6 Unit moveto 3 Unit verticalline
    17 Unit 9 Unit moveto 4 Unit horizontalline

    % Upper-Right Rooms
    14 Unit 13 Unit 3 Unit 5 Unit rectstroke
    17 Unit 10 Unit 8 Unit 8 Unit rectstroke
    17 Unit 14 Unit 8 Unit 4 Unit rectstroke
    17 Unit 10 Unit 4 Unit 8 Unit rectstroke

    grestore
} def

/Dark {
    DarkRGB setrgbcolor
    0 setlinewidth

    3 index Unit
    3 index Unit
    3 index Unit
    3 index Unit
   
    rectfill

    pop pop pop pop
} def

/Trap {
    TrapRGB setrgbcolor
    0 setlinewidth

    3 index Unit
    3 index Unit
    3 index Unit
    3 index Unit

    3 index
    3 index
    3 index
    3 index

    gsave
    rectclip
    rectfill
    Grid
    grestore

    pop pop pop pop
} def

/UntraceableTrap {
    UntraceableTrapRGB setrgbcolor
    0 setlinewidth

    3 index Unit
    3 index Unit
    3 index Unit
    3 index Unit

    3 index
    3 index
    3 index
    3 index

    gsave
    rectclip
    rectfill
    Grid
    grestore

    pop pop pop pop
} def

/Corridor {
    CorridorRGB setrgbcolor
    0 setlinewidth

    3 index Unit
    3 index Unit
    3 index Unit
    3 index Unit
   
    rectfill

    pop pop pop pop
} def

/StartBoard {
    % Column Row

    exch
    dup
    adjacentBoardsOffset mul
    exch
    x 2 add mul
    add Unit

    exch
    dup
    adjacentBoardsOffset mul
    exch
    y 2 add mul
    add Unit

    gsave
    translate
} def

/EndBoard {
    grestore
} def

/HorizontalBridge {
    % bottom

    dup

    CorridorRGB setrgbcolor
   
    Unit
    x 1 add Unit
    exch
    2 adjacentBoardsOffset add Unit
    1 Unit
    rectfill

    BorderRGB setrgbcolor
    GridStroke setlinewidth

    Unit
    x 1 add Unit
    exch
    2 adjacentBoardsOffset add Unit
    1 Unit
    rectstroke
} def

/VerticalBridge {
    % left

    dup

    CorridorRGB setrgbcolor
   
    Unit
    2 adjacentBoardsOffset add -1 mul 1 add Unit
    1 Unit
    2 adjacentBoardsOffset add Unit
    rectfill


    BorderRGB setrgbcolor
    GridStroke setlinewidth

    Unit
    2 adjacentBoardsOffset add -1 mul 1 add Unit
    1 Unit
    2 adjacentBoardsOffset add Unit
    rectstroke
} def

% width height BoundingBox

% Deactivating showpage and setpagedevice
% We have to reactivate them before the end

% 2 dict dup dup /showpage {} put /setpagedevice {} put begin
%
% column row StartBoard
%
% x1 y1 width height Corridor
% ...
% x1 y1 width height Dark
% ...
% Grid
%
% EndBoard


Only remaining issue is that painting "dark" doesn't show up at all; it seems like the corridor and room "fill colour" is obscuring it. Other icons (monsters, furniture, markings, tiles) all work and display fine.

My board code on Objects.xml is the same as for the default board:
Code: Select all
<board name="HeroQuest (Banjo)" width="26" height="19" borderDoorsOffset="0.08" adjacentBoardsOffset="-0.5">
<icon region="Europe" path="Europe/Board_EU" />
<icon region="USA" path="USA/Board_BA" />
<!-- Border corridors -->
<corridor left="1" top="1" width="26" height="1" />
<corridor left="1" top="19" width="26" height="1" />
<corridor left="1" top="1" width="1" height="19" />
<corridor left="26" top="1" width="1" height="19" />
<!-- 2x7 corridors -->
<corridor left="13" top="1" width="2" height="7" />
<corridor left="13" top="13" width="2" height="7" />
<!-- 10x1 corridors -->
<corridor left="1" top="10" width="10" height="1" />
<corridor left="17" top="10" width="10" height="1" />
<!-- 1x7 corridors -->
<corridor left="10" top="7" width="1" height="7" />
<corridor left="17" top="7" width="1" height="7" />
<!-- 8x1 corridors -->
<corridor left="10" top="7" width="8" height="1" />
<corridor left="10" top="13" width="8" height="1" />
</board>


I don't know, but I'm feeling it's something to do with the png. As I said, I am converting with InkScape. My steps, if it helps:
1) Export blank map to eps in HeroScribe.
2) Open exported eps in InkScape.
3) Export as png, leaving all settings as default.
What is making me think this is that the default board does *not* show the corridor fill in the png version, but displays it anyway in the editor. So is that what the corridor code in Objects.xml does... meaning maybe I *do* I need a new definition for rooms to use the same trick, since I don't think any other board in the AIO pack actually has filled-in rooms?
User avatar
banjo_oz

Fimir
Fimir
 
Posts: 56
Joined: December 3rd, 2011, 10:02 pm
Location: Australia
Forum Language: British English
Hero:
Evil Sorcerer: Morcar

Advertisement

Make a small donation to Ye Olde Inn!

Donate via Paypal

Every cent received goes toward Ye Olde Inn's maintenance and allows us to continue providing the best resources for HeroQuest and Fantasy Gaming fans.

Re: Need help editing a board for HeroScribe

Postby StratosVX » February 4th, 2022, 3:28 pm

So the issue seems to be filling the room with color. If I delete the code that does this and use that edited .eps, HeroScribe allows me to darken a room without any issue (assume all of my exports are .eps as the .png functionality seems to be buggy/broken). I don't see the immediately see the issue and my rusty memory doesn't see a problem with this, but I will mess with it more when I get home to see if I can figure out what the problem might be.

EDIT: So I have an update. You are correct, the room colors are covering up the dark colors. From the looks of the export file for HeroScribe, the corridor colors get written to the final .eps file, then the dark colors, then the grid. Since your code for the room colors is in the grid, they are covering them up. You could try to edit the .eps file to add a new function that draws the room colors separate from the grid then call that from Java, but I don't know how program savvy you are. I may be able to figure something like that out, but I definitely don't have a lot of time to devote to that right now. But that appears to be the issue you are encountering.


Rewards:
Zealot Miniatures: Twisting Catacombs Kickstarter Backer
User avatar
Scribe of Heroes
StratosVX
I hate snakes, Jacques...

Scout
Scout
 
Posts: 1109
Joined: November 6th, 2012, 12:44 am
Location: Utah, USA
Forum Language: English (United States)
Hero:
Evil Sorcerer: Zargon
Usergroups:
Wizards of Zargon Group Member Champion Group Member

Previous

Return to Project Forge

Who is online

Users browsing this forum: No registered users and 1 guest

cron