Posted By: mpdeveloper_B
[A6.60] Random problem with str_for_num - 06/03/09 21:30
I've tested, and tested, and tested some more....this is really starting to get to me. Another odd, random bug.
I have a string 'dipswtxt' which is used to write out text on the screen, and shows things like volumes and other things. I use a Text to show it on the screen, there are multiple lines, dipswtxt is defined like this:
string dipswtxt[9999];
which is fine, that means that dipswtxt has 9999 characters it can hold.
Now, sample code:
simple enough, right? It should output something like this:
'25' being the number of the sfx_volume. Well here's the thing, most of the time it shows up like that, but sometimes it shows up like this:
.....T? Where the hell did T come from?
Before you ask, yes sfx_volume is a number, no it is not a vector, and yes this is the only code partaining to turning that particular variable into a string. I have no idea why there is a problem. This bug is soooo random, and it doesn't only happen on one system, on another system instead of a 'T', there is a '\'.
How do I fix this? It's random and I have no way of testing it, I've noticed this problem with str_for_num or multiple occasions, is there a way to fix it? (don't say get A7)
I have a string 'dipswtxt' which is used to write out text on the screen, and shows things like volumes and other things. I use a Text to show it on the screen, there are multiple lines, dipswtxt is defined like this:
string dipswtxt[9999];
which is fine, that means that dipswtxt has 9999 characters it can hold.
Now, sample code:
Code:
str_cat(dipswtxt, "\n Sound Volume -> "); ////put sound volume code here str_for_num(tmp_str3, sfx_volume); str_cat(dipswtxt, tmp_str3);
simple enough, right? It should output something like this:
Code:
Sound Volume -> 25
'25' being the number of the sfx_volume. Well here's the thing, most of the time it shows up like that, but sometimes it shows up like this:
Code:
Sound Volume -> T
.....T? Where the hell did T come from?
Before you ask, yes sfx_volume is a number, no it is not a vector, and yes this is the only code partaining to turning that particular variable into a string. I have no idea why there is a problem. This bug is soooo random, and it doesn't only happen on one system, on another system instead of a 'T', there is a '\'.
How do I fix this? It's random and I have no way of testing it, I've noticed this problem with str_for_num or multiple occasions, is there a way to fix it? (don't say get A7)