ScaryBinary
05-15-2008, 11:25 PM
I saw a mysterious reference to strings and arrays in the release notes for one of the last few builds (776/777), and decided to experiment a bit. I got the following to compile:
ffc script StringTest{
void run(){
int myChar = 'a'; // A single character.
int myUserName[11] = "ScaryBinary"; // An array of characters, proper length.
int myBadExample[5] = "Overflow?"; // An array of characters, wrong length.
// Dump some stuff to the log file.
Trace(myChar);
Trace(myUserName[0]);
Trace(myBadExample[0]);
}
}
The script dumped the following to the log file:
97.0000
83.0000
79.0000
The numbers dumped to the log file are the ASCII codes for the individual characters in the arrays. However, myBadExample[4] returned the question mark (I was expecting "f"...).
At any rate, I couldn't do much else (anything, actually) with the strings/character arrays...will we be getting some special string functions soon :naughty: ....or are there some secret ones implemented already? Ones that might let us draw whatever text we want, where we want on the screen? :giggle:
ffc script StringTest{
void run(){
int myChar = 'a'; // A single character.
int myUserName[11] = "ScaryBinary"; // An array of characters, proper length.
int myBadExample[5] = "Overflow?"; // An array of characters, wrong length.
// Dump some stuff to the log file.
Trace(myChar);
Trace(myUserName[0]);
Trace(myBadExample[0]);
}
}
The script dumped the following to the log file:
97.0000
83.0000
79.0000
The numbers dumped to the log file are the ASCII codes for the individual characters in the arrays. However, myBadExample[4] returned the question mark (I was expecting "f"...).
At any rate, I couldn't do much else (anything, actually) with the strings/character arrays...will we be getting some special string functions soon :naughty: ....or are there some secret ones implemented already? Ones that might let us draw whatever text we want, where we want on the screen? :giggle: