HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Substrings

12-20-2002, 06:30 PM#1
Dinadan87
I have a problem. I put in "Set time of day to (real((substring((entered chat string), 10, 11))))"
The problem is that it always sets the time of day to midnight (0.00) regardless of what i try typing in. This puzzles me greatly because I put a similar action involving time speed and it worked perfectly... there are also several other triggers in my map that don't work even though I'm sure they should work right.
12-21-2002, 01:32 AM#2
Ari
It would help if you mentioned exactly what kind of input you were expecting in this trigger. You do realize that you're asking the game to take the 10th and 11th characters of that input, right? If those characters are text, they will be read as having a numberical value of zero. Perhaps that's the problem.
12-21-2002, 02:02 AM#3
Dinadan87
Yes, my 10th and 11th character were numbers. If my 10th character was1 and my 11th character was 8, its supposed to set the time to 18.00 but no matter what numbers i put it, i ALWAYS get 00.00.
12-21-2002, 03:29 AM#4
Ari
Hmmm, I'd suggest a test trigger to make sure the input is being parsed right. Have a trigger that simply displays the 10th and 11th characters of the inputted chat string. See if that reads 18. Actually, if there really is a string-to-real conversion taking place, maybe it should read 18.00.