Difference between revisions of "OBJf"

From SimsWiki
Jump to: navigation, search
(Introduction)
Line 8: Line 8:
 
Each [[OBJD]] resource in an object will have an OBJf resource with a matching instance value. The OBJf resource contains all the object functions.
 
Each [[OBJD]] resource in an object will have an OBJf resource with a matching instance value. The OBJf resource contains all the object functions.
  
[[Image:OBJfInSimPE.JPG|frame|Editing Object Functions]]There are quite a number of object functions, although most of the time you will find that you use very few of them. Each of these has an Action BHAV and a Guardian BHAV in a similar way to Pie-Menu functions. When the object function is run using Run Functional Tree, there is a "test only" option which runs the Guardian instead of the Action BHAV.
+
[[Image:OBJfInSimPE.JPG|frame|Editing Object Functions]]There are quite a number of object functions, although most of the time you will find that you use very few of them. Each of these has an Action BHAV and a Guardian BHAV in a similar way to Pie-Menu functions. When the object function is run using [[0x0014|Run Functional Tree]], there is a "test only" option which runs the Guardian instead of the Action BHAV.
  
 
<br clear="all"/>
 
<br clear="all"/>

Revision as of 12:20, 15 February 2010

4F424A66
Short name: OBJf
Long name: Object Functions

Contents

Introduction

Each OBJD resource in an object will have an OBJf resource with a matching instance value. The OBJf resource contains all the object functions.

Editing Object Functions
There are quite a number of object functions, although most of the time you will find that you use very few of them. Each of these has an Action BHAV and a Guardian BHAV in a similar way to Pie-Menu functions. When the object function is run using Run Functional Tree, there is a "test only" option which runs the Guardian instead of the Action BHAV.


init

The init tree is called whenever an object is reset. This happens when the object is first being placed, and if "Reset" is chosen after an object error.

This is one of the ones you will likely always use.

main

The main tree is the initial point of entry for the object's main simulation. Parameters may be passed to main if the "create object" primitive specifies.

This is one of the ones you will always use, even if only to have an Idle instruction pointing back at itself.

load

The load tree is called whenever an instance of the object is loaded from a save file. It is only called if the "object version" instance variable is different from the corresponding variable in the object definition.

cleanup

The cleanup tree is called whenever an object is about to be deleted, or if a person's interaction with the object had to be aborted.

queue skipped

The queue skipped tree is called if an interaction in a person's queue was deleted for any reason.

allow intersection

This tree is a last resort hook for object intersection tests. If all the normal intersection tests pass, this tree is called to determine if two objects are allowed to intersect. Parameter 0 is the id of the object that is being tested.

wall adjacency changed

This tree is called whenever the wall configuration around an object changed. At that time, the "wall adjacency flags" instance variable will indicate the new configuration.

room changed

This tree is called whenever the room id of an object changes. At this time, the "room id" instance variable will contain the new room id.

dynamic multi-tile update

If this function is defined for a multi-tile object, the object is "dynamic". This means that any time one is placed, it is joined with any neighboring objects. When the joining takes place, this tree is called for each object in the multi-tile group.

placement

This tree is called any time the position of an object changes.

pickup

This tree is called when an object is removed from the world, either to be deleted or to be re-placed in the world.

user placement

This tree is called when the user clicks to place an object.

user pickup

This tree is called just before an object is picked up by the user.

level info request

This tree is called when the "level info" button is pressed. May not be used in final game.

serving surface

This tree is used by people who are looking for a place to drop food.

portal

If this tree is defined for a portal object, then the object may be used to transfer a person from one room to another. If two such objects are part of the same multi-tile group and lie in different rooms, then a person will push the tree to go between the rooms.

gardening

If this tree is defined, then the gardener will use it to take care of the plants.

wash hands

This tree is used by any person looking to wash hands.

prep

This tree is used a person who is trying to prepare food.

cook

This tree is used by any person trying to cook food.

surface

This tree is used by a person who is looking for a surface on which to place an object.

dispose

This tree is used by a person looking to throw away an object.

food

This tree is used to eat an object. It is only used by the fridge to transfer control of the person to the food after it is created.

pickup from slot

This tree is used by a person to pick up an object.

wash dish

This tree is used by a person who is looking to wash a dish.

eating surface

This tree is used by a person who wants to find a surface suitable for eating.

sit

This tree seats a person. If the tree is defined, the game considers the object to be a chair.

stand

If a person is sitting and contained in an object, this tree must be defined so that the person may stand up.

clean

This tree is used by the maid to clean objects.

repair

This tree is used by the repair man to repair objects.

ui event

This tree is called in the current situation object when an event in the user interface occurs. The first parameter is the type of the event. The second parameter is the id of the event.

Restock

Used by OfB employees/business owners to restock certain items. Example can be seen on the bookshelf. (Was previously labeled as Dry Clothes)

Wash Clothes

Start Live Mode

This is called when ever live mode is reentered. It is not called after a simple pause.

Stop Live Mode

This is called when ever live mode is left. It is note called for a simple pause.

Link Objects

This tree is called so that the object can set links to the previous and next objects in a doubly-linked list of objects. The first parameter is the ID of the previous object in the chain or -1 if this is the first object. The second parameter is the ID of the next object in the chain or -1 if this is the last object.

Message Handler

This tree is called when the object receives a broadcast message from the message primitive.

Pre Route

This tree handles the transition from the idle-neutral pose, to the locomotion neutral pose if they are different at the beginning of a route. An example is of a toddler changing from sitting to crawling pose brefore routing.

Post Route

This tree handles the transition from the locomotion neutral pose, to the idle-neutral pose if they are different at the end of a route. An example is of a toddler changing from crawling to a sitting pose brefore routing.

Goal Check

This tree checks if the routing goal is still available. Its called on the object that issues the goto command. For example if a sim is trying to route to a seat, and another sim gets there false, this call can return false, allowing the sim to stop and choose another seat.

Reaction Handler

This tree is called from a message handler tree, if the message receiver decides to actually handle the message.

Along Route Callback

This tree is called on the sim once per tile along the route, and can interupt it by returning false. This tree can be used to run idles while the sim is routing.

awareness

This tree is used by objects to advertise that they are interesting things to look at.

reset

Called when object is reset on loading of lot. This should never happen in shipped game.

lookatTarget

Called to choose objects to lookat along a route

Walk Over

When an object is walked over, this tree gets called.

Utility State Change

When a utility changes state, this tree gets called.

Set Model by Type

Called to change the model based on a type defined in the game code. The first parameter holds the model 'type'. e.x. Modular stair railing types: None | Left | Right | Both

Get Model Type

Called to get the model type as defined by the game code. e.x. Modular stair railing types: None | Left | Right | Both

delete

Called before an object is killed.

user delete

Called before an object is "deleted" or "sold" by the player, even if the object is not immediately killed.

Just Moved In

Called on objects that have been created by moving in a sim that have objects they own from another lot.

prevent place in slot

Called on container object during placement test for placing in a slot; return true to prevent placement even when all other tests pass.

Global Awareness

Added to make Paul B's life easier.

Object Updated by Design Mode

Called when Design mode updates an object, so we can set the correct state on it.

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox