From: ashbb Date: 2012-04-30T14:25:37+09:00 Subject: Re: Wrappng up my Text Game! Need Help! --90e6ba2121f78a9f0d04bedeae44 Content-Type: text/plain; charset=ISO-8859-1 Hi Jared, > undefined method 'reincarnation' for Map:Class About this error, Eric has already answered. But wait a little bit before you go ahead. ;-) I think you need to know the following two things about Shoes. 1st: Try out this snippet. class Test def hello para 'hello' end end Shoes.app do Test.new.hello end Yeah,.. it doesn't work well. You'll get an error "undefined method 'para' for (Test):Test" on the Shoes Console window. The following is one of solutions. class Test def initialize app @app = app end def hello @app.para 'hello' end end Shoes.app do Test.new(self).hello end 2nd: Try out another snippet. Shoes.app do def test_run stack do timer(5){para 'first'} timer(3){para 'second'} timer(1){return 'third'} # line 6 end end ret = test_run # line 9 para ret end You'll see the output: (Shoes::Stack) second first Because, timer() method forks a new thread, but doesn't wait for the thread to end. And you'll get an error on Shoes Console Window: Unexpected retrun Because, when Shoes executes the line 6: "return 'third'", the test_run method at line 9 has already ended. > I wanted the nice GUI interface to pop up. Fantastic! I think Shoes is a good choice! Although there are a few specific behaviors for GUI programming. ;-) Let's have fun with Shoes, ashbb --90e6ba2121f78a9f0d04bedeae44 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Jared,

> undefined method 'reincarnation' for Map:Clas= s
About this error, Eric has already answered.

But wait a little = bit before you go ahead. ;-)
I think you need to know the following two = things about Shoes.

1st: Try out this snippet.

class Test
=A0 def hello
=A0=A0= =A0 para 'hello'
=A0 end
end

Shoes.app do
=A0 Test.= new.hello
end

Yeah,.. it doesn't work well.
You'll ge= t an error "undefined method 'para' for (Test):Test" on t= he Shoes Console window.

The following is one of solutions.

class Test
=A0 def initial= ize app
=A0=A0=A0 @app =3D app
=A0 end
=A0 def hello
=A0=A0=A0 = @app.para 'hello'
=A0 end
end

Shoes.app do
=A0 Test= .new(self).hello
end


2nd: Try out another snippet.

Shoes.app do
=A0 def= test_run
=A0=A0=A0 stack do
=A0=A0=A0=A0=A0 timer(5){para 'first= '}
=A0=A0=A0=A0=A0 timer(3){para 'second'}
=A0=A0=A0=A0= =A0 timer(1){return 'third'} # line 6
=A0=A0=A0 end
=A0 end
=A0 ret =3D test_run=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 # line 9
=A0 para ret
end

You'll see the o= utput: (Shoes::Stack) second first

Because, timer() method forks a n= ew thread, but doesn't wait for the thread to end.

And you'll get an error on Shoes Console Window: Unexpected retrun<= br>
Because, when Shoes executes the line 6: "return 'third'= ;", the test_run method at line 9 has already ended.

> I wan= ted the nice GUI interface to pop up.
Fantastic!
I think Shoes is a good choice!
Although there are a few s= pecific behaviors for GUI programming. ;-)

Let's have fun with S= hoes,
ashbb

--90e6ba2121f78a9f0d04bedeae44--