include Muby::Configurable conf.timestamp = false conf.show_level = :debug conf.user_edited_config_file = true conf.input_logfile = open("/Users/zond/tmp/mubylog", "a") conf.key_commands[1] = :scroll_up! conf.key_commands[26] = :scroll_down! conf.max_history = 1000 $AUTOGYM = false # # Status bar # $STATUS = [] health_regexp = /^(\[[|*\s]{15,15}\].*)\s*$/ conf.remote_triggers[health_regexp] = Proc.new do |inwin, outwin, match| unless match[0].match(/XP/) if $STATUS.empty? $STATUS = [match[1]] else $STATUS[0] = match[1] end end nil end conf.gags << health_regexp summary_regexp = /^(\[[|*\s]{15,15}\])(.*XP.*)\s*$/ conf.remote_triggers[summary_regexp] = Proc.new do |inwin, outwin, match| $STATUS = [match[1]] + match[2].split nil end conf.gags << summary_regexp conf.startup_triggers << Proc.new do |inwin| $STATUS_THREAD = Thread.new do loop do sleep 1 inwin.set_status_line(" #{$STATUS.compact.join(" ")} ") sleep 9 inwin.send("su", false) end end end # # Gym # conf.remote_triggers[/^You replace the weight bar on the peg.$/] = Proc.new do |inwin| if $AUTOGYM $GYM_COMMAND = "rep weight" $GYM_PREFIX = "recline on weight" inwin.send($GYM_COMMAND) end end conf.remote_triggers[/^You let go of the bar and rest your feet on the ground.$/] = Proc.new do |inwin| if $AUTOGYM $GYM_COMMAND = "rep machine" $GYM_PREFIX = "recline on machine" inwin.send($GYM_COMMAND) end end conf.remote_triggers[/^You finish hitting the speed bag. It comes to a halt.$/] = Proc.new do |inwin| if $AUTOGYM $GYM_COMMAND = "train on speed" $GYM_PREFIX = false inwin.send($GYM_COMMAND) end end conf.remote_triggers[/^You are getting dangerously close to injury; you should stop exerting yourself.$/] = Proc.new do |inwin| inwin.send("stop") inwin.send("stand") inwin.send("lie") rest_regexp = /^You finally feel all of the fatigue work its way out of you.$/ conf.remote_triggers[rest_regexp] = Proc.new do |inwin| conf.remote_triggers.delete(rest_regexp) stand_regexp = /^You stand up from the floor\./ conf.remote_triggers[stand_regexp] = Proc.new do |inwin| conf.remote_triggers.delete(stand_regexp) inwin.send($GYM_PREFIX) if $GYM_PREFIX sleep 5 inwin.send($GYM_COMMAND) end inwin.send("stand") end end # # Aliases # conf.local_triggers[/^trauma$/] = Proc.new do |inwin| trauma_regexp = /^Snorg gets a trauma kit from his/ conf.remote_triggers[trauma_regexp] = Proc.new do |inwin| conf.remote_triggers.delete(trauma_regexp) inwin.send("use trauma kit") inwin.send("put trauma kit in bag") end inwin.send("get trauma kit from bag") nil end conf.local_triggers[/^suture$/] = Proc.new do |inwin| suture_regexp = /^Snorg gets a suture kit from his/ conf.remote_triggers[suture_regexp] = Proc.new do |inwin| conf.remote_triggers.delete(suture_regexp) inwin.send("use suture kit") inwin.send("put suture kit in bag") end inwin.send("get suture kit from bag") nil end