Forums Archived

The forums are being archived. See this topic for more information.

RTJ - Ruby Terminal Jukebox

Post about games, applications, etc. made with Rubygame. Feel free to promote your own projects here!

RTJ - Ruby Terminal Jukebox

Postby cavygalaxy » Tue Apr 13, 2010 7:58 pm

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
Cannibal Troll
A troll that trolls other trolls, thus making the internet a better place
User avatar
cavygalaxy
 
Posts: 18
Joined: Tue Oct 27, 2009 2:35 am



Return to Creations

Who is online

Users browsing this forum: No registered users and 0 guests

cron