Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Peter Tillema edited this page Nov 26, 2018 · 4 revisions

getKey works like it does in TI-BASIC, it returns the keycode of the last pressed key, or a 0 if no key was pressed since the last inquiry. However, the keycodes are different than the TI-BASIC keycodes. Your ICE download should contain an image showing the keycodes, but you may also find it here. An example of its use:

Repeat K=9
    getKey→K
End

That simple code will just wait until the user hits [ENTER]. getKey has another variation, getKey(X). The difference is that getKey(X) returns a 1 if the key with the keycode you give it has pressed, 0 if released. It's much faster than getKey and it allows you to directly read the current state of a button, meaning that it's more useful for games where you need to constantly do something as the user holds down a key. Example:

While getKey(2)
    X+1→X
End

That code continues increasing the value of X for as long as the user holds down left arrow.

Clone this wiki locally