Invalid Expression for time display in min:sec:millisec
Hi! Can't seem to work out what's wrong with the following expression. Even when simply instructing an actor to display text with the formatted time, it doesn't work. However, at one point it did briefly work, but then I had to modify something and when re-entering the expression, it stopped working. Any other settings should I be aware?
MIN:SEC:MILLISECS time display ...
floor(floor((game.time%3600)/60)/10)..floor((floor(game.time%3600)/60)%10)..":"..floor((game.time%60)/10)..floor(game.time%10)..":"..(floor(game.time*10)%10)..floor(floor(game.time*100)%10)
Thought I'd add that replacing it with the following min:sec expression does work, so I assume issue is with above expression:
floor(floor((( game.endTime )%3600)/60)/10)..floor((floor(( game.endTime )%3600)/60)%10)..":"..floor((( game.endTime )%60)/10)..floor(( game.endTime )%10)
Comments
That's quite an expression! You might start by pulling it apart into multiple expressions instead of concatenating them with "..". So just looking at your first expression, it would work out to six separate expressions not including the colons. If you test each one, you should figure out which one is causing the problem. Of course, you didn't mention what "it doesn't work" means... does it say invalid expression or do you get a value but just not the one you expect...can you be specific about what is/is not happening?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Sometimes when I change expressions the attributes will get changed into text and mess everything up. If it is recognized as an attribute there should be a blue outline around game.time if not it will just look like text. This is one of my common problems with the expression editor
www.rossmanbrosgames.com
Here you go, fixed expression attached.
Another way to do a m:s:m clock (file attached)
Thank you all for your quick responses! Only started using GS a couple months ago, and what a steep learning curve it's been! Challenging and enjoyable. I am not even use to posting in forums/discussions but am really impressed with the support available.
@tatiang, sorry forgot to specify that it was an 'invalid expression' that I was receiving.
@Socks, your expression works! Thank you so much! But I just can't figure out what was different in my expression. I tested and compared, but can't see the difference. I did copy and paste my original one from a webpage, and then reinserted the game.Time attribute (so that it was highlighted in the blue box, which @RossmanBrothersGames also pointed out); but then I also did the same with your code. Would you mind explaining if it's not too much trouble? : )