HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Bug in Blizzard's compiler (percent bug)

08-19-2004, 02:13 PM#1
PitzerMike
Everything started when I wanted to interpret simple functions such as StringLength and SubString in my JASS parser. I knew there were some issues with the % character but it took me quite some time to find where the problem is, but I finally did.
It's all a bug in Blizzard's compiler that simply deletes % characters from strings. This bug only appears in strings in the custom text header of maps. In custom text triggers strings are parsed correctly. This is weird because one would think that they are using the same parser for custom text triggers and the custom text header.

Anyway here's some proof, JASS code before compilation:



JASS code after compilation (with intentionally placed error to see the compiled code):



As you see the % character got deleted from all strings, which is really annoying.

How to fix it?

You could of course add a new entry to the wts file. Something like this would work:

STRING XXX
{
%
}

The use a function like this one to get the string:

function ReturnPercent takes nothing returns string
call SetPlayerName(Player(12),"TRIGSTR_XXX")
return GetPlayerName(Player(12))
endfunction

Replace XXX by a number that is not yet used in your map.

PS: Of course the better solution would be if a respected member of the bnet forums asked blizzard to fix this annoying bug in the next patch.
08-19-2004, 09:42 PM#2
weaaddar
If I remember if placed in the header of a map you need to place two % or else they get swallowed by the compiler.
08-19-2004, 10:39 PM#3
Cubasis
Yes, I heard that just like double-slashes (wierd, it censors ** ** (if I remove the space)), you do %% to compile a single %.

And i'd kinda prefer if this bug weren't fixed, as there is a related mess with the % character that allows you to make the WE crash when compiling (saving), with it in the header. Which makes for a excellent OO-protection ;).

~Cubasis