Results 1 to 3 of 3

Thread: Maxscript editor tutorial and tips

  1. #1
    Join Date
    Apr 2010
    Posts
    206

    Maxscript editor tutorial and tips

    Introduction

    Overview of MAXScript

    MAXScript is a high-level language object-oriented and very simple syntax. It is designed for 3D Studio MAX users unfamiliar with programming. Its variables are untyped and there is no distinction between uppercase and lowercase letters.
    This language does not need compiler. All instructions are carried out at runtime.
    We can use 3D Studio MAX MAXScript and at the same time. You can create a cube in MAXScript and then modify it in 3D Studio.
    Some examples of use of this language can be:


    • Creating complex scenes interactively would be too complicated to implement.
    • Creating batch tools.
    • Generation of new features to facilitate a particular task.
    • Using nearly all the features of 3D Studio MAX.
    • Creating new panels and windows with utilities for 3D Studio MAX.

    How to access MAXScript

    MAXScript is in the tool pane.

    This panel is a shade of profits, and within it you can press the button MAXScript






    Once you've opened the shutters of MAXScript can access the options: Open listener, new script, open script, running script and close.


    • Listener Open: Open MAXScript Listener window. If you click this option and the listener is minimized, or hidden behind another window, restored. If you close and reopen it, it retains the text he had before closing.


    • New script: Open an editor in a new window, where you can write a new script in MAXScript
    • Open script: Clicking this option opens a dialog box for opening files in which the user has to choose a script in MAXScript. Once chosen, the script will open a MAXScript Editor window with the contents of file.
    • Run script: The user selects a script in MAXScript and this is read and executed. The output can be, depending on the type of script, where viewers 3D Studio MAX or in the MAXScript Listener window.
    • Utilities: Sample script utilities available.
    • Close: Closes the MAXScript utility.

    Using the MAXScript listener

    The listener can execute commands and expressions. To execute, simply type the command or expression and press the ENTER key.
    We can move by the listener like a normal editor. You can also cut, copy and paste the selected text (CTRL-X CTRL-C, CTRL-V) and edit new commands within text, or modify and then we had already run.
    To execute commands within text, after editing a new line, has been pressing the ENTER key on the keypad, or press SHIFT - ENTER. The results are shown in the same window, under the command or commands are executed.

    It is possible to run blocks of code pre-selected and by pressing SHIFT - ENTER or by pressing ENTER from the keypad.
    Include instruction inserts the contents of the file "filename" in the listener without executing. You can select the text and run it in pieces. We can work with MAXScript listener and 3D Studio MAX at the same time.
    Last edited by Head-Hunter; 11-05-2010 at 01:20 AM.

  2. #2
    Join Date
    Apr 2010
    Posts
    206

    Re: Maxscript editor tutorial and tips

    Variables in MAXScript

    The variables are used to store data that vary during program execution. In MAXScript is not necessary to declare variables before using
    We have two kinds of variables in MAXScript:

    Local variables:

    Those are considered local variables used for the first time within a block or function. Otherwise, the variables are considered global.
    They are visible only in the block or function where they are declared.
    Its value is maintained while running the function or block where they are.

    Global variables:

    Are visible throughout MAXScript code.
    Can access them from different utilities, functions, etc. Its value remains until it gets out of 3D Studio MAX.

    The first time you use the MAXScript variable initialized as "undefined."
    To make the code more clear, you should indicate the class are the variables. To do this, use the terms "local" and "global." Note that comments are preceded MAXScript two dashes "- -".

    local x = 2, m = 3.7
    local y, z, r
    global text = "Hello"
    global i = 1, - The statement continues on the following lines
    j = 3
    k = sin (35)
    local t = g = h = 0
    In the declaration of variables, we can define whether they are global or local, but do not indicate what type they are. This is because the variables are free to type. The variables can change the type of value assignments. For example, a first allocation in a variable can be an integer, and a second assignment, the variable can be a string of characters. This does not mean that improper operation can be made. If we try to make them, MAXScript will fail. To convert one type of variable use in other types of instruction "as" as follows:

    Notice in the picture below that the outputs of command in the listener always blue, except for errors.


    Mathematical operations in MAXScript

    When we introduce a mathematical operation on MAXScript, it evaluates the operation and displays the result in the listener window. MAXScript has the mathematical operations necessary to make that functions like a calculator.

    Mathematical expressions are composed of operators and operands (+,-,*...). A mathematical operator can be:

    A variable name, numbers, etc. .. For example:

    • 1 + 3 - Add both numbers
    • Total - 5 - 5 Sum the value of the variable "Total"
    • Total + VAT - Adds the value of the variable "Total" plus the value of the variable "taxes"


    A call to a function. For example

    • (ARadians degrees: 180) + 5 - Call the "Radians" parameter passing as 180 degrees and the outcome adds 5.


    A mathematical expression. For example:

    • 123 + (Total - taxes) - Subtract the contents of the variable "taxes" to the content of "Total" and we add the value 123.


    You can also use the abbreviated form of the C language mapping to modify a value contained in a variable. For example:

    Abbreviated format allocation

    x + = 5 - Increases in the value of x 5
    and * = 7 - Multiply by 7 and the value of
    z - = 9 - 9 Subtract the value of z
    k = 8 - k Divide 8
    Last edited by Head-Hunter; 11-05-2010 at 01:21 AM.

  3. #3
    Join Date
    Apr 2010
    Posts
    206

    Re: Maxscript editor tutorial and tips

    Objects in 3D Studio MAX MAXScript

    MAXScript can work with 3D Studio MAX objects while working with it interactively through the buttons and panels. In fact, objects can be created, processed, modified and deleted from MAXScript like that is made from 3D Studio MAX.

    The object creation commands match the names of these objects. We can create a box just by typing in the command window box listener (), or if you have the version, the Spanish equivalent box (). Once written, and after pressing the ENTER key, you create a box with default settings.

    It is immaterial whether we write the command in uppercase and lowercase, as MAXScript does not distinguish between them. It is also recommended assigning the object to a variable, more manageable for the use of that object. If the object created is not assigned to any variable we want to refer to it using the symbol "$" before the noun that is the object in the scene.

    When we use the Box command with parameters, removed the brackets, and instead put the parameter names followed by the colon and its value. The parameters are ignored acquire its default value.

    When MAXScript has created the box returns the name that has the box in the scene and at the same time indicates the position to have the new box in the scene (with coordinates x, y , z separated by commas within brackets). MAXScript draw the box in the scene. You can work with the new box from 3D Studio MAX as if it were created interactively. We can transform, edit, delete and even undo the creation of the box with the "rollback."

    We can modify all parameters of the object (height, radius, etc. ..), node (name, color, etc ...) and transformation (rotation, position, etc). To modify a value in an object using one of the following schemes:

    showclassid

    To know the names and types of parameters of an object can be used showclassid function (). If we write in the MAXScript listener only the function name followed by the two brackets will have a list of all objects in 3DStudio MAX and its parameters. Each parameter is followed by its type.
    You usually want to know the parameters of an object without leaving all objects in 3D Studio MAX. We have two examples in the following box.

    Examples of showclassid showclassid "box .*" - Shows all the parameters of the class box
    Box (Box): GeometryClass (10.0)
    . Height (Height): float
    . Length (Length): float
    . Lengthsegs: integer
    . Width (Width): float
    . Widthsegs: integer
    . MapCoords: boolean
    . Heightsegs (SegmsAltura): integer
    OK

    Showclassid "Box.height" - Displays all the parameter data height
    Box (Box): GeometryClass (10.0)
    . Height (Height): float
    OK

    In the first example indicated with an asterisk we want to know all the parameters of the object Box. We use the asterisk as a wildcard. If we wanted to know all the parameters of objects beginning with "B" would only need to put showclassid "B *.*" and would get a list with them. If instead we know the parameter but we're not sure what type you have, it will suffice to put showclassid "Box.Numberparameter."
    In the second example of showclassid we found that the parameter "Height" in class "Box" is like "Float."

Similar Threads

  1. Replies: 6
    Last Post: 20-12-2011, 07:04 PM
  2. Silverlight Tutorial
    By SoftWore in forum Guides & Tutorials
    Replies: 2
    Last Post: 07-08-2010, 11:28 AM
  3. Sybase tutorial
    By djbbenn in forum Software Development
    Replies: 2
    Last Post: 01-08-2009, 07:43 PM
  4. Need HQL Tutorial
    By chickens in forum Software Development
    Replies: 3
    Last Post: 31-07-2009, 10:12 PM
  5. Tutorial #2
    By ferrari in forum Guides & Tutorials
    Replies: 9
    Last Post: 02-02-2008, 12:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,917,736.19935 seconds with 17 queries