diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-15 07:35:35 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-15 07:35:35 +0900 |
commit | f676fbc8be18cd3c61fdca90904054ee65f596cc (patch) | |
tree | 88c7643284464d8111dd72a2ba22570481347747 | |
parent | 54c199146e6cabc472d839e0ee8d7e2cb62652ae (diff) | |
download | Orca-f676fbc8be18cd3c61fdca90904054ee65f596cc.tar.gz Orca-f676fbc8be18cd3c61fdca90904054ee65f596cc.zip |
Added shorthands to commands
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/commander.js | 24 |
2 files changed, 21 insertions, 6 deletions
@@ -94,6 +94,8 @@ Some of Orca's features can be **controlled externally** via UDP though port `49 ### Commands +All commands have a shorthand equivalent to their first character, for example, `write` can also be called using `w`. + - `play` Plays program. - `stop` Stops program. - `run` Runs current frame. @@ -101,6 +103,7 @@ Some of Orca's features can be **controlled externally** via UDP though port `49 - `goto:aV` Sends cursor to `aV`. - `bpm:140` Sets bpm speed to `140`. - `apm:160` Animates bpm speed to `160`. +- `write:H12;34` Write glyph `H`, at `12,34`. ## Base36 Table diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js index 57d3aa2..7d91a1f 100644 --- a/desktop/sources/scripts/commander.js +++ b/desktop/sources/scripts/commander.js @@ -36,15 +36,27 @@ function Commander (terminal) { } this.operations = { + 'apm': (val) => { terminal.clock.set(null, parseInt(val)) }, + 'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) }, + 'goto': (val) => { terminal.cursor.goto(val) }, 'play': (val) => { terminal.clock.play() }, + 'run': (val) => { terminal.run() }, 'stop': (val) => { terminal.clock.stop() }, 'time': (val) => { terminal.clock.setFrame(parseInt(val)) }, - 'next': (val) => { terminal.clock.setFrame(parseInt(val)) }, - 'back': (val) => { terminal.clock.setFrame(parseInt(val)) }, - 'goto': (val) => { terminal.cursor.goto(val) }, - 'run': (val) => { terminal.run() }, - 'bpm': (val) => { terminal.clock.set(parseInt(val), parseInt(val), true) }, - 'apm': (val) => { terminal.clock.set(null, parseInt(val)) } + 'write': (val) => { + const g = val.substr(0, 1) + const pos = val.substr(1).split(';') + const x = parseInt(pos[0]) + const y = parseInt(pos[1]) + if (!isNaN(x) && !isNaN(y) && g) { + terminal.orca.write(x, y, g) + } + } + } + + // Make shorthands + for (const id in this.operations) { + this.operations[id.substr(0, 1)] = this.operations[id] } this.trigger = function (msg = this.query) { |