Log in

View Full Version : Really not getting this, simple code, cannot see whats wrong...



Wolygon
05-08-2011, 12:07 PM
Hey, I am having this problem and I really have no idea how it is happening. The code is below (note its just an example):

procedure test;

var
NPC1, NPC2 : TNPC;

begin
NPC1 := GetNPC(4690);
NPC2 := GetNPC(4689);
WriteLn('NPC 1 is ' + IntToStr(NPC1.ID));
WriteLn('NPC 2 is ' + IntToStr(NPC2.ID));
Wait(100);
if (NPC1.ID = 4690) and (NPC2.ID = 4089) then WriteLn('Both found')
else WriteLn('Both not found, < 1 present');
end;

It outputs this:


NPC 1 is 4690
NPC 2 is 4689
Both not found, < 1 present

So the debug shows that the IDs are equal to what I ask in the if statement yet the if statement fails. Really not getting how this is wrong...

*hopes it isn't something really noob*

Hope you can help, thanks.

KingKong
05-08-2011, 12:16 PM
Um, in your if statement you check for Id 4690 and 4089(instead of 4689), i think you made a typo

Wolygon
05-08-2011, 12:31 PM
*facepalm* :duh:

And here I was thinking the physics of the if statement was failing me.

I checked it so many times, I guess I'm not good at proofreading.

Thanks, I should be back on track, a little more humble though :(