Frictional Games Forum (read-only)
how can I use 2 If statements in 1 function? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: how can I use 2 If statements in 1 function? (/thread-17186.html)



how can I use 2 If statements in 1 function? - Magasztos - 07-22-2012

well the name really kind of explains everything so if anyone could help me It would be very nice,
Thanks in advance


-Imre


RE: how can I use 2 If statements in 1 function? - JMFStorm - 07-22-2012

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.


RE: how can I use 2 If statements in 1 function? - Magasztos - 07-22-2012

(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!!!?!")


RE: how can I use 2 If statements in 1 function? - SilentStriker - 07-22-2012

(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 &&?


RE: how can I use 2 If statements in 1 function? - JMFStorm - 07-22-2012

(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.


RE: how can I use 2 If statements in 1 function? - Obliviator27 - 07-22-2012

You should use &&.
Alternatively, you can put an if inside an if.


RE: how can I use 2 If statements in 1 function? - Your Computer - 07-23-2012

(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 &&.


RE: how can I use 2 If statements in 1 function? - Magasztos - 07-23-2012

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)