General Category > ASL Scripts

Help

<< < (3/4) > >>

Jdez:
This is very interesting to look at! After working myself up I tried to creat a Cube primitive as well. (Attached). It is quite different so any suggestions will be welcome.

By the way If anyone could explain how the button code works(where you create a button) That would be much appreciated as well.

Claude:
If you want to learn scripting,you need the ASL spec
open in your browser at all time so that you can read
the description of each function you encounter.

Here's the relevant section:

#button Directive

A button directive defines an image that Anim8or uses on a toolbar button.  The syntax is:

#button(<width>, <height>, <num-colors>, <data>…);

<width> and <height> are the dimensions of the image.  <num-colors> is the number of colors.  This must be 2.  <data> is a comma separated list of 32 bit decimal or hexadecimal integer constants that define the image.  The data is ordered by row starting at the top of the image.  Each new row starts a new value.

Images with 2 colors are bit-masks.  They use one bit per pixel.  Zeros represent the background color and ones the foreground color.

Here is an example bitmap directive for a 17 pixel wide, 25 pixel high bitmap:

#button(17, 25, 2,
    0x00000fc6, 0x00007079, 0x00008009, 0x00010f89,
    0x00013871, 0x000107e1, 0x0000c003, 0x0000300d,
    0x00000ff9, 0x00007079, 0x00008009, 0x00010f89,
    0x00013871, 0x000107e1, 0x0000c003, 0x0000300d,
    0x00000ff9, 0x00007079, 0x00008009, 0x00010f89,
    0x00013871, 0x000107e1, 0x0000c002, 0x0000300c,
    0x00000ff0);

If something is not clear,just ask.

Tyson Collins made a program to make icons for plug-in buttons.
It's named plugicon, I think.You'll find it on the Scripts page of the site.

Claude:
Here's the mesh,you have created:

--- Code: ---  mesh {
    name { "mesh01" }
    base {
      origin { (-5.1975 -3.0146 0) }
    }
    material { " -- default --" }
    smoothangle { 45 }
    /* 24 points, 6 faces, 24 uvCoords */
    materiallist {
      materialname { " -- default --" }
    }
    points {
      (-19 -19 -19) (19 -19 -19) (19 -19 19) (-19 -19 19) (-19 19 -19)
      (19 19 -19) (19 19 19) (-19 19 19) (-19 -19 -19) (-19 19 -19) (-19 19 19)
      (-19 -19 19) (-19 -19 -19) (-19 19 -19) (19 19 -19) (19 -19 -19)
      (19 -19 -19) (19 19 -19) (19 19 19) (19 -19 19) (-19 19 19) (19 19 19)
      (19 -19 19) (-19 -19 19)
    }
    texcoords {
      (0 1) (1 1) (1 0) (0 0) (0 1) (1 1) (1 0) (0 0) (0 1) (1 1) (1 0) (0 0)
      (0 1) (1 1) (1 0) (0 0) (0 1) (1 1) (1 0) (0 0) (0 1) (1 1) (1 0) (0 0)
    }
    faces {
      4 4 0 -1 ( (0 0) (1 1) (2 2) (3 3) )
      4 4 0 -1 ( (4 4) (5 5) (6 6) (7 7) )
      4 4 0 -1 ( (8 8) (9 9) (10 10) (11 11) )
      4 4 0 -1 ( (12 12) (13 13) (14 14) (15 15) )
      4 4 0 -1 ( (16 16) (17 17) (18 18) (19 19) )
      4 4 0 -1 ( (20 20) (21 21) (22 22) (23 23) )
    }
  }

--- End code ---
It has 24 points and 24 uvCoords.
8 points and 4 uvCoords are enough.
See tiodiego's script to reuse the points by storing the indices.

int $length;
int $width;
int $height;
They should be float.You're rounding values by casting float to integer.

$length,$width and $height should be divided by 2.0 to keep dimensions
correct.

Bottom and 2 sides have reversed normals.See preceeding comment.

Jdez:
Oh right! I thought about dividing it in two but the in the plane script I don't recall it being done so I figured I wouldn't do it. About the button. What I don't understand Is what all the other letters and numbers are for.

#button(17, 25, 2,
    0x00000fc6, 0x00007079, 0x00008009, 0x00010f89,
What is the difference beetween 0x00008009 and 0x00010f89? couldn't it just be 0x11111111 and 0x00000000
    0x00013871, 0x000107e1, 0x0000c003, 0x0000300d,
    0x00000ff9, 0x00007079, 0x00008009, 0x00010f89,
    0x00013871, 0x000107e1, 0x0000c003, 0x0000300d,
    0x00000ff9, 0x00007079, 0x00008009, 0x00010f89,
    0x00013871, 0x000107e1, 0x0000c002, 0x0000300c,
    0x00000ff0);

Thanks for the advice claude

Claude:
He could have use a binary format,but it takes lot of room.
So,he uses an hexadecimal format:
0x indicates that the following characters are hexadecimal.
Each character represents 4 bits(4 zeros or ones).
Example:

--- Code: ---0x0       0       0       0       0        f         c        6
  0000    0000    0000    0000    0000     1111      1100     0110

--- End code ---

Read the first 2 paragraphs and look at the table lower on the right
side.
http://en.wikipedia.org/wiki/Hexadecimal

Hope it helps.
Claude

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version