I'm busy teaching myself C++ and thought what would be a better way than to do it with Dark GDK. Well I've run into an interesting problem.
// Doors
if( CamPosX < 2 && CamPosX > -2 )
{
if( CamPosZ < 12 && CamPosZ > 4 )
{
if( DrSt = 2 )
{
dbText ( (200),(100),"E: Open Door");
if( dbKeyState (18) && DrWt < 0 )
{
dbText (200,200,"Check");
DrSt = 1;
DrWt = 60;
}
}
}
}
The problem occurs with the satement if ( DrSt = 2 ). I have DrSt declared as an integer with the initial value 0 and there is no other mention of DrSt in the code. The problem is that as soon as I step into the designated coordinats, DrSt jumps to 2 despite the lack of a DrSt=2 statement. I have a dbText code printing DrSt's value so I can watch it happen. As such all the things that should happen only when DrSt=2 are happening. The best I can tell is that my program decided for this moment that the if statement is slang for 'do this'. Has anyone encountered a similar problem? Once again, I'm new to C++ so I won't be surprised if I'm just doing something stupid.
EDIT: Solved it quick. used = and not ==. Noobie me :-| Admin feel free to delete this.