EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
989 stars 185 forks source link

String Variables - Split freezes on empty strings. #3162

Closed jetrotal closed 10 months ago

jetrotal commented 10 months ago

Ok, EasyRPG is freezing whenever I use t[1] .split "", t[2], v[1241] to split a string per character. If I change "" with "a" it works.

Empty strings in this case stuff should mean every character. So, looks like the stringVar split operator doesn't like empty entries.

I guess this one could fit within @Ghabry's small fixes PR: Player #3151

The TPC code I used to test this feature is from a "Typewriter" event, written by Jorge Maker:

t[1] .asg "Lorem ipsum dolor sit amet, consectetur adipiscing 
elit, sed do eiusmod tempor incididunt ut labore et dolore 
magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo."
t[1] .split "", t[2], v[1241]
@loop v[1241] .dst v[1705] {
    v[1705] += 1
    t[10000] .asg  .join "", t[2], v[1705]
    @pic[1].strpic {
        "\t[10000]"
        .pos 240, 80 .center
        .size 316, 80        .chromakey 1
        .scale 100
        .trans 0
        .rgbs 100, 100, 100, 100
        .font "", 12
        .spacing 0, 4
        .skin "" .tiled
        .mapLayer 7
        .eraseWhenTransfer
        .affectedByFlash
        .affectedByShake
    }
    @loop 1 {
        @wait 0

    }

}
Ghabry commented 10 months ago

Hm guess I should special case this to walk over the Unicode characters instead of bytes. Otherwise this is useless for everything that is not ASCII.

Make me wonder if this even works in maniac patch for Japanese 🤔

jetrotal commented 10 months ago

I can't test it here, without access to japanese rpg_rt. This is how it looks on Maniacs:

Ghabry commented 10 months ago

Problem with english tests is that these are ASCII. ASCII is a super boring 1 byte per character encoding. So everything (like a naive "split at every byte") will just work. So is unsuitable for testing edge cases.

The fun starts when you add umlauts (äöü) as they are 2 bytes per character in Unicode. Japanese is 3 bytes per character. Though Maniacs likely uses Shift-JIS internally and does special handling for them.

When I have time will try to get a Japanese example working...


Umlauts will likely work in Maniacs because internally it uses Latin-1, making them 1 byte per character too. (???)

jetrotal commented 10 months ago

testCase - split.zip

Ghabry commented 10 months ago

Appears to work in Maniacs. So has likely special handling for Shift-JIS:

grafik