This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
component:computer [2014/07/09 23:28] sangar created |
component:computer [2020/03/13 01:26] (current) ocawesome101 |
||
---|---|---|---|
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 11: | Line 13: | ||
Returns whether the computer is currently running. | Returns whether the computer is currently running. | ||
- `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)` | ||
+ | Attempts 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: | ||
Line 21: | Line 31: | ||
``` | ``` | ||
+ | ---- | ||
{{page>component:contents&noheader&noeditbutton&nouser&nofooter}} | {{page>component:contents&noheader&noeditbutton&nouser&nofooter}} |