Page 1 of 1

VERY weird problem!

PostPosted: Wed Nov 15, 2006 6:57 pm
by sonicfire
(maybe because i dont have that much C++ knowledge :oops: )

This one:
Code: Select all
if (dice_result == 6)
{
    Actor*tmpac;
    tmpac = getactor(x,y);

    allow_key_a = 0;
    PlaySound2("data/snd_granted.wav", 1.000000, 1, 0.000000);
    CreateActor("playerring", "selectring2", "(none)", "(none)", 0, 18, 0);

}


...works!

This one:
Code: Select all
if (dice_result == 6)
{
    allow_key_a = 0;
    PlaySound2("data/snd_granted.wav", 1.000000, 1, 0.000000);
    CreateActor("playerring", "selectring2", "(none)", "(none)", 0, 18, 0);

    Actor*tmpac;
    tmpac = getactor(x,y);
}


...does not! (???)
"Unexpected Declaration CreateActor"
Huh?

:shock: The only difference is that i placed the Actor*AndSoOn code after the playsound and createactor commands.

Why does this make a difference?
(Forgive me if i´m stupid :lol: )

PostPosted: Wed Nov 15, 2006 7:23 pm
by makslane
In C you need to put variable declarations before any command.
So, put the code Actor*tmpac; after {

PostPosted: Thu Nov 16, 2006 10:14 am
by sonicfire
Ahhh, makes sense - as i said - dont have much C knowledge! Have to learn further! Thanks very much again!