New functions added in version 1.021

View previous topic View next topic Go down

New functions added in version 1.021

Post  Ellypse on Sun Feb 02, 2014 5:21 am

These function will be added to totalRP2_API.lua

TRP2_DeleteColorCode(chaine):
Code:
function TRP2_DeleteColorCode(chaine)
 if (chaine == nil) then
 return "";
 else
 return string.gsub(chaine, "{%w*}", "");
 end;
end
Proposed by Zax, this function return the string it's given without the color tokens.
I changed Zax's code from string.gsub(chaine, "{.*}", "") to string.gsub(chaine, "{%w*}", ""), to make sure it doesn't delete new lines token.
This function is used for displaying name using %t in /emote, and for disabling color for names in chat and color in the entire tooltip.
It is also used when sending informations to other RP addons using Mary Sue Protocol.

TRP2_GetInt(value):
Code:
function TRP2_GetInt(value)
 return math.floor(tonumber(value));
end
This function return the int for the string or float it's given.
This function is used for bulletproofing Total RP agains't the corruption caused by patch 5.4. Sliders were returning float values instead of int, that were inserted into the creation files and made the addon crash when trying to open it. Using this, even if incorrect float values are inserted, Total RP will cast them to int.
I like to think of this as a divine shield  Wink

_________________
Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer

Follow me and Total RP's development
on Twitter ! @EllypseCelwe
avatar
Ellypse
Admin

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile http://renaudparize.fr

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum