Honestly, I just put this together, so perhaps it was utterly foolish of me to expect this to work.
The idea is that the text object takes it's given string and separates it into smaller strings each with different parameters.It takes a string like"The idea is /inot /cto destroy the /bstrange monsters, /cbut rather to take them alive for further inspection by /ySeamus."and turns it into"The idea is not to destroy the strange monsters, but rather to take them alive for further inspection by Seamus."For some reason, it doesn't do this.All of the ministrings are blank and the formatting is not present.length = string_length(str);
while(parseStringPos < length)
{
parseStringPos += 1;
changed = false;
if (string_char_at(str,parseStringPos) == "")
{
parseStringPos+=1;
if ((string_char_at(str,parseStringPos) == "i") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringFormatting[currentString] = 1;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "b") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringColor[currentString] = c_blue;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "g") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringColor[currentString] = c_lime;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "r") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringColor[currentString] = c_red;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "y") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringColor[currentString] = c_yellow;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "s") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
stringEffect[currentString] = 1;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
parseStringPos += 1;
}
if ((string_char_at(str,parseStringPos) == "c") && (changed = false))
{
changed = true;
currentString += 1;
totalStrings += 1;
parseStringPos += 1;
stringStartXinc[currentString] = stringStartXinc[currentString-1]+string_width(stringText[currentString-1]);
stringStartYinc[currentString] = stringStartYinc[currentString-1];
}
}
else if (string_char_at(str,parseStringPos) != "#")
{
stringText[currentString] += string_char_at(str,parseStringPos);
}
else
{
currentString += 1;
totalStrings += 1;
stringLines += 1;
stringStartXinc[currentString] = 0;
stringStartYinc[currentString] = stringLines * 12;
stringColor[currentString] = stringColor[currentString-1];
stringFormatting[currentString] = stringFormatting[currentString-1];
stringEffect[currentString] = stringEffect[currentString-1];
}
}
Jesus Christ on a bendy bus, I'll have a crack at this in the morning (7/8 hours).
Edit: Wait, is it meant to check for a forward slash in your first if-statement? You've got an empty string in there at the minute which makes no sense to me.This is why I use pictures of text.
That's a bad idea and you should feel bad (read: your solution wastes space and is entirely inflexible).
GoobyRob, plz!This should fix it. I've left in formatting persistence so you can stack colours with formatting with effects but I've left out the specific code for each tag, it won't be hard to add it in. Caveat Emptor: I haven't tested this, only eyeballed it.
This has been done before, and is on the GMC..I think Fox-NL made it.
Also be sure to spot something that could be modularized right away. Its a bad idea to go all copy-pasta in your code. Make a script for things you know are consistent or could easily be repetitive to manipulate.
Yeah, I've got a system that parses a single character, but not two like you're doing. In other words, I'll point you toward Juju.