All pastes #365810 Raw Edit

Untitled

public ruby v1 · immutable
#365810 ·published 2007-02-21 07:02 UTC
rendered paste body
#!/usr/bin/ruby #what this is:#a dice roller with dnd 3rd edition sane defaults#this is also a test.#please remain calm.#please see the "copythis" function too.Deroach = 1 #debug mode = 1def helpme()	puts "Enter in the style of \" 4d6+2 \"."	puts "^C to quit. Note that this program is highly tollerant of it's input."	puts ""	puts "This software is completely free, and is released under the"	puts "creative commons attribution-sharealike 2.5 license. A copy"	puts "of this license can be found at:"	puts "http://creativecommons.org/licenses/by-sa/2.5/"	puts ""	returnend	helpme #i'm drowning!Stupid = nil #ugly kludge!do until Stupid != nil	#numdice, sides, pip = 1, 6, 0	srand		print "> "	input = gets		#hey, i should make it so enter just repeats the last one	#also need to make sure the "sane" defaults actually work.	#i smell if's....		if input == "h\n" #help		helpme()	end		#here there be dragons!		if input == "\n"		print ">> ", numdice.to_i * rand(sides.to_i) + pip.to_i, "\n"		return	end			numdice, sides, pip = input.scan(/\d+/)		if Deroach == 1		print "input  : ", input		print "numdice: ", numdice, "\n"		print "sides  : ", sides, "\n"		print "pip    : ", pip, "\n"	end		print ">> ", numdice.to_i * rand(sides.to_i) + pip.to_i, "\n"	#puts numdice.to_i * rand(sides.to_i) + pip.to_i		end