15 users online: desimoss, Ebisu, hoangng, Humpersbmx1, KirbyPizzaPalace,  Linkdeadx2, MiracleWater, monkey03297, mtheordinarygamer,  Nanako, Natsuz2, niko, TheJank, Yutuz, Zavok - Guests: 99 - Bots: 237
Users: 66,509 (2,386 active)
Latest user: carrotkurboi21


UberASM Repository → Timer

Submission Details

Name: Timer
Author: imamelia
Type: Level
Includes GFX: No
Includes Hijack: No
Featured: No
Description: This code will create a timer on the status bar that ticks up or down depending on its settings. You can also set "effects" that happen when the time drops to 0, such as teleporting or killing the player.

Credit to Iceguy for the idea, even though I didn't use his code.
Tags: clock effect lorom sa-1 status bar stopwatch timer
Comments: 5 (jump to comments)
0.0 (0 ratings)
No rating
Download 3.33 KiB | 608 downloads


Comments (5)

HammerBrother Link
Just to warn you, the timer does not display the approximate centi-seconds, but rather a “jiffysecond” (1/60th of a second, AKA the game's frame within a second), thus only display numbers 0-59 instead of 0-99 (99 excluded because 59/60 is 0.983 (underline is repeating decimal)).

This timer is geared towards simplicity to use, mine, however is geared towards advance use of it that most other users are unlikely to use this (it's less user-friendly because it requires learning how to code).

Mine is mainly based on converting a single number, which is the 4-byte (32-bit) frame counter into HH:MM:SS:CC format via a routine (this routine alone merely converts, it does not increment or decrement the frame counter), the input is scratch RAM, so you can have a frame counter stored that is less than 32-bit. The benefit of this is in rare cases you wanted to add a gimmick you can add/subtract time (add 20 seconds, for example), this is much easier to handle a single number than every “time unit” should you exceed the 0-59 range of all units. Once the routine is done, you then need to take the outputs in !Scratchram_Frames2TimeOutput+0 to !Scratchram_Frames2TimeOutput+3, convert the number to decimal (HexDec), and write them to the status bar (I recommend using the colon for all numbers, but before the centisecond, put a period symbol).

2020-09-03 Edit: This tutorial covers on how to make a 32-bit timer (and a proper display).
 Telinc1 Link
A very customizable and flexible timer, however, it is quite hard to use without some amount of ASM knowledge. You could have made it a lot more user-friendly.

During the moderation, I fixed a mathematical expression in the level code which made the defines at the top pretty much useless and I added SA-1 compatibility. For future references, Asar does math left-to-right (a leftover quirk form xkas), but the expression relied on proper order of operations (and also inverted only one of the defines when it made sense to invert both). While correct behavior for can be turned on with math pri on, I wouldn't recommend it as it might break code which expects Asar's normal behavior.
TheJullasicFox Link
oh I didn't notice, I was hypnotized by it lol
BTW, can this work with the UberASM patch?
TheBiob Link
That gif is like 5 seconds long lol
TheJullasicFox Link
did anyone else watch the entire gif?
man I live a sad life