Page 1 of 1

Hungry hungry regex matches :) (Typewriter.Play ArgumentOutOfRangeException)

Posted: Wed Nov 01, 2023 4:19 pm
by aguynamededward
Hey Tony -

Was debugging an issue with our game, and noticed we were getting an "ArgumentOutOfRangeException" - basically, we had a string that was coming in 30-40 chars less than it should, when it came time for the typewriter to play.

Basically, a string that started the method like this:

Code: Select all

If you don\'t have enough <sprite=\"StatIcons\" name=enervation> energy (<color=#EE8695>displayed in the bottom left of the screen</color>), then you won\'t be able to play the card.
was finishing like this:

Code: Select all

If you don\'t have enough ), then you won\'t be able to play the card.
Basically, it was starting at the <sprite> tag and removing everything until the close of the <color> tag.

Traced it further, and found the Tools.StripTextMeshProTags was chopping off the extra text, and I traced it down to the sprite regex filter:

By changing this:

Code: Select all

<sprite=.+>
to the less hungry/more lazy:

Code: Select all

<sprite=.+?>
it seemed to remove the error with no problems otherwise.

Don't know if that'll throw other problems later, but I figure you get enough messages with "I have a problem!" that the occasional "I have a solution!" is not out of line. :)

Thanks for all the work you do, you're awesome!
Edward

Re: Hungry hungry regex matches :) (Typewriter.Play ArgumentOutOfRangeException)

Posted: Wed Nov 01, 2023 4:33 pm
by Tony Li
Good catch! I'll make that fix.