When I run shoesmudclient.rb, the Shoes console gives me an error saying 'Wrong
number of arguments: 0 for 1' in reference to the @inpthread.join in
cleanmudclient.rb. When I run just cleanmudclient.rb by itself, however, I
don't get any errors at all. Does Shoes use the 'join' method for something
else?

 I am using Shoes Raisins, Revision: 1091 (according to the manual). I am on
a PowerBook G4, running Mac OS 10.5 (Leopard), Power PC. It has 1.5 GHz
processor.

Thanks in advance.
-- 
--Timothy.
require 'socket' # For MUD connection.

class MUDclient
	attr_accessor(:test, :mudcon, :killed, :thetext)
	
	def initialize(host, port)
		@test = self
		@mudcon = TCPSocket::new( host, port) # Connect to a mud...
		@killed = false # Whether or not the connection is dead.
		# The thread for receiving input from the MUD.
		@recthread = Thread.new do ||
			until @killed == true
				rec = @mudcon.recv(1000000) # Receiving stuffs from the MUD.
				@test.receive(rec)
			end
		end
		# The thread for receiving input from the user.
		@inpthread = Thread.new do ||
			until @killed == true
				@test.input
			end
		end
		@inpthread.join
		@recthread.join
	end
	
	def input(inp)
		@mudcon.write("#{inp}")
		if inp == "quit"
			killed = true
			puts "Thanks for using this Ruby MUD client!"
		end
	end
	
	def receive(rec)
		@thetext = rec
	end
end
require '~/Documents/Ruby/cleanmudclient.rb'

Shoes.app do
	teststack = stack do
		flow :width => 750 do
			para "Host: "
			$hostline = edit_line :width => 300
		end
		flow :width => 750 do
			para "Port: "
			$portline = edit_line :width => 200
		end
		button "Connect" do
			$connection = MUDclient.new($hostline.text, $portline.text)
			teststack.clear
			overallstack = stack do
				flow :width => 800, :height => 800 do
				border black, :strokewidth => 2
				self.append $connection.thetext
			end
			flow do
				$inputline = edit_line :width => 800
			end
			button "Send" do
				$connection.input($inputline.text)
			end
			keypress do |k|
				if k == "\n"
					$connection.input($inputline.text)
				end
			end
		end
	end
end
end
		

Reply via email to