u/awshidahak - 3 Archived Voat Posts in v/programming
u/awshidahak
  • home
  • search

u/awshidahak

0 posts · 3 comments · 3 total

Active in: v/programming (3)

  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››
Comment on: [Help] Complete noob here; want to know how you can easily fake console text for filmmaking purposes

You're quite welcome.

1 23 Jul 2015 23:47 u/awshidahak in v/programming
Comment on: [Help] Complete noob here; want to know how you can easily fake console text for filmmaking purposes

Okay, I think I've found the parts to most of what you want. Here's something easy you can throw together in Bash (linux's shell/batch processing program). It should work in Linux, OSX, or Windows with cygwin.

Any text that you want to display you can display with

echo
e.g.

echo "Now starting the intriguing daemon"
echo "Initializing core..."
echo -n "Beginning seven times "
sleep 1
echo -n "1 "
sleep 1
echo -n "2 "
sleep 1
echo -n "3 "
sleep 1
echo -n "4 "
sleep 1
echo -n "\nOh, "
sleep 1
echo -n "what the heck... "
sleep 1
echo "5 6 7 8"

Okay, I got a little carried away and included options that I haven't described yet, so I'd better explain them now. Putting -n in between echo and what you'd like to echo will cause echo to not move the cursor to the next line as it normally would. Just play with it and you'll see what I mean. The sleep statement causes the computer to stop processing your script for a specified amount of time, in our case, one second. If you put a \n in your statement to be displayed, that will move the cursor to the next line.

Anyway, when we run our script, it should display this on the screen: (pauses omitted)

Now starting the intriguing daemon
Initializing core...
Beginning seven times 1 2 3 4 
Oh, what the heck... 5 6 7 8

If you want to pause for keyboard input, just put read on it's own line, like this:

echo "Welcome to the secret system\n"
echo -n "Who goes here? "
read
echo -n "Password? "
read
echo "\nOh hey, it's you. Welcome."
echo "Would you like a nice game of chess?"

This will display the welcome message on the screen, ask for login, wait until your actor presses enter, ask for the password, wait for enter again, and then try and not start global thermonuclear war (that last part makes sense if you've seen the movie war games).

I'm aware that this is a long post, and may be a bit to take in all at once if this is new for you. Please feel free to just pick at sections of this post, and don't feel afraid to tell me I haven't explained something well enough. I'll try and break down whatever you need.

As for the more seasoned programmers in this thread, the reason I didn't use loops in my example (even though it would have made less lines of code) is so that I'd only be introducing a few keywords at a time.

As for your spinner, that's a bit more complicated for this lesson (unless there's a really cool simple solution I don't know about. I never used a spinner in a console app before.)

2 23 Jul 2015 05:43 u/awshidahak in v/programming
Comment on: [Help] Complete noob here; want to know how you can easily fake console text for filmmaking purposes

Do you have anything specific in mind (as to the text you would wish to show on the console)? If you're messing with python, you might wish to use time.sleep to make pauses in your output. (So there's one tip without much idea as to what you're wanting).

1 23 Jul 2015 02:24 u/awshidahak in v/programming
  • ‹‹‹
  • ‹‹
  • ‹
  • 1
  • ›
  • ››
  • ›››

archive has 9,592 posts and 65,719 comments. source code.