[Support] How do I implement Overflow Fix in my code? ! Help
-
I was reading that when text strings are handled, the Overflow of strings must be taken into account, and although I was reading this post in particular and it is the one that I understand the most:
https://www.nextgenupdate.com/forums/black-ops-2-gsc-mods-scripts/915525-overflow-fix-cooljay-black-ops-iiutility.htmlI can't find where I should implement
DestroyElement();
function inside my code, since obviously I didn't know about this problem and that's why I don't use theDestroy();
functionhealthPlayer () { self endon ("disconnect"); self.healthText = createFontString ("Objective", 1.7); self.healthText setPoint ("CENTER", "TOP", 300, "CENTER"); while (true) { self.healthText setText ("^ 2HEALTH: ^ 7" + self.health); wait 0.25; } }
-
Kalitos A bit off topic, but you should know that you can utilize a HUD element's
label
attribute in order to prevent unnecessary unique string usage. Here's an example of your code converted:healthPlayer () { self endon ("disconnect"); self.healthText = createFontString ("Objective", 1.7); self.healthText setPoint ("CENTER", "TOP", 300, "CENTER"); self.healthText.label = &"^2 HEALTH: ^7"; while (true) { self.healthText setValue(self.health); wait 0.25; } }
As you can see, I assigned some text to your HUDs
label
attribute and replacedsetText()
withsetValue()
. This can be done because you only ever need to update the health value and not the text before it. Using this method, you're only using one unique string rather than a new one every time the player's health changes.