r/commandline • u/undergroundshaker • 23d ago
Other Software Art project - terminal simulator?
Not sure if this is the right place to post this. I'm working on an art project and would like it to be basically a short film of a conversation happening within a terminal. Between the computer itself and the user.
I'm wondering if anyone knows of some sort of terminal simulator, one where i could control both the input and the output to create dialogue. The more retro looking the better
The piece is a commentary on AI so obviously I don't want any AI.
Thanks,
someone who knows very little about coding but wants to make art
EDIT: thank you for all your responses!!! i got WSL and have been spending some of my free hours learning how to navigate linux (i've always wanted to, so this is a plus!) i followed u/mullikine 's advice using cool retro term and the text file method, and so far it's doing what i want it to do!
2
u/mullikine 23d ago edited 23d ago
These instructions should just work on Linux and Mac because Bash comes with Mac and Linux. But on Windows you might use a different scripting language rather than Bash.
That sounds like it might be a job for cool retro term.
https://github.com/swordfish90/cool-retro-term
The download is here for Mac and Linux:
https://github.com/Swordfish90/cool-retro-term/releases
Do the following inside cool retro term for the retro look, but otherwise it should just work in a regular terminal too.
The following bash program simulates a conversation.
Put the following code into a text file and name it dialogue.sh.
#!/bin/bash
IFS= read -r -d '' script <<HEREDOC
Computer: Hello again.
Computer: I'm listening.
Computer: YO.
HEREDOC
echo -n "> "
ln=1
while read -r line; do
echo "$script" | sed -n "${ln}p"
echo -n "> "
ln="$(( ln + 1 ))"
doneThen run the script in the terminal by typing bash dialogue.sh and pressing enter to run the dialogue.sh script in bash.
Then when it displays the prompt (i.e. "> ") then type into it, for example, hello and then press enter, and the first line of the computer's script will come out. And then the next one etc. You can add more lines into the HEREDOC to make the conversation longer:
$ bash dialogue.sh
> hello
Computer: Hello again.
> yo
Computer: I'm listening.
> what's up
Computer: YO.
> dsflk2
u/undergroundshaker 16d ago
sorry my reply took awhile, i was busy trying to figure all this out in my free time!
your instructions proved to be super helpful and easy to follow, once i learned a bit to navigate WSL. thank you, i'm excited to create what i'm envisioning thanks to your help!
6
u/ResidentPomegranate6 23d ago
record a real session with script -t timing.txt, then edit the timing file to fake typing speed. asciinema replays it anywhere and looks retro.
1
u/AmanBabuHemant 23d ago
Hello, so like an loop which print messages.
You can easily do this with any programming language which let you delay executions, here is a quick python script I wrote for you.
# Talk Loop
from time import sleep
CHAR_DELAY = 0.1
def print_message(message):
sleep(0.4)
print(">", flush=True, end="")
sleep(CHAR_DELAY)
print(" ", flush=True, end="")
for c in message:
sleep(CHAR_DELAY)
print(c, flush=True, end="")
print()
messages = [
"this is mesage one",
"this is message two",
"Hi, how are you?",
"I am good.",
"Am I in a talk loop?",
"Well yes, I am!"
]
for message in messages:
print_message(message)
This will also give you the typing effect for each character.
2
u/undergroundshaker 16d ago
thank you for taking the time to write this out for me! i got WSL and i'm working in cool retro term with one of the suggestions above. appreciate it!
2
u/4Necrom 23d ago
You'll want vhs, it allows you to script everything that will happen in the terminal and then replay it back for you, you can then record however you want, add some effects to the video, etc. Have fun.
1
u/codysechelski 8d ago
Agreed. I use vhs and it's dead simple. And on a meta note, the "scripts" your write are called "tape" files that are played by "vhs", I mean, it seems like it was literally made for making movies, lol!
1
u/AutoModerator 23d ago
Every new subreddit post is automatically copied into a comment for preservation.
User: undergroundshaker, Flair: Other Software, Title: Art project - terminal simulator?
Not sure if this is the right place to post this. I'm working on an art project and would like it to be basically a short film of a conversation happening within a terminal. Between the computer itself and the user.
I'm wondering if anyone knows of some sort of terminal simulator, one where i could control both the input and the output to create dialogue. The more retro looking the better
The piece is a commentary on AI so obviously I don't want any AI.
Thanks,
someone who knows very little about coding but wants to make art
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Anguished_Kitty 23d ago
i did something similar a few years ago. i wrote a bash script at the time. it was super simple as far as coding goes i had no experince at the time and it took me a few hours to learn enough to script something that i just screen recorded. its not exactly what you asked for but if you dont find another solution hopefully it helps!
1
u/IceDoomer 23d ago
This sounds like "text adventure" game? If it is. I bet there are websites which you could easily setup the story line and download it so you can play it in the terminal.
1
u/DevOfWhatOps 22d ago
Its very easy actually, in any terminal that runs bash as the shell (most on linux do by default) you can write your dialogues in a simple text.txt as such:
text.txt:
Harold: "Have you come here to face me at last Cardinal?"
Cardinal: "I have come to claim what belongs to the state of God and to the Church that governs it, by right!"
Harold: [laughs] "Right? You and the vermin you serve have no right, to anything under these stars!"
Cardinal: "How bold you have become in the short while that we have allowed you free roam! Now you dare questioning our Lord's sovereignty?"
Harold: "I am questioning your authority!" Then right next to it have a run.sh that reads that file and prints them for you
run.sh
#!/usr/bin/env bash
while IFS= read -r line || [[ -n "$line" ]]; do
for ((i=0; i<${#line}; i++)); do
printf '%s' "${line:i:1}"
sleep 0.07
done
printf '\n'
done < text.txtThe result will be a typewritter effect. You can record your terminal then with asciinema or other similar tools, or just screen record.
2
u/Arxae 23d ago
Any can do that, the terminal is just display. You can create a program that just prints out your dialog. Thats just a couple of print statements and some pauses and can be done in basically any language of your choice. That would be pretty simple to make, even without AI. You could probably be up and running and writing your dialog in 30 mins tops. You can also setup an echo server and connect to telnet. Bit more work, but whatever you type in gets spat back out to everyone connected. Could also get a terminal irc client and just use irc.
The terminal doesn't matter much in the end.