Page 1 of 1

RTJ - Ruby Terminal Jukebox

PostPosted: Tue Apr 13, 2010 7:58 pm
by cavygalaxy
YESCH!!! :D
I finally got a code to function properly!
It is a jukebox script.
Here's the code:
Code: Select all
require "Rubygame"
include Rubygame
# Credits - DO NOT DELETE!!!
puts "RTJ - Ruby Terminal Jukebox"
puts "Made by Nicholas D. West"
puts "Made with Ruby and Rubygame"
# Repeat This Code
loop = 0
until loop == 1
# Fetch the input, puppy!
print "Input: "
input = gets.chomp
# if the input matches the code...
if input == "nw" then
# ...Play the song!
music = Music.load("nw.mp3")
puts "ERROR: Music file doesn't exist" if music == nil
music.play
puts "Playing..."
# Another Example!
elsif input == "md" then
music = Music.load("md.mp3")
puts "ERROR: Music file doesn't exist" if music == nil
music.play
puts "Playing..."
# But what if the input is wrong?
else
puts "ERROR: Unreckognized Input"
end
end

Re: RTJ - Ruby Terminal Jukebox

PostPosted: Tue Apr 13, 2010 11:06 pm
by shawn42
congrats!