Jump to content

REG_REPLACE usage.


TheUnderground

Recommended Posts

Another export format question -- I'm trying to replace line breaks ("\n") in the data from the "Background" tab in Hero Designer.

 

The documentation doesn't say exactly where you'd use REG_REPLACE. Do I put it at the head of the HDE file, or...? Do I expand the comment tags and put it inside them, like this:

 

<!--PERSONALITY--><!--REG_REPLACE-->..<!--/REG_REPLACE--><!--/PERSONALITY-->

 

Thank you!

 

 

 

Link to comment
Share on other sites

It doesn't much matter where it's placed so long as it's not inside of a conditional block that gets removed - REG_REPLACE, IFREGMATCH, and REPLACE are all handled at the top level, after all other tags (so after export of Powers, Skills, etc.).

Link to comment
Share on other sites

8 hours ago, Simon said:

It doesn't much matter where it's placed so long as it's not inside of a conditional block that gets removed - REG_REPLACE, IFREGMATCH, and REPLACE are all handled at the top level, after all other tags (so after export of Powers, Skills, etc.).

 

So, I tried a few things with the following line:

 

<!--REG_REPLACE--><!--REGSTRING-->\n<!--/REGSTRING--><!--REPSTRING--><br/><!--/REPSTRING--><!--/REG_REPLACE-->

 

But they applied it to the entire HTML of the output format, not just to generated content. Any line breaks in the export format template were converted to <br/>, not just the line breaks in Hero Designer content.

Oddly, when I tried this:

 

<!--BACKGROUND--><!--REG_REPLACE--><!--REGSTRING-->\n<!--/REGSTRING--><!--REPSTRING--><br class="linebreak" /><!--/REPSTRING--><!--/REG_REPLACE--><!--/BACKGROUND-->

 

it applied it to everything except the background.

 

As an experiment, I tried this:

 

<!--REPLACE--><!--DEFSTRING-->span</!--DEFSTRING--><!--REPSTRING-->div<!--/REPSTRING--><!--/REPLACE-->

 

The non-regex replace function had no impact on the template stuff. My spans didn't turn into divs. Same code, but with the regex stuff? Turned my spans into divs.

 

Any suggestions? I'm just trying to get line breaks in the content like the things in the Background tab, notes on Powers and such, etc. I'm using the 20221216 build of Hero Designer.

Link to comment
Share on other sites

REG_REPLACE and REPLACE will both act on the entire document (by design). REPLACE is case-sensitive.

If you're looking to do a replacement on a specific section of the document only, you'll need to put some start/stop identifier in the document and include that in your regular expression and swap value.

If you're just looking to define line breaks, that's why all of those fields are containers:

<!--BACKGROUND-->linebreaksequencehere<!--/BACKGROUND-->

 

Link to comment
Share on other sites

2 hours ago, Simon said:

REG_REPLACE and REPLACE will both act on the entire document (by design). REPLACE is case-sensitive.

If you're looking to do a replacement on a specific section of the document only, you'll need to put some start/stop identifier in the document and include that in your regular expression and swap value.

If you're just looking to define line breaks, that's why all of those fields are containers:

<!--BACKGROUND-->linebreaksequencehere<!--/BACKGROUND-->

 

 

 I may have found a bug, then.

When I did REPLACE on span and div, I double-checked that I had the syntax correctly by replacing the span and div with the character's name and a random word. The span/div replacement did nothing; the character name replacement worked. The case was correct. If it were working on the whole document, it should've turned the spans into divs.

 

When I tried putting the line break sequence inside the BACKGROUND container, it acted on everything but the BACKGROUND. So I'm not sure if I'm doing something wrong or it's a bug, but you can see the exact statement I used in my last post.

Anyhow, it's not a huge deal. I can post-process the sheets manually. I really appreciate your help!

Link to comment
Share on other sites

Just to be sure I'm being 100% clear:

Hero Designer has two inputs in the exporting process, right? The data from the character sheet inside Hero Designer (i.e. Powers, Characteristics, Background, etc.) , and the data from the export format (i.e. html tags, other strings in the HDE file, etc.).

It appears that REPLACE only works on the data from the character sheet, while REG_REPLACE applies to both inputs. If that's not the intended behaviour, then I think I found a bug.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...