Available on: all targets

AFTER...CALL

The AFTER...CALL command implement a countdown timer for your program. It is a very useful tool for making a piece of code run after a specific interval, essentially turning your program into a countdown. You must specifying the length of time to wait, measured in TICKS.

When the timer reaches the specified timer, the program stops executing the current code and jumps to the PROCEDURE indicated by the label. After executing the routine, the program returns to where it left off and resumes execution. After the call, the timer is disabled. You must use, again, the AFTER...CALL to enable again the mechanism.

There are 8 delay timers from 0 to 7 which can be specified with timer parameter. If omitted, timer will be considered as 0. In the case of parallel timers, 0 will be the highest and 7 the lowest priority.

With EVERY OFF and EVERY ON you can disable or enable the timed calls. It is important to know or realise that low-priority-procedures which occurs simultanously to higher-priority-procedures are not lost. Their task remains or handled again after finishing the higher-prio interrupt.

Finally, note that the accuracy of the timer can vary depending on hardware and operating system, and it can be used to create animations, simulate real-time events, or simply to execute tasks after a specific time.

SYNTAX

 AFTER value[,timer] TICKS CALL identifier


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 AFTER 50 TICKS CALL changeBorderColor
 AFTER 50,2 TICKS CALL changeBorderColor


Used in:

ABBREVIATION: AfCa

Join BASIC 10Liner Contest with ugBASIC!

An interesting competition is held at the beginning of each year: the BASIC 10Liner Contest. It is possible to use ugBASIC to participate in the next "BASIC10Liner" competition, in the following categories:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

AFTER...CALL ↔ AfCa

Any problem?

If you have found a problem with this keyword, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO KEYWORDS