jbhaywood / 5e-statblock-importer

A module for FoundryVTT that creates a new actor from any 5e monster or NPC statblock.
MIT License
18 stars 14 forks source link

Parsing statblock is broken #121

Closed Airwrecker closed 1 week ago

Airwrecker commented 1 week ago

Since updating 5E Statblock Importer the imported statblock doesn't properly convert to Foundry's statblock layout.

For example, I pasted the Goblin statblock and it appears like this in the Importer: 5estatblockimporter02 5estatblockimporter01

jbhaywood commented 1 week ago

The text needs to have separate lines, not one long line. It won't be able to parse that.

Airwrecker commented 1 week ago

Yes, I know. The problem is that the Importer makes it all one line, as per second screenshot.

The screenshot below is after I pasted the copied goblin statblock from the Basic Rules. Immediately afterwards it changes to the second screenshot above where the statblock is one long text with no separate lines. image

A workaround I discovered is: 1) Paste the statblock text into the Importer (but it then scrunches the statblock into one line with no separate lines) 2) CTRL+A to select all of the one line statblock and, without deleting it but just pasting the statblock over it 3) the statblock now has separate lines and can be properly imported.

or 1) Paste the statblock into Notepad so it's ASCII format then copy it from there 2) Paste the statblock into the Importer

Aioros commented 1 week ago

A little technical explanation because I feel it's owed: one of my main changes involved replacing the textarea with an actual editable div that only accepted plain text, so that I could then highlight the results of the parsing. I later realized that is not supported on Firefox, so now the box accepts generic html and I make sure to manage the new lines correctly. Apparently I didn't do that right the first time.

I made some new changes that should work better. Can you try updating to 1.90.5 and give it a spin?

Airwrecker commented 1 week ago

Nope, the same issue still occurs with 1.90.5.

The Importer still scrunches up the statblock into one line when I either have Auto Parse checked or manually parse (see screenshot #2) it. If I don't parse it (see screenshot #3) and just Import it the statblock isn't imported at all (see screenshot #1).

I'm using Chrome and I'm just highlighting the entire statblock text and then copying it to the clipboard. image

I think the issue is that the Importer box isn't converting the pasted text from the D&D Beyond statblock to ASCII, which it did before. That's why it's only working for me if I do the workaround by copying the DDB statblock to Notepad (which is ASCII only) before copying it to the Importer box.

Aioros commented 1 week ago

Welp, next try. I have 1.90.6 out now, and I'm optimistic I got it this time. Mind trying it? Sorry for the inconvenience, I really appreciate your help.

Airwrecker commented 1 week ago

@Aioros It's working now! Thank you for the fix!