for some reason when I use the Val() command, the number just comes out to 0. I've done plenty of tests and that seems to be the problem. However, if I convert a number to a string then back to a number again, it works perfectly fine. There are no specific conditions for triggering this problem, it seems to happen no matter what I do. Specifically I'm using an edit box and when it comes time for the frame change, it copies that edit box and converts that string to a value that can be put into a numbers array and be ready to be converted back to a string when the time calls for it.
I am assumign Val() takes the ASCII value of a single character. You can't just convert a string to a number, I am not sure how you would define it. If you give a valid ASCII number you should be able to convert it to a character, and then evidently you can convert that back to a number. You would have to iterate over the string's characters one by one and place the Val(char) in an integer array. Though maybe you are saying that the Val( ) of a single character returns 0?
Try using a string array instead of number array... im using it and it works quite much better... since you can much more easily convert numbers to string both ways than strings to numbers.
By the way if you still need some gfx let me know.
Yeah, that would make sense, but as it is, single characters (no matter what they are) always return a value of 0. I have a test field set up with 1 string and 1 counter and trying different combinations there. Single characters don't work, words don't work, ect.
no dice, that doesn't work either. Maybe my MMF is broke?
I might just have to do that. thanks for the offer for gfx, but i think the project is over for now.
that's basically it. it's either that or set counter to Val(string/editbox/"whatever") something like that. It doesn't matter where the text comes from, the problem is for whatever reason I can't get text to be converted to a value.
I think your problem is that you are trying to do the wrong thing.
The "convert text to number" function is a bit misleading in its label; it does not actually convert all text to a value, instead what it does is it pulls a number out of an ascii string, and returns that. For example, the text:
val("hello world 1928")
returns the value 1928. The "hello world " string is simply discarded
I don't remember exactly what happens if you have multiple substrings of numbers in there, like "293 hi 304"
But the point is that it does NOT convert the string into its hex-->decimal byte code representation or anything like that. If you want a string of the ascii code for each character, something like "abc" = 001002003 (those aren't the actual values in ascii), then you'd need to use uh I think theres an ASCII object, or maybe the binary object.
that makes perfect sense now! I did a quick test to confirm it visually, and when converting a number into a string, it doesn't actually convert the numbers to letters, it actually just makes a string of the exact same numbers, which also explains why it's possible to convert the opposite direction. I'll fiddle with some more extentions and see if it might not be less work to just convert all my values to a string array. thanks a bunch pixelthief!
Bah, all of that warrents alot of unnessessary code, I find it would be much easier to convert my number array to a text array and re-write all the code, it will work out a lot better in the long run for what I'm doing, imo. thanks alot guys for all of your help!
well, id like to have all the data used during the game to be in one array that deletes itself at the end of the game, rather than several arrays strewn about througout the game. im not a big fan of huge arrays, but i have it compacted into 5 different catagories on the z axis, the x axis for longevity and the y for constant variables. it's just the dang strings givin me a big issue.