Frictional Games Forum (read-only)

Full Version: how can I use 2 If statements in 1 function?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
well the name really kind of explains everything so if anyone could help me It would be very nice,
Thanks in advance


-Imre
Here's one example from my mod:

if(GetLocalVarInt("Book1Pulled") == 1 and GetLocalVarInt("Book3Pulled") == 0){
SetLocalVarInt("Book1and2PulledInRightOrder", 1);
}

I guess this should get you started.
(07-22-2012, 01:07 PM)JMFStorm Wrote: [ -> ]Here's one example from my mod:



if(GetLocalVarInt("Book1Pulled") == 1 and GetLocalVarInt("Book3Pulled") == 0){

SetLocalVarInt("Book1and2PulledInRightOrder", 1);

}



I guess this should get you started.



Thanks alot this will get me started as u said :p


(when I first read it I was like "omg this is the guy tht made followed by death!!!?!")
(07-22-2012, 01:07 PM)JMFStorm Wrote: [ -> ]Here's one example from my mod:

if(GetLocalVarInt("Book1Pulled") == 1 and GetLocalVarInt("Book3Pulled") == 0){
SetLocalVarInt("Book1and2PulledInRightOrder", 1);
}

I guess this should get you started.
should you really write and? don't you need to write &&?
(07-22-2012, 05:07 PM)SilentStriker Wrote: [ -> ]should you really write and? don't you need to write &&?

Yeah. I'm not certain about this but it also might be possible. Just have a try out.
You should use &&.
Alternatively, you can put an if inside an if.
(07-22-2012, 05:07 PM)SilentStriker Wrote: [ -> ]should you really write and? don't you need to write &&?

and is a reserved keyword and would work the same way as &&. For those who want a more human-readable source code, and would be more desirable than &&.
ya, thing is I tried to do this but I'm probably doing it wrong besides that I still have no idea how if/else statements work (it's a miracle that the 1st one worked)