Page 1 of 1

Global code error

PostPosted: Sat Aug 14, 2010 10:39 pm
by Rux
Code: Select all
int n, current;
n = rand(5);
void targetChange(); //Variables
{
if (animindex == getAnimIndex("rangetarget1")) //Setcurrent, to prevent same target from appearing.
{
    current = 1;
}
else if (animindex == getAnimIndex("rangetarget2"))
{
    current = 2;
}
else if (animindex == getAnimIndex("rangetarget3"))
{
    current = 3;
}
else if (animindex == getAnimIndex("rangetarget4"))
{
    current = 4;
}
else if (animindex == getAnimIndex("rangetarget5"))
{
    current = 5;
}
else if (animindex == getAnimIndex("rangetarget6"))
{
    current = 6;
}
if(current == 1) //Set target.
{
    if(n==0)ChangeTransparency("target2", 0.000000);
    if(n==1)ChangeTransparency("target3", 0.000000);
    if(n==2)ChangeTransparency("target4", 0.000000);
    if(n==3)ChangeTransparency("target5", 0.000000);
    if(n==4)ChangeTransparency("target6", 0.000000);
    current = 0;
}
else if(current == 2)
{
    if(n==0)ChangeTransparency("target1", 0.000000);
    if(n==1)ChangeTransparency("target3", 0.000000);
    if(n==2)ChangeTransparency("target4", 0.000000);
    if(n==3)ChangeTransparency("target5", 0.000000);
    if(n==4)ChangeTransparency("target6", 0.000000);
    current = 0;
}
else if(current == 3)
{
    if(n==0)ChangeTransparency("target1", 0.000000);
    if(n==1)ChangeTransparency("target2", 0.000000);
    if(n==2)ChangeTransparency("target4", 0.000000);
    if(n==3)ChangeTransparency("target5", 0.000000);
    if(n==4)ChangeTransparency("target6", 0.000000);
    current = 0;
}
else if(current == 4)
{
    if(n==0)ChangeTransparency("target1", 0.000000);
    if(n==1)ChangeTransparency("target2", 0.000000);
    if(n==2)ChangeTransparency("target3", 0.000000);
    if(n==3)ChangeTransparency("target5", 0.000000);
    if(n==4)ChangeTransparency("target6", 0.000000);
    current = 0;
}
else if(current == 5)
{
    if(n==0)ChangeTransparency("target1", 0.000000);
    if(n==1)ChangeTransparency("target2", 0.000000);
    if(n==2)ChangeTransparency("target3", 0.000000);
    if(n==3)ChangeTransparency("target4", 0.000000);
    if(n==4)ChangeTransparency("target6", 0.000000);
    current = 0;
}
else if(current == 6)
{
    if(n==0)ChangeTransparency("target1", 0.000000);
    if(n==1)ChangeTransparency("target2", 0.000000);
    if(n==2)ChangeTransparency("target3", 0.000000);
    if(n==3)ChangeTransparency("target4", 0.000000);
    if(n==4)ChangeTransparency("target5", 0.000000);
    current = 0;
}
}

I have this code in global code, but it won't work, when I use the function it just gives me this error,
"target1 -> Timer (wait1), line 1: Link error: undefined function :-> targetChange"

What's wrong?

Re: Global code error

PostPosted: Sat Aug 14, 2010 10:47 pm
by rykein
Don't have the ; after the function declaration.

Re: Global code error

PostPosted: Sat Aug 14, 2010 11:07 pm
by Rux
I see, it worked. The script editor confused me before, it seemed to tell me to put one of those after the function, when it was probably something else. Thanks.