Home > Archive > Ruby > August 2005 > Error with a not useful message.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Error with a not useful message.
|
|
| OxO pHz.60 2005-08-31, 7:00 pm |
| hi when i try to run this ruby script (a mud client for angalon) y get the
following error
rorschach@pirata ~/Sources/ainamc $ ruby ainamc.rb
ainamc.rb:125: syntax error
Gtk.main
^
i have no idea what the error might be, i with post all code here:
require 'gtk2'
require 'net/telnet'
class Mud
attr_accessor :host, :port, :mud
def initialize( host, port = 23 )
@host = host
@port = port
end
def add_mud( host , port )
if @host != nil
@mud = Net::Telnet::new( { "host" => @host , "port" => @port } )
end
end
end
#todo: poner todo lo referente a la gui en bajo la clase gui.
Gtk.init
#Widget Definitions
main_window = Gtk::Window.new
vbox = Gtk::VBox.new( false, 0)
hbox = Gtk::HBox.new( true , 0)
scroll = Gtk::ScrolledWindow.new
output = Gtk::TextView.new
input = Gtk::Entry.new
button_connect = Gtk::Button.new( "Connect" , use_underline=false )
button_disconnect = Gtk::Button.new( "Disconnect" , use_underline=false)
scroll.set_policy( Gtk::POLICY_NEVER , Gtk::POLICY_AUTOMATIC )
#need to chomp input every n lines so window doesn't expand on its own.
scroll.add( output )
main_window.add( vbox )
vbox.pack_start( hbox , false , false , 0 )
hbox.pack_start( button_connect , true , true , 0 )
hbox.pack_start( button_disconnect , true , true , 0 )
vbox.pack_start( scroll , true , true, 0 ) #output or scroll
vbox.pack_start( input , false , false, 0 )
output.editable = false
output.set_wrap_mode(Gtk::TextTag::WRAP_WORD)
#Signals
main_window.signal_connect("delete_event") { Gtk.main_quit
false
}
input.signal_connect("activate") do output.buffer.insert(
output.buffer.end_iter, input.text + "\n")
angalon.mud.puts( input.text )
output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
input.text=""
end
begin
button_connect.signal_connect("clicked") {
angalon = Mud.new( "angalon.tamu.edu <http://angalon.tamu.edu>" , 3011 )
angalon.add_mud
}
button_disconnect.signal_connect("clicked") do
angalon.mud.close()
end
main_window.set_default_size( 512, 512 )
main_window.show_all
Gtk.idle_add{
output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
}
Gdk::Input.add( mud , Gdk::Input::READ ) {
data = angalon.mud.recv( 32 )
data = angalon.mud.preprocess( data )
output.buffer.insert( output.buffer.end_iter , data )
output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
}
Gtk.main
--
Rorschach el Pirata
I eat pokemon with scars
| |
| Robert Klemme 2005-08-31, 7:00 pm |
| OxO pHz.60 wrote:
> hi when i try to run this ruby script (a mud client for angalon) y
> get the following error
>
> rorschach@pirata ~/Sources/ainamc $ ruby ainamc.rb
> ainamc.rb:125: syntax error
> Gtk.main
> ^
Without further looking at this I guess you forgot a closing "end",
bracket or brace. Try throwing this at an editor with autoindention and
see what happens.
Kind regards
robert
| |
| David Roberts 2005-08-31, 7:00 pm |
| OxO pHz.60 wrote:
> hi when i try to run this ruby script (a mud client for angalon) y get the
> following error
>
> rorschach@pirata ~/Sources/ainamc $ ruby ainamc.rb
> ainamc.rb:125: syntax error
> Gtk.main
> ^
>
Might it be that your Ruby installation does not have the
Gtk libraries available?
> i have no idea what the error might be, i with post all code here:
>
> require 'gtk2'
> require 'net/telnet'
>
> class Mud
>
> attr_accessor :host, :port, :mud
>
> def initialize( host, port = 23 )
> @host = host
> @port = port
> end
>
> def add_mud( host , port )
> if @host != nil
> @mud = Net::Telnet::new( { "host" => @host , "port" => @port } )
> end
> end
>
> end
>
> #todo: poner todo lo referente a la gui en bajo la clase gui.
> Gtk.init
>
>
> #Widget Definitions
> main_window = Gtk::Window.new
> vbox = Gtk::VBox.new( false, 0)
> hbox = Gtk::HBox.new( true , 0)
>
> scroll = Gtk::ScrolledWindow.new
> output = Gtk::TextView.new
> input = Gtk::Entry.new
>
> button_connect = Gtk::Button.new( "Connect" , use_underline=false )
> button_disconnect = Gtk::Button.new( "Disconnect" , use_underline=false )
>
> scroll.set_policy( Gtk::POLICY_NEVER , Gtk::POLICY_AUTOMATIC )
>
> #need to chomp input every n lines so window doesn't expand on its own.
> scroll.add( output )
>
> main_window.add( vbox )
> vbox.pack_start( hbox , false , false , 0 )
>
> hbox.pack_start( button_connect , true , true , 0 )
> hbox.pack_start( button_disconnect , true , true , 0 )
>
> vbox.pack_start( scroll , true , true, 0 ) #output or scroll
> vbox.pack_start( input , false , false, 0 )
> output.editable = false
> output.set_wrap_mode(Gtk::TextTag::WRAP_WORD)
>
> #Signals
> main_window.signal_connect("delete_event") { Gtk.main_quit
> false
> }
>
> input.signal_connect("activate") do output.buffer.insert(
> output.buffer.end_iter, input.text + "\n")
> angalon.mud.puts( input.text )
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> input.text=""
> end
>
> begin
> button_connect.signal_connect("clicked") {
> angalon = Mud.new( "angalon.tamu.edu <http://angalon.tamu.edu>" , 3011 )
> angalon.add_mud
> }
>
> button_disconnect.signal_connect("clicked") do
> angalon.mud.close()
> end
>
> main_window.set_default_size( 512, 512 )
> main_window.show_all
>
> Gtk.idle_add{
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> }
>
> Gdk::Input.add( mud , Gdk::Input::READ ) {
> data = angalon.mud.recv( 32 )
> data = angalon.mud.preprocess( data )
> output.buffer.insert( output.buffer.end_iter , data )
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> }
>
> Gtk.main
>
>
> --
> Rorschach el Pirata
> I eat pokemon with scars
| |
| Joe Van Dyk 2005-08-31, 7:00 pm |
| On 8/31/05, OxO pHz.60 <pirata@gmail.com> wrote:
> hi when i try to run this ruby script (a mud client for angalon) y get th=
e
> following error
Your last 'begin' statement has no 'end' statement. That's the start
of the problems, anyways.
>=20
> rorschach@pirata ~/Sources/ainamc $ ruby ainamc.rb
> ainamc.rb:125: syntax error
> Gtk.main
> ^
>=20
> i have no idea what the error might be, i with post all code here:
>=20
> require 'gtk2'
> require 'net/telnet'
>=20
> class Mud
>=20
> attr_accessor :host, :port, :mud
>=20
> def initialize( host, port =3D 23 )
> @host =3D host
> @port =3D port
> end
>=20
> def add_mud( host , port )
> if @host !=3D nil
> @mud =3D Net::Telnet::new( { "host" =3D> @host , "port" =3D> @port } )
> end
> end
>=20
> end
>=20
> #todo: poner todo lo referente a la gui en bajo la clase gui.
> Gtk.init
>=20
>=20
> #Widget Definitions
> main_window =3D Gtk::Window.new
> vbox =3D Gtk::VBox.new( false, 0)
> hbox =3D Gtk::HBox.new( true , 0)
>=20
> scroll =3D Gtk::ScrolledWindow.new
> output =3D Gtk::TextView.new
> input =3D Gtk::Entry.new
>=20
> button_connect =3D Gtk::Button.new( "Connect" , use_underline=3Dfalse )
> button_disconnect =3D Gtk::Button.new( "Disconnect" , use_underline=3Dfal=
se )
>=20
> scroll.set_policy( Gtk::POLICY_NEVER , Gtk::POLICY_AUTOMATIC )
>=20
> #need to chomp input every n lines so window doesn't expand on its own.
> scroll.add( output )
>=20
> main_window.add( vbox )
> vbox.pack_start( hbox , false , false , 0 )
>=20
> hbox.pack_start( button_connect , true , true , 0 )
> hbox.pack_start( button_disconnect , true , true , 0 )
>=20
> vbox.pack_start( scroll , true , true, 0 ) #output or scroll
> vbox.pack_start( input , false , false, 0 )
> output.editable =3D false
> output.set_wrap_mode(Gtk::TextTag::WRAP_WORD)
>=20
> #Signals
> main_window.signal_connect("delete_event") { Gtk.main_quit
> false
> }
>=20
> input.signal_connect("activate") do output.buffer.insert(
> output.buffer.end_iter, input.text + "\n")
> angalon.mud.puts( input.text )
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> input.text=3D""
> end
>=20
> begin
> button_connect.signal_connect("clicked") {
> angalon =3D Mud.new( "angalon.tamu.edu <http://angalon.tamu.edu>" , 3011 =
)
> angalon.add_mud
> }
>=20
> button_disconnect.signal_connect("clicked") do
> angalon.mud.close()
> end
>=20
> main_window.set_default_size( 512, 512 )
> main_window.show_all
>=20
> Gtk.idle_add{
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> }
>=20
> Gdk::Input.add( mud , Gdk::Input::READ ) {
> data =3D angalon.mud.recv( 32 )
> data =3D angalon.mud.preprocess( data )
> output.buffer.insert( output.buffer.end_iter , data )
> output.scroll_to_iter( output.buffer.end_iter , 0 , false , 0 , 0 )
> }
>=20
> Gtk.main
>=20
>=20
> --
> Rorschach el Pirata
> I eat pokemon with scars
>=20
>
|
|
|
|
|