Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # az-Android.rb:837
- # Random number generator X x Y
- when /^\.rand/i
- wordarr = words[1].split(" ")
- wordarr.slice!(0)
- myphrase = wordarr.join(" ")
- if myphrase.match(/^([^ ]+?)$/i) != nil
- command( "say Nothing here." )
- end
- if myphrase.match(/^(-?\d+?) (-?\d+?)$/i) != nil
- x = Integer(myphrase.match(/^(-?\d+?) (-?\d+?)$/i)[1])
- y = Integer(CGI::escape(myphrase.match(/^(-?\d+?) (-?\d+?)$/i)[2]))
- puts "X=#{x} Y=#{y}"
- if y > x
- srand();
- command("say #{triggerUser}, your number is... #{x + rand(y-x)}.")
- elsif y == x+1
- command("say Your second number must be greater than your first number + 1.")
- else
- command("say Your second number must be larger than your first.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement