Object

class Object

Defined in System.sc.

The base class used for all SCI Objects. It provides some basic operations like asking if an object supports a particular selector, or if an object is subclass of a given class.

Subclasses: Sound, Code, IconItem, Game, Block, Messager, Control, Feature, Cycle, SysWindow, Script, Sync, Print, Motion, MessageObj, ClickMenu, Polygon, File, Timer, TimeOut, Flags, Cue, Region, Event, User, Collection, Cursor.

Properties

Defined in Object:

Property Description
name  

Methods

new()

Returns a clone of itself

init()
doit()
dispose()
showStr(buffer)

Copies the object’s name into the provided buffer.

showSelf()

Prints the object’s name on the screen.

perform(object [...])

Calls the doit method on object with itself as the first parameter, and forwarding any additional supplied parameters.

Parameters:object (heapPtr) – Any object with a doit method.
isKindOf(className)

Determines if this object is a particular class, or inherits from that class.

Parameters:className (class) – A class name, such as Actor or Room
Returns:TRUE is this object is of type className, or inherits from className.
isMemberOf(theClass)
Parameters:theClass (class) – A class, like MoveTo or Feature.
Returns:TRUE if this object is an instance of this exact class, otherwise FALSE.

Example usage:

(if (gThing isMemberOf: MoveTo)
        ; Do something...
)
respondsTo(selectorName)
Parameters:selectorName (selector) – A property or method selector.
Returns:TRUE if this object has selectorName as a property or method.

Example usage:

(if (theThing respondsTo: #doit)
        (theThing doit:)
)
yourself()

Returns the object itself. This is a convenient shortcut when you want to call a series of selectors on a new object and then pass that object directly to a function:

// Create a new polygon and add it to the room obstacles.
(gRoom addObstacle: ((Polygon new:):
                type: PBarredAccess
                points: somePoints
                size: 4
                dynamic: TRUE
                yourself:
                                                ))