by Spike » Fri Oct 07, 2011 8:24 am
encrypt?... urr... why?
if you're merely encoding the stats as a single string, then again, why? why not just use several separate stats?
For one thing, DP's string stats are limited to 15 chars.
Or am I going off on a tangent and you mean stats as in storing them to a file with frik_file, instead of the csqc stats concept?...
both FTE and DP support FTE_STRINGS. You can find builtin definitions inside dpextensions.qc.
This extension contains str2chr to read an individual character from a string as a char value(float), as well as a chr2str builtin to convert a char value(float) into a string constant with a single char.
chr2str return values can be concatinated together with frik_file's strcat.
chr2str(100) -> "d";
str2chr("d", 0) -> 100;
bonus points:
chr2str(97, 98, 99, 100, 101, 102, 103, 104) -> "abcdefgh"; (accepts up to 8 args)
str2chr("something ending with a c", -1) -> 99; (negative indexes are relative to the end of the string so -3=97)
Also:
both fteqcc and frikqcc will intepret 'a' as a character constant, giving a float value of 97, so you shouldn't need those numeric constants above.
.