- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Class
        nhmkdev edited this page Jan 15, 2014 
        ·
        4 revisions
      
    Class on a data object is a setting for specifying the underlying code for processing a given action.
In the sample below is a Dialog that uses the class objects.debugmenu to provide a simple debug menu. ig.global is prepended to the value to link the dialog and the given object up. A new object is not created in any case. The existing ig.global.? is used directly. The first option in the menu allows the player to increase their points by 100. This is achieved by using the ca and cav fields.
Dialogs.DebugMenu = 
{
    s:
    {
	base:dialogsBaseSettings,
	c:'objects.debugmenu', // 'ig.global' is prepended to this
	win:
	[
	    Windows.dialogbg
	]        
    },
    sa:
    [
	{
	    n:'main',
	    t:'DEBUG MENU',
	    o:
	    [
		{
		    t:'Add 100 points',
		    ca:'adjustpoints', // function to call on the class object
		    cav: { p:100 }, // input object to pass to the function
		    ns:'main'
		},
	    ]
	}
    ]
};    
In the actual debug menu code file the function being called is defined as follows:
DebugMenu.prototype.adjustpoints = function(actionVar)
{
	if(Util.defined(actionVar) && Util.defined(actionVar.p))
	{
		Save.incFlag('i', 'pt', actionVar.p);
	}
}