ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
207 stars 24 forks source link

Bug: An variable set to an empty string passed into CreateHudText outputs as null #380

Closed NS-Unfair closed 2 years ago

NS-Unfair commented 2 years ago

Basically, if code containing CreateHudText, with a parameter set to a variable equal to a empty string:

`

// Like this CreateHudText(AllPlayers(), Blah, Blah, Blah, Location.Left, 0, Color.Red, Color.Red, Color.Red,
HudTextRev.VisibleToSortOrderStringAndColor, Spectators.VisibleAlways);

`

It outputs as null in some cases, I'm not sure why. I couldn't reproduce the bug, so I can't show what it did output.

Here's the code that outputted as null, but now it doesn't do that anymore for some strange reason: ` globalvar define Debug! = true; globalvar define EmptyString = "";

rule: "Debug - Create Memory Text" { if (Debug) { CreateHostHud("Class Memory Left: %{0}".Format([100-ClassMemory()]), EmptyString, EmptyString, Location.Left, 0, Color.Yellow, Color.Black, Color.Black, HudTextRev.VisibleToAndString); CreateHostHud("Posistion: {0}".Format([PositionOf(HostPlayer())]), EmptyString, EmptyString, Location.Left, 1, Color.Yellow, Color.Black, Color.Black, HudTextRev.VisibleToAndString); } }

void CreateHostHud(Any Header! = '', Any Subheader! = '', Any Text! = '', Location location! = Location.Left, Number SortOrder! = -1, Color HeaderColor! = Color.White, Color SubheaderColor! = Color.White, Color TextColor! = Color.White, HudTextRev Reevaluation! = HudTextRev.VisibleToAndString, Spectators spectators! = Spectators.DefaultVisibility) { CreateHudText(HostPlayer(), Header, Subheader, Text, location, SortOrder, HeaderColor, SubheaderColor, TextColor, Reevaluation, spectators); } `

NS-Unfair commented 2 years ago

It seems like this bug was fixed in OSTW 2.1, that might be the reason why I can't reproduce it. I will reopen this issue if I ever come across it again in version 2.1.