Difference between revisions of "MPUZ: Object Variables"

From Mario Fan Games Galaxy Wiki
m
m
Line 1: Line 1:
 
{{MPUZ}}
 
{{MPUZ}}
'''Objects''' in [[MPUZ]] have a list of variables that are used to store various information. Following is a list of those variables, which are generally accessed using ''me.VAR'':
+
'''Objects''' in [[MPUZ]] have a list of variables that are used to store various information. Following is a list of those variables, which are generally accessed like ''[[MPUZ: Generic Terms|selector]].sysid'':
 
+
===Variables and Object Structure===
*'''sysid''': the object's unique ID value, which allows it to be accessed individually.
+
Note, the values of these variables are examples only.
*'''objid''': a string which identifies what kind of object the object is, such as "MP_Block" or "MP_Mario".
+
<nowiki>object = {
*'''linkid''': a value which this object may share with others; this value is used for the ''trigger'' function.
+
    sysid = 1,
*'''x''' and '''y''': the object's X and Y coordinates, respectively; specifically, these refer to the current image's designated hotspot coordinates, which are not necessarily at the upper-left. 
+
    objid = "MP_OBJECT",
*'''x_left''' and '''x_right''': the X coordinates of the object's leftmost and rightmost edges, respectively.
+
    linkid = 0,
*'''y_top''' and '''y_bottom''': the Y coordinates of the object's topmost and bottommost edges, respectively.
+
    --
*'''x_center''' and '''y_center''': the center X and Y coordinate of the object, rounded down if needed.
+
    x = 0,
*'''dir''': the current direction of the object (separate from its angle). Starting at ''0'' for right, ''90'' for up, ''180'' for left, and ''270'' for down. Generally objects will move in this direction, but this is not guaranteed.
+
    y = 0,
*'''angle''': the current angle in which the object will be drawn onscreen, but does not affect the object's actual direction; it is a float that ranges from [0, 360), going counterclockwise with 0 pointing "right" (though your object image may not display this).
+
    xleft = 0,
*'''prop1''' through '''prop5''': strings which store the values of the 5 property values, if used.
+
    xright = 0,
 +
    ytop = 0,
 +
    ybottom = 0,
 +
    xscale = 0,
 +
    yscale = 0,
 +
    angle = 0,
 +
    direction = 0,
 +
    alpha = 0,
 +
    prop1 = "",
 +
    prop2 = "",
 +
    prop3 = "",
 +
    prop4 = "",
 +
    prop5 = "",
 +
    sys = { },
 +
    cust = { },
 +
    plugin = { },
 +
}
 +
</nowiki>
  
 
These are not the only variables which the engine may store in an object, but these are so-called "standard" variables which all objects will have.
 
These are not the only variables which the engine may store in an object, but these are so-called "standard" variables which all objects will have.
  
 
Within these tutorials, a subtable ''cust'' will be used to store custom variables that are unique to a single object, such as ''me.cust.health''. MPUZ itself may store various other variables in the ''sys'' subtable; which variables these are depends upon certain aspects of the object code (such as variables used by [[MPUZ: Modules|modules]]). Speaking of modules, activated modules use their own table, ''mod'', to specify when they are activated.
 
Within these tutorials, a subtable ''cust'' will be used to store custom variables that are unique to a single object, such as ''me.cust.health''. MPUZ itself may store various other variables in the ''sys'' subtable; which variables these are depends upon certain aspects of the object code (such as variables used by [[MPUZ: Modules|modules]]). Speaking of modules, activated modules use their own table, ''mod'', to specify when they are activated.
 +
===Events===
 +
''Triggered''
 +
*'''onCreate( ''OBJECT'' caller)''': called after the object is first created. For any object, this is the first event ever to be called. '''caller''' is a reference to the object that called this event, or a reference to the [[MPUZ: Null Object|Null Object]] if something other than another object called the event.
 +
*'''onDestroy( ''OBJECT'' caller)''': called before the object is destroyed. This is always the last event called for objects. '''caller''' is, again, the calling object, or the Null Object.
 +
''Continuous''

Revision as of 16:03, 15 May 2009

This information is subject to change.
MPUZ
Mpuz logo.png
Development Main Page
Basics
Intermediate
Advanced
  • none
Reference
[Edit]


Objects in MPUZ have a list of variables that are used to store various information. Following is a list of those variables, which are generally accessed like selector.sysid:

Variables and Object Structure

Note, the values of these variables are examples only.

object = {
    sysid = 1,
    objid = "MP_OBJECT",
    linkid = 0,
    --
    x = 0,
    y = 0,
    xleft = 0,
    xright = 0,
    ytop = 0,
    ybottom = 0,
    xscale = 0,
    yscale = 0,
    angle = 0,
    direction = 0,
    alpha = 0,
    prop1 = "",
    prop2 = "",
    prop3 = "",
    prop4 = "",
    prop5 = "",
    sys = { },
    cust = { },
    plugin = { },
}

These are not the only variables which the engine may store in an object, but these are so-called "standard" variables which all objects will have.

Within these tutorials, a subtable cust will be used to store custom variables that are unique to a single object, such as me.cust.health. MPUZ itself may store various other variables in the sys subtable; which variables these are depends upon certain aspects of the object code (such as variables used by modules). Speaking of modules, activated modules use their own table, mod, to specify when they are activated.

Events

Triggered

  • onCreate( OBJECT caller): called after the object is first created. For any object, this is the first event ever to be called. caller is a reference to the object that called this event, or a reference to the Null Object if something other than another object called the event.
  • onDestroy( OBJECT caller): called before the object is destroyed. This is always the last event called for objects. caller is, again, the calling object, or the Null Object.

Continuous