Teletype - Programming a keyboard to send stored commands

I’ll give a shot tonight. I type fast :slight_smile:

1 Like

@scanner_darkly, this is also perfect, for me. It’s like having a whole new module! Or a working keyboard :slight_smile:

Does this come with potential performance side effects?

2 Likes

awesome, thanks for testing @jlmitch5 and @xenus_dad!

this version doesn’t have any changes in how often keyboard is polled, so no effect on performance. the fix is described here.

i’m pretty sure the version i posted should have everything from 3.0 but i’ll make another build tonight using the official 3.0 just in case and post it in the other thread.

re: assigning arbitrary commands to shortcuts - this is basically scripts, with the ability to assign shortcuts to them, which necessitates having more scripts or the timeline feature (as scripts 1-8 already have shortcuts assigned to them).

1 Like

That is exactly the case.

this would be a much bigger change (imagine the UI you’d need to support the editing mode), but it gives me an idea. what about a variation of SCRIPT op where you could execute a specific line in a script, something like SCLINE script line? then you could code a scene with earthsea like grid UI triggering specific lines, or even create a sequencer where you sequence which lines to execute.

2 Likes

That sounds great!
It seems like something that would fit very nicely within the general TT logic/ethos.

As far as UI for the grid triggered commands. In my head it just looked like a vertical scroll of numbered lines (or they could be numbered as coordinates of column/row: 1.2, 1.3, etc.). As you scroll up and down to enter the command lines, the given number lights up the corresponding button.

that feels like a pretty special use case tbh, i’d rather have some more generic way of doing this, which to me is just scripting a UI using the existing grid ops. you could implement a sequencer or an earthsea style keyboard with just init and metro scripts, which leaves you with 48 possible lines.

1 Like

Counter: if you added or deleted a line to a script you had targeted elsewhere with SCLINE it would break the references throughout the rest of your scene.

I don’t know if it’s possible to have arbitrary (can’t remember what they’re really called but the) : operators, to ‘name’ a line. Almost like function/method names.

FOO: TR.PULSE 1

and then call EX FOO or something to execute.

I am assuming there are very good reasons why Teletype doesn’t support named functions. But, referencing a specific number line in a script seems to be asking for things to break.

Eagerly awaiting the GOTO op :wink:

2 Likes

We can make rocket ships!

Actually could probably make rocketships with grid ops and L now.

2 Likes

good point, i would argue though that in a limited script space it’s easy enough to find all instances / edit appropriately (could also be done automatically but that would likely cause more issues than solve). also, for some use cases you would simply use scripts as collections of lines, so you would just edit specific lines without moving them. also this fits nicely within the existing system as it doesn’t require any major changes (although the execution context will need to be carefully considered).

regardless, having functions would be very useful. relevant thread:

2 Likes

That makes sense. It just has code smell, to me :slight_smile: but you’re right, this is a small world of 60 lines, and we already make assumptions by calling SCRIPT 2 and such. Updating isn’t a huge burden.

I am also coming to this without much knowledge of the thought & discussion that’s gone into TT development so context like the discussion you linked is awesome.

Also, thanks for what you do! It’s a huge effort.

1 Like

thinking more about using grid to trigger specific lines, i should just add it to the grid control mode. when you on a script page the grid control allows you to toggle comments for individual lines, i could add 6 more buttons to trigger specific lines (i would have to remove the 2 buttons for “enable all lines” / “disable all lines”):

6 Likes

Here’s a usb stick that can be used to emit keyboard codes. It’s sold as a hacker injection tool but it could potentially work for this use case: https://hakshop.com/products/usb-rubber-ducky-deluxe

That’s an interesting prospect, but it looks like it just triggers when you plug it in, where I think the group is looking for a selection of such macros, and some sort of interface to choose between them.

EDIT:
Just found the docs. Let’s see if I can confirm that.
…looks like there’s one button. Might be enough for a round-robin sort of arrangement, or a “execute random script”…

So, I can imagine the UI for the first idea. Use the second idea in a 128 line script. Just add scrolling to the code editor. :wink:

This is totally GOTO, by the way. And I love it. Totally understand if there are technical reasons why it is a terrible idea, but GOTO was my intro to making stuff do things in interesting ways. I was 9. It was the most fun I had ever had up to that point.

So wait, is it part of grid mode already?! Man, I need to catch up!

not quite GOTO though - it would just execute the specified line and continue in the current script. GOTO would be like BREAK followed by jumping to the specified line. it’s more like calling a function where a function is a line of code.

you mean executing specific lines from the grid control mode? that hasn’t been done yet, on my todo list.

1 Like

Well, I hate to mention it, but I recently got a Vortex Race 3 Keyboard and I finally tested out sending the Teletype preprogrammed macros or programmed commands and it doesn’t seem to work.

I’ve updated to the latest firmware, “3.0 KBD Fix”. And when I type, It doesn’t drop any keys. But when I attempt to use the feature of sending key commands via the programming layers the text appears to drop a ton of letters.

For example I programmed the keyboard to write “charlie” when I press the Q key. It works every time on the laptop.

On the Teletype, the first time it writes…

CRE
the next time,
HRE
again,
AI
one more time,
CI

So, it appears to be dropping a lot of letters for some reason. I did test out a time delay function on the keyboard. Where it will type the macros out much slower, with a half second between the letters. But it still drops the keys. So I dont think it must be a refresh rate or scanning rate that is the issue.

Would anyone here have any ideas what might be happening?

I think I remember seeing Scanner Darkly mentioning somewhere about how keyboard protocol is a bit different and odd, so I think this could be one of those oddities.

But any help is much appreciated! I would love to be able to get this working.

Thanks!

1 Like

Hi all,

I just wanted to report that I picked up a Genovation CP48 for sending keyboard macros to the Teletype and, after a bit of trial and error, I was able to get it to work with 100% consistency!

At first, it acted exactly like the Vortex Race keyboard in that when I sent a macro to the Teletype it only received a small percentage of the keystrokes, even with extremely long delays. But, because the Genovation comes with a pretty comprehensive software for programming it (windows-only) I was able to find the right balance of settings to get it to work consistently with the Teletype.

Luckily, the programming software offered three types of playback modes for the macros. I had to select the third one called Literal mode, where you have to manually program key-down and key-ups for each character. Even still it wasn’t working 100%. Finally, once I added 40ms delays between each key command it all worked completely consistently.

Just thought I’d let ya’ll know! Have a good one!

Here’s a link to the CP48 https://store.genovation.com/programmables/cp48-usbhid.html

4 Likes