On Mon, Apr 4, 2011 at 10:09 AM, Bert Freudenberg bert@freudenbergs.dewrote:
On 04.04.2011, at 15:20, Steve Thomas wrote:
How can I detect if a player variable is a book object? (sometimes it is hard to click on the book and if you get another object and try to run the script an exception is thrown).
(var costume *class* isKindOf: BookMorph) ifTrue: [...]
So I got this code to work (simple test where I "croak" if book and "chomp" if Not): script1 (self getMyPlayer costume isKindOf: BookMorph) ifTrue: [self beep: 'croak'] ifFalse: [self beep: 'chomp']
But when I add the word class it does NOT croak even if I have the player set to a bookMorph script1 (self getMyPlayer costume *class* isKindOf: BookMorph) ifTrue: [self beep: 'croak'] ifFalse: [self beep: 'chomp']
So I assume the above is okay.
Stephen