georage wrote...
Per FalloutBoy's idea, a creature that is in the area returns a value of 1, a creature that is not there is 0. (from a heartbeat script)
int x=IsObjectValid(GetObjectByTag("gelda")); //=1
int y=IsObjectValid(GetObjectByTag("nobody")); //=0
int x=(!IsObjectValid(GetObjectByTag("gelda"))); //=0
int y=(!IsObjectValid(GetObjectByTag("nobody"))); //=1
since !1 = 0 and !0 = 1, you're results are to be expected.
instead consider this
int x=IsObjectValid(GetObjectByTag("gelda")); //=1
int
y=IsObjectValid(GetObjectByTag("nobody")); //=0
int z=(!IsObjectValid(GetObjectByTag("gelda"))); //=0
int a=(!IsObjectValid(GetObjectByTag("nobody"))); //=1
!x will be 0
!y will be 1
so z will also be 0
and a will be 1
you need to break this down in and start witht he inner most function/method to see what it can return
and then check if all the possible results are valid values for the function containing the it.
So if GetObjectByTag can return something that causes IsObjectValue to mess up, you need to validate that the result from GetObjectByTag is something that you IsObjectValid can handle.
object foo;
int result = 0;
foo = GetObjectByTag("gelda");
// TEST foo, if and then only if it's something IsObjectValid can use call
if ( /* foo is valid for IsObjectValid */ ) result = IsObjectValid(foo);
else /* don't call IsObjectValid */ PrintToLog("not a valid input for IsObjectValid");
as for what IsObjectValid can accept, I don't know, I'll have to refer you to RTFM...
or RTPNEM (PNE = practically non-existent)