Topic: Need help completeing and compiling this script... new to ruby as well

require '/Proxies.rb'
$id = XatLib.GetChannelID 'ChatChannel'

threads = []
ind = ARGV[0].to_i
ind.upto(ind + 32) { |i|
  ip, port = $proxies[i % $proxies.length].split ':'
  puts "Using #{ip}:#{port}"
  threads << Thread.new(ip, port) { |ip, port|
    begin
      p = {'ip' => ip, 'port' => port}
      u = {'avatar' => 333, 'nickname' => 'ChatBot:)'}
      x = XatClient.new
      x.setupMyUser u
      x.joinChannel $id, p
      while true
        sleep 1
        begin
          x.update
          if(!x.inChatlog)
            #x.sendMessage 'Connected ' << rand(255)
            sleep 3
          end
        rescue
        end
      end
    rescue
    end
  }
}

threads.each { |th| th.join }

I'm having troubles with this script... obviously Proxies stands for a list of proxies. But every time I try to run it (I'm on Windows btw).. it just opens then closes.

It's a basic chatbot script, it's supposed to join a chatroom.

Is there anything wrong with it? I'm very new to ruby and I can't seem to find out what exactly is wrong with it, there are no outputted error logs, and I know windows is probably THE worst OS I can use to program/test Ruby on.


Any help will be appreciated!

Last edited by x2Dread2x (2011-01-07 05:27:33)