Skip to content

Field manual / Level editor

object — Objects

Any object by name: whether it exists, enable, disable, delete, its classic_id and class, calling its function. Where Classic writes "this", OG Script writes host.

Summary

object::ExistsTrue if an object with this name exists.
object::IsHereTrue if x is a reference to an object of this location (including a deleted one); false for a reference to an object of another location (§4.2) and for a non-reference.
object::GetNameIDReturns the object's classic_id (heroes: 20 Sullivan, 21 Ovitz, 22 Trantigne, 24 Lucy); "this" is the caller.
object::GetClassThe object's class as the rules name it (in an OpenGorky project, the archetype path: "weapons::riffle", "characters::hornet"), for hooks; "" if the object does not exist.
object::EnableEnables the given object (it is active and visible again).
object::DisableDisables the given object; it stays on the level and can be enabled again.
object::DeleteDisables the given object and marks it deleted.
object::ImpulseStarts a one-shot playback of an active bitmap animation object (a lever, a puff of smoke).
object::CallCalls a function of an object (extra arguments are passed on), including objects of other loaded levels.

Functions

object::Exists(string) → bool

Classic: IsObject

True if an object with this name exists.

object::IsHere(any x) → bool

OpenGorky onlyClassic: IsHere

True if x is a reference to an object of this location (including a deleted one); false for a reference to an object of another location (§4.2) and for a non-reference.

object::GetNameID(string) → int

Classic: GetNameID

Returns the object's classic_id (heroes: 20 Sullivan, 21 Ovitz, 22 Trantigne, 24 Lucy); "this" is the caller. Returns -1 if the object does not exist.

object::GetClass(string) → string

OpenGorky onlyClassic: GetClass

The object's class as the rules name it (in an OpenGorky project, the archetype path: "weapons::riffle", "characters::hornet"), for hooks; "" if the object does not exist.

object::Enable(string) → int

Classic: EnableObject

Enables the given object (it is active and visible again).

object::Disable(string) → int

Classic: DisableObject

Disables the given object; it stays on the level and can be enabled again. Classic Disable() in an actor script is object::Disable(host) (§16.14).

object::Delete(string) → int

Classic: DeleteObject

Disables the given object and marks it deleted.

object::Impulse(string) → int

Classic: ABA_Impulse

Starts a one-shot playback of an active bitmap animation object (a lever, a puff of smoke). Does nothing for other objects.

object::Call(string, string) → any

Classic: GO_RunFun

Calls a function of an object (extra arguments are passed on), including objects of other loaded levels. Returns the function's result or 0.