Obj

class Obj

Defined in Obj.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, Cycle, Game, IconI, Blk, Messager, Control, Feature, Motion, SysWindow, Script, Print, Sync, MessageObj, ClickMenu, Polygon, File, Timer, TO, Flags, Cue, Rgn, SL, Event, User, Collect, Cursor.

Properties

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 Rm
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 (send 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 (send theThing:respondTo(#doit))
        (send 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.
(send gRoom:addObstacle((send ((Polygon:new())):
                type(PBarredAccess)
                points(somePoints)
                size(4)
                dynamic(TRUE)
                yourself()
                                                )))