![]() |
![]() |
Chapter 4: Input KEYBOARD: DiNGS offers 2 possibilities for keyboard input. Word input and key-checking. INPUT name$, x, y; This is what you already learned. Asking a special key if it’s pressed is slightly more difficult. IF KEY(code) = 1; PRINT "KEY PRESSED", 20, 20; This would be quite simple so far But what is the value for ‘code’? Well, it’s the key-code for any key. You can easily get the key code for a pressed key by using the program ‘Keycode.exe’. You can start it from the ‘?’ menu. MOUSE: MOUSESTATE mx, my, ma, mb; Writes the current mouse pointer’s position (x,y) to the values mx and my. The left mouse buffon is written to ma, the right one to mb. JOYSTICK: JOYSTATE jx, jy, buttona, buttonb;
Writes the current joystick state to the values jx and jy. The buttons are written to buttona and buttonb. FILES: GETFILE file$, line, linedata$; Reads from the file ‘file$’ the value at the line number ‘line’ (where 0 is the first index) and writes it to linedata$ (linedata). If no file was found, linedata$ will be “NO_FILE”. If no data was at the line’s position “NO_DATA” will be returned. Use words and check for errors before converting them to numbers for a save file I/O. PUTFILE file$, line, linedata$; Writes the word linedata$ (linedata) to the file ‘file$’ at the line ‘line’. Not used lines are filled with “NO_DATA” words.
|