This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
component:computer [2014/07/09 23:30] sangar |
component:computer [2020/03/13 01:21] ocawesome101 Added more documentation |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Component: Computer | ||
+ | ================== | ||
Computers provide a couple of API callbacks. Note that these can only be called by the computer itself, or its direct neighbors (i.e. other computers that share a face with that computer). Also note that since robots cannot interact with external components they cannot start/stop/query computers, but computers can interact with robots sitting next to them. | Computers provide a couple of API callbacks. Note that these can only be called by the computer itself, or its direct neighbors (i.e. other computers that share a face with that computer). Also note that since robots cannot interact with external components they cannot start/stop/query computers, but computers can interact with robots sitting next to them. | ||
Line 12: | Line 14: | ||
- `beep([frequency:number[, duration:number]])` | - `beep([frequency:number[, duration:number]])` | ||
Plays a tone, useful to alert users via audible feedback. Supports frequencies from 20 to 2000Hz, with a duration of up to 5 seconds. | Plays a tone, useful to alert users via audible feedback. Supports frequencies from 20 to 2000Hz, with a duration of up to 5 seconds. | ||
+ | - `getDeviceInfo(): table` | ||
+ | Returns a table of device information. Note that this is architecture-specific and some may not implement it at all. | ||
+ | - `crash(reason: string)` | ||
+ | Attempt to crash the computer for the specified reason. | ||
+ | - `getArchitecture(): string` | ||
+ | Returns the computer's current architecture. | ||
+ | - `isRobot(): boolean` | ||
+ | Returns whether or not the computer is, in fact, a robot. | ||
Example use: | Example use: |