A simple web based die roller I made to learn Ruby, and emulate the defunct Invisible Castle.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
#!/usr/local/bin/ruby
config = File . new ( " db.rb " , " w " )
config . print ( " require 'mysql' \n " )
print " hostname: "
hostname = gets
print " username: "
username = gets
print " password: "
password = gets
print " dbname: "
dbname = gets
config . print ( " begin \n raise 'DB Error' unless $my = Mysql.connect(' " + hostname . strip + " ', ' " + username . strip + " ', ' " + password . strip + " ', ' " + dbname . strip + " ') \n " )
config . print ( " unless $my.list_tables.include?('rolls') \n statement = $my.prepare('CREATE TABLE rolls (id INT NOT NULL AUTO_INCREMENT, roll TEXT, result TEXT, user TEXT, game TEXT)'); \n statement.execute \n end \n " )
config . print ( " rescue \n print 'Please double check db settings or contact the administrator' \n end " )