Global code error

Non-platform specific questions.

Global code error

Postby Rux » Sat Aug 14, 2010 10:39 pm

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?
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Re: Global code error

Postby rykein » Sat Aug 14, 2010 10:47 pm

Don't have the ; after the function declaration.
rykein
 
Posts: 63
Joined: Mon Jul 26, 2010 7:26 am
Score: 6 Give a positive score

Re: Global code error

Postby Rux » Sat Aug 14, 2010 11:07 pm

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.
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest