Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: help please D:  (Read 9768 times)

tiodiego

  • Newbie
  • *
  • Posts: 15
  • Quake 3 lover!
    • View Profile
    • Umriagplutix
help please D:
« on: July 01, 2009, 06:29:54 pm »

hey guys, I've been trying to learn ASL, and after reading some examples I wanted to take practice, so I tried to recreate Tyson Collins cone script, using the same method (I think xD!), but the script button isn't even showing in anim8or xd, and I have no idea about where the problem might be D:! I hope someone can explain me the problem xP, so here it is:

Quote
/*script para formar un cono*/

#plugin("object", "mesh", "cono");
#parameter("altura", float, 6.0, 0.1, 500.0, scale, scale_y);
#parameter("radio", float, 6.0, 1.0, 500.0, scale);
#parameter("lados", int, 12, 6, 60);
#return($cono);
#button(31, 31, 2,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000,
0x0000600000, 0x0037a00000, 0x001c200000, 0x0019200000,
0x0026400e00, 0x0002403200, 0x0001806200, 0x000181c200,
0x0003810200, 0x00024e0200, 0x0002300200, 0x0003e80200,
0x0000042200, 0x0000020200, 0x0000010400, 0x000000c800,
0x0000006800, 0x0000001800, 0x0000001800, 0x0000002610,
0x0000004390, 0x00000040e0, 0x00000088f0, 0x0000008118,
0x000000fe0f, 0x0000000000, 0x0000000000);

shape $cono;
int $k;
float $i, $j, $z;
point3 $p;

$z = parameter("altura");
$i = parameter("radio");
$k = parameter("lados");
int $pos[$k];
$j = 360/$k;
$k = 0;
$h = 1;

$cono.Open();
$p.x = 0;
$p.y = $z;
$p.z = 0;
$pos[0]=cono.AddPoint($p);

while($k<=360){
   $p.x = $i*cos($k);
   $p.y = 0;
   $p.z = $i*sin($k);
   $pos[$h]=$cono.AddPoint($p);
   $k = $k + $j;
   $h = $h + 1;
              }

while($h+1>=0){
   $cono.OpenFace(0,0);
   $cono.VertexN($pos[0]);
   $cono.VertexN($h);
   $cono.VertexN($h-1);
   $h = $h - 1;
   $cono.CloseFace();
        }

$cono.Close();


I hope the problem isn't something INCREDIBLY newbie x__D!
my condolences if that is the case. ::)

and thanks in advance!
« Last Edit: July 01, 2009, 07:01:39 pm by tiodiego »
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: help please D:
« Reply #1 on: July 01, 2009, 09:00:42 pm »

First thing,you have to do is read the Anim8or debugging window.

It says:error on line 26 integer constant expected

int $pos[$k];

You can't declare the size of an array as a variable $k.It has to be a constant.
Problem is you don't know the size,so lets declare it like this:
int $pos[0];

To add the values,you will use the push function.
$pos.push(cono.AddPoint($p));
instead of
$pos[0]=cono.AddPoint($p);

And then,you try again.It will show you another error and
you try to correct it.And so on until there's no more syntax
error.Then, you debug the logic if it's not doing what you expect.

Logged

tiodiego

  • Newbie
  • *
  • Posts: 15
  • Quake 3 lover!
    • View Profile
    • Umriagplutix
Re: help please D:
« Reply #2 on: July 01, 2009, 11:37:53 pm »

Thanks a lot Claude :D!! you were right about the use of the debugging window (I had it turn off xD, never thought I was gonna use it ::)) and the push tip was an important one. Now it works  :P
...my first script <:_D

Quote
/*script para formar un cono*/

#plugin("object", "mesh", "cono");
#parameter("altura", float, 6.0, 1, 999.0, scale, scale_y);
#parameter("radio", float, 6.0, 1.0, 999.0, scale);
#parameter("lados", int, 12, 3, 300);
#return($cono);
#button(31, 31, 2,
0x0000000000, 0x0000000000, 0x0000000000, 0x0000000000,
0x0000600000, 0x0037a00000, 0x001c200000, 0x0019200000,
0x0026400e00, 0x0002403200, 0x0001806200, 0x000181c200,
0x0003810200, 0x00024e0200, 0x0002300200, 0x0003e80200,
0x0000042200, 0x0000020200, 0x0000010400, 0x000000c800,
0x0000006800, 0x0000001800, 0x0000001800, 0x0000002610,
0x0000004390, 0x00000040e0, 0x00000088f0, 0x0000008118,
0x000000fe0f, 0x0000000000, 0x0000000000);

shape $cono;
int $h, $h2;
float $i, $j, $k, $z, $pi;
point3 $p;
$pi=3.14159265;

$z = parameter("altura");
$i = parameter("radio");
$j = parameter("lados");
int $pos[1];
$j = 2*$pi/$j;
$k = 0;

$cono.Open();
$p.x = 0;
$p.y = $z;
$p.z = 0;
$pos[0]=$cono.AddPoint($p);

while($k<2*$pi){
   $p.x = $i*cos($k);
   $p.y = 0;
   $p.z = $i*sin($k);
   $h = $pos.push($cono.AddPoint($p));
   $k = $k + $j;
              }
$h2=$h;
while($h>1){
   $cono.OpenFace(0,0);
   $cono.VertexN($pos[0]);
   $cono.VertexN($pos[$h]);
   $cono.VertexN($pos[$h-1]);
   $h = $h - 1;
   $cono.CloseFace();
       }
$cono.OpenFace(0,0);
$cono.VertexN($pos[0]);
$cono.VertexN($pos[$h]);
$cono.VertexN($pos[$h2]);
$cono.CloseFace();

$cono.Close();

thanks a lot for the help :)
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: help please D:
« Reply #3 on: July 02, 2009, 02:42:12 am »

Congratulations on your first script.
Always glad to help.

Bye
Claude
Logged