Difference between revisions of "ISInterface:AddCommand"

From Lavish Software Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 +
==Syntax==
 +
*bool AddCommand(char *Command, fLSCommand Function, bool Parse=true, bool Hidden=false)
 
== Purpose ==
 
== Purpose ==
 
+
Adds a [[LavishScript:Commands|LavishScript Command]]
 
== Usage ==
 
== Usage ==
 
=== Parameters ===
 
=== Parameters ===
 +
*char *Command
 +
:'''[in]''' Name of the '''Command'''
 +
*[[ISXDK:LSCommand|fLSCommand]] Function
 +
:'''[in]'''Function the '''Command''' executes
 +
*bool Parse=true
 +
:'''[in]'''Optional setting to have any data sequences parse immediately
 +
*bool Hidden=false
 +
:'''[in]'''Optional setting to hide the '''Command' from the command list
 
=== Return Value ===
 
=== Return Value ===
 
+
Returns true on success, false on failure
 
== Examples ==
 
== Examples ==
 +
;Example Code
 +
void ISXTest::RegisterCommands()
 +
{
 +
        pISInterface->AddCommand("ISXTest",CMD_ISXTest,true,false);
 +
}
 +
 +
int __cdecl CMD_ISXTest(int argc, char *argv[])
 +
{
 +
        printf("ISXTest Sample Command");
 +
        pISInterface->ExecuteCommand("Display");
 +
        pISInterface->ExecuteCommand("Wireframe on");
 +
        pISInterface->ExecuteTimedCommand(10000,"Wireframe off");
 +
        pISInterface->ExecuteTimedCommand(10500,"echo weeee");
 +
 +
        return 1;
 +
}
  
 
== See Also ==
 
== See Also ==

Revision as of 23:15, 1 September 2005

Syntax

  • bool AddCommand(char *Command, fLSCommand Function, bool Parse=true, bool Hidden=false)

Purpose

Adds a LavishScript Command

Usage

Parameters

  • char *Command
[in] Name of the Command
[in]Function the Command executes
  • bool Parse=true
[in]Optional setting to have any data sequences parse immediately
  • bool Hidden=false
[in]Optional setting to hide the Command' from the command list

Return Value

Returns true on success, false on failure

Examples

Example Code
void ISXTest::RegisterCommands()
{
       pISInterface->AddCommand("ISXTest",CMD_ISXTest,true,false);
}

int __cdecl CMD_ISXTest(int argc, char *argv[])
{
       printf("ISXTest Sample Command");
       pISInterface->ExecuteCommand("Display");
       pISInterface->ExecuteCommand("Wireframe on");
       pISInterface->ExecuteTimedCommand(10000,"Wireframe off");
       pISInterface->ExecuteTimedCommand(10500,"echo weeee");

       return 1;
}

See Also