VERY weird problem!

Non-platform specific questions.

VERY weird problem!

Postby sonicfire » Wed Nov 15, 2006 6:57 pm

(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: )
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby makslane » Wed Nov 15, 2006 7:23 pm

In C you need to put variable declarations before any command.
So, put the code Actor*tmpac; after {
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby sonicfire » Thu Nov 16, 2006 10:14 am

Ahhh, makes sense - as i said - dont have much C knowledge! Have to learn further! Thanks very much again!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest