Post: Overflow Fix
11-02-2014, 11:38 PM #1
TheFallen
Former Dark Night
(adsbygoogle = window.adsbygoogle || []).push({}); Overflow Fix
An easy to implement way of preventing any string overflows.

Introduction

Make sure to read the entire thread before attempting to use otherwise there may be issues with it not working properly.

Usage

First get the source from You must login or register to view this content.. You are going to need everything in here so do not try to edit it or remove things as it will most likely cause issues. To use this you must first call initOverflowFix() once in onPlayerSpawned(). You must only call this once for each player otherwise there will be problems.
    
onPlayerSpawned()
{
self endon("disconnect");
level endon( "game_ended" );

// YOU MUST HAVE THIS
isFirstSpawn = true;


for(;Winky Winky
{
self waittill("spawned_player");

// YOU MUST HAVE THIS
// only runs once when the player spawns for the first time
if(isFirstSpawn)
{
initOverFlowFix();

isFirstSpawn = false;
}
}
}


Creating Text

When creating text make sure to use my createText function or if you would rather use your own you must have these three lines at the bottom just before the return statement:
    
// textElem is the name of the object you defined with createFontString()
// view my createText function for an example
textElem.type = "text";
addTextTableEntry(textElem, getStringId(text));
textElem setSafeText(self, text);

You must do this for every text element you use otherwise it will result in an overflow.

Setting Text

When setting text make sure to call setSafeText(<player>, <text>Winky Winky instead of setText(<text>Winky Winky. If you do not do this it will result in an overflow. To use setSafeText() you must call it like so:
    
// textElement is the text element you wish to set text for. This is the object you would normally call setText() on.
// self is the player object you wish to set text for. If you don't know what this is just use self.
textElement setSafeText(self, "text");


Destroying Text

When destroying text you must call clear(<player>Winky Winky instead of destroy(). Clear takes one argument and that is the player that the text element belongs to. If you don't know what I mean by that just use self.
    
textElement clear(self);


Simple Example by Exelo
You can view an example of how to use this You must login or register to view this content..

Real Menu Examples
Last edited by TheFallen ; 11-03-2014 at 03:39 AM. Reason: added more examples

The following 33 users say thank you to TheFallen for this useful post:

AlexNGU, Bigmoneyhustlin, BossamBemass, canadiancaper, Chris, codybenti, Devilemi, FatalityMods, Full-Evil, HiddenHour, Im Not Boobdidas, Krypton, Dzre-, LegitGamer264, Magnate13Snake, ModernTriicks, Nothingbutbread, Obris, Patrick, RTE, SaberNGU, ScaRzModZ, Script Kiddie, Shark, Dacoco, SnaY, Taylor, SyGnUs, ViRuzModzHD, xePixTvx, xJessex, xKasper, Zambie
02-08-2015, 01:26 PM #20
dafuq replaced setText to setSafeText(self, text... and the clear(self) for texts not using notify messages and i still have overflow Gasp
(Menu is working...)
02-09-2015, 10:10 AM #21
thanks for the release great work keep it up! SmileSmile
02-14-2015, 11:57 PM #22
thanks i needed this
03-07-2015, 08:58 PM #23
ksa_7ooo7
Maggbot timeout!
my friend i need some one show me a video for fixing overflow ?
please can you help me
i am not native speaker
i can not understand everything
i have code i want t fix it
04-21-2015, 07:28 PM #24
xGsc-_-Funzo
Bounty hunter
Need help please
Last edited by xGsc-_-Funzo ; 04-21-2015 at 08:05 PM.
04-21-2015, 08:05 PM #25
xGsc-_-Funzo
Bounty hunter
Originally posted by TheFallen View Post
Overflow Fix
An easy to implement way of preventing any string overflows.

Introduction

Make sure to read the entire thread before attempting to use otherwise there may be issues with it not working properly.

Usage

First get the source from You must login or register to view this content.. You are going to need everything in here so do not try to edit it or remove things as it will most likely cause issues. To use this you must first call initOverflowFix() once in onPlayerSpawned(). You must only call this once for each player otherwise there will be problems.
    
onPlayerSpawned()
{
self endon("disconnect");
level endon( "game_ended" );

// YOU MUST HAVE THIS
isFirstSpawn = true;


for(;Winky Winky
{
self waittill("spawned_player");

// YOU MUST HAVE THIS
// only runs once when the player spawns for the first time
if(isFirstSpawn)
{
initOverFlowFix();

isFirstSpawn = false;
}
}
}


Creating Text

When creating text make sure to use my createText function or if you would rather use your own you must have these three lines at the bottom just before the return statement:
    
// textElem is the name of the object you defined with createFontString()
// view my createText function for an example
textElem.type = "text";
addTextTableEntry(textElem, getStringId(text));
textElem setSafeText(self, text);

You must do this for every text element you use otherwise it will result in an overflow.

Setting Text

When setting text make sure to call setSafeText(<player>, <text>Winky Winky instead of setText(<text>Winky Winky. If you do not do this it will result in an overflow. To use setSafeText() you must call it like so:
    
// textElement is the text element you wish to set text for. This is the object you would normally call setText() on.
// self is the player object you wish to set text for. If you don't know what this is just use self.
textElement setSafeText(self, "text");


Destroying Text

When destroying text you must call clear(<player>Winky Winky instead of destroy(). Clear takes one argument and that is the player that the text element belongs to. If you don't know what I mean by that just use self.
    
textElement clear(self);


Simple Example by Exelo
You can view an example of how to use this You must login or register to view this content..

Real Menu Examples


Any idea why my menu wont open now? Smile
05-03-2015, 02:49 AM #26
DoraTheKiller97
Treasure hunter
Cant use these on menus i downloaded. Wehh :'(
05-25-2015, 01:11 PM #27
ProfoundModz
Can’t trickshot me!
Thanks.
06-06-2015, 11:19 PM #28
i need help putting this inside of a menu can someone help me my skype is [jp.toonzy]

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo