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.
 
 
dieroller/roller.rb

10 lines
404 B

#!/usr/bin/ruby
require "./db"
require "./die"
require "cgi"
cgi = CGI.new
result = roll(cgi.params["rollstring"][0].to_s)
statement = $my.prepare("INSERT INTO rolls (id, roll, result, user, game) VALUES (" + $my.insert_id.to_s + ", '" + cgi.params["rollstring"][0] + "', '" + result.to_s + "', '" + cgi.params["user"][0] + "', '" + cgi.params["game"][0] + "');")
statement.execute
puts result
$my.close