Torque script's experience on torque Engine 1)

Source: Internet
Author: User

1) each object in torque is either a simobject object or a subclass object of simobject.

2) console function also called method, which is different from other common functions because the first parameter of method is the handle of the object that called the function (console function is different from other functions, the first parameter is the handle of the called object)

3) if the parameter is not enough, torque automatically sets the parameter not provided to a null string. If the parameter is greater than the maximum parameter, torque ignores more parameters.

4) There are three types of objects in torque: 1. Id. This ID is unique. 2. Name. This name can be repeated. 3 handle and this handle are also unique. The object creation syntax is as follows:

% Handle = new objecttype (Name: copysource, arg1 ...... Argn ){}

5) You can use dump () to obtain all the methods of the object. The specific method is

% Object = new simobject ();

% Object. Dump ();

Echo (% object. GETID ());

6) You can directly add member variables and methods to the existing class as follows:

% OBJ = new simobject ();

% Obj. Miss = "miss ";

Echo (% obj. Miss );

Function simobject: Hello ()

{

Echo ("hello ");

}

7) datablocks is actually equivalent to a class in C ++ or a struct in C. Its role is to save a set of fixed data, this set of data templates is used to create the corresponding objects. Once a data block is created, it will not be deleted. The specific creation syntax is as follows:

Datablock classidentifer (nameidentifier)

{

// Classidentifier indicates the name of an existing data block class, And nameidentifier indicates the name of the data block to be created.

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.