Engine icon indicating copy to clipboard operation
Engine copied to clipboard

Bug: Add escape sequence support to postcompiler

Open Klunkyone opened this issue 1 year ago • 8 comments

Describe the bug

When I put text into quotes in the parameter of an output, the text inside the quotes is deleted when run in-game. image image

To Reproduce

.

Issue Map

.

Expected Behavior

When I put text into quotes in the parameter of an output in hammer, the text should be run in-game as I wrote it.

Operating System

No response

Klunkyone avatar Jul 18 '24 05:07 Klunkyone

This works for me? Are you using the unstable branch? image test_io.zip

ozxybox avatar Jul 18 '24 05:07 ozxybox

the escape sequences are properly encoded into the BSP file as well :P image

ozxybox avatar Jul 18 '24 05:07 ozxybox

Turns out this is a bug with postcompiler. Not sure if it's just an issue with the ancient one we ship, or if it's been fixed at this point. Postcompiler is stripping out any escape sequences when saving the entity lump. So \\ turns to \ and \" to " image

I'll update the issue title accordingly

ozxybox avatar Jul 18 '24 06:07 ozxybox

This is more a srctools thing, I'll just make it export escaped values since that should never happen otherwise. Or could I condition it on an entity lump version, I think I saw you bumped that?

TeamSpen210 avatar Jul 18 '24 06:07 TeamSpen210

It is a srctools thing, but i marked it as a postcompiler thing, as that's what most end users know it as :P

You could condition it on the entity lump version. Strata now considers v0 as no escape sequences, and v1 as having escape sequence support. Note: I also dropped comment and unquoted string support from v1, but i have never seen anyone actually use those in a BSP before luckily...

Also, thanks for spotting this issue! It's super awesome!

ozxybox avatar Jul 18 '24 06:07 ozxybox

Actually I'll do it unconditionally, since it shouldn't appear unless VBSP supports it in the first place. Or added by a custom postcompiler transform, but that's a problem for the author of those.

I do watch the Strata repos in case something comes up that's my fault, or I know something that might be useful.

TeamSpen210 avatar Jul 18 '24 07:07 TeamSpen210

Sounds reasonable. Straight from VBSP, a non-Strata vanilla map should pretty much never have a backslash. The v0 format does allow them, but idk if it would ever come up.

Supporting both syntaxes does suck! Especially when it needs to be handled differently in different places.

ozxybox avatar Jul 18 '24 07:07 ozxybox

I just saw the commit to fix this! That was super quick, thank you!

I'll leave this issue open until I finally finish updating our post compiler. I started on it last week, but I'm out of town atm. Should hopefully be done soon.

ozxybox avatar Jul 18 '24 09:07 ozxybox

Forgot to close this, but we did update our postcompiler a while back

ozxybox avatar Mar 05 '25 09:03 ozxybox