This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
item:nanomachines [2016/01/14 01:28] inari rework page to hopefully be better, remove outdated info |
item:nanomachines [2016/06/06 20:44] xarses [Nanomachines] update functions to match reality |
||
---|---|---|---|
Line 25: | Line 25: | ||
Programming the machines happens through wireless messages. The range nanomachines are able to receive messages from is only about two meters, though this can be circumvented easily by using a tablet to send the messages. However, the nanomachines do not check which device sent the messages they receive. | Programming the machines happens through wireless messages. The range nanomachines are able to receive messages from is only about two meters, though this can be circumvented easily by using a tablet to send the messages. However, the nanomachines do not check which device sent the messages they receive. | ||
- | A simple protocol is used to control the machines: each packet consists of multiple parts, the first of which must equal the string "nanomachines". The second part is the command name. Additional parts are parameters for the command. The following commands are available: | + | Nanomachines react to a simple, proprietary protocol: each packet must consist of multiple parts, the first of which is the "header" and must equal the string `nanomachines`. The second part must be the command name. Additional parts are parameters for the command. The following commands are available, formatted as `commandName(arg1, ...)`: |
- | - `setResponsePort(port:number)` | + | - `setResponsePort(port:number)` - Set the port nanomachines should send response messages to, for commands that have a response. |
- | Set the port nanomachines should send response messages to, for commands that have a response. | + | - `getPowerState()` - Request the currently stored and maximum stored energy of the nanomachines. |
- | - `getTotalInputCount()` | + | - `getHealth()` - Request the player's health state. |
- | Request a message with the total number of available inputs. | + | - `getHunger()` - Request the player's hunger state. |
- | - `getSafeInputCount()` | + | - `getAge()` - Request the player's age in seconds. |
- | Request a message with the number of safe inputs. | + | - `getName()` - Request the player's display name. |
- | - `getInput(index:number)` | + | - `getExperience()` - Request the player's experience level. |
- | Request a message with the current state of the input with the specified index. | + | - `getTotalInputCount()` - Request the total number of available inputs. |
- | - `setInput(index:number, value:boolean)` | + | - `getSafeActiveInputs()` - Request the number of *safe* active inputs. |
- | Set the state of the input with the specified index to the specified value. | + | - `getMaxActiveInputs()` - Request the number of *maximum* active inputs. |
- | - `getActiveEffects()` | + | - `getInput(index:number)` - Request the current state of the input with the specified index. |
- | Request a list of active effects. Note that some effects may not show up in this list. | + | - `setInput(index:number, value:boolean)` - Set the state of the input with the specified index to the specified value. |
- | - `getPowerState()` | + | - `getActiveEffects()` - Request a list of active effects. Note that some effects may not show up in this list. |
- | Request a message with the currently stored and maximum stored energy of the nanomachines. | + | - `saveConfiguration()` - Requires a set of nanomachines in the players inventory, will store the current configuration to it. |
For example, in OpenOS: | For example, in OpenOS: | ||
- `component.modem.broadcast(1, "nanomachines", "setInput", 1, true)` will enable the first input. | - `component.modem.broadcast(1, "nanomachines", "setInput", 1, true)` will enable the first input. | ||
- | - `component.modem.broadcast(1, "nanomachines", "reconfigure")` will reconfigure the nanomachines. | + | - `component.modem.broadcast(1, "nanomachines", "getHealth")` will get the player's health info. |
=== See also === | === See also === |