Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can I use 2 If statements in 1 function?
Magasztos Offline
Member

Posts: 54
Threads: 21
Joined: Jun 2012
Reputation: 0
#1
how can I use 2 If statements in 1 function?

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


-Imre

~The Hulk is always greener on the other side~
07-22-2012, 12:53 PM
Find
JMFStorm Offline
Member

Posts: 205
Threads: 8
Joined: Aug 2011
Reputation: 28
#2
RE: how can I use 2 If statements in 1 function?

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
Find
Magasztos Offline
Member

Posts: 54
Threads: 21
Joined: Jun 2012
Reputation: 0
#3
RE: how can I use 2 If statements in 1 function?

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

~The Hulk is always greener on the other side~
07-22-2012, 01:13 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: how can I use 2 If statements in 1 function?

(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
Find
JMFStorm Offline
Member

Posts: 205
Threads: 8
Joined: Aug 2011
Reputation: 28
#5
RE: how can I use 2 If statements in 1 function?

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

(This post was last modified: 07-22-2012, 06:00 PM by JMFStorm.)
07-22-2012, 05:59 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#6
RE: how can I use 2 If statements in 1 function?

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

07-22-2012, 09:49 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: how can I use 2 If statements in 1 function?

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

Tutorials: From Noob to Pro
07-23-2012, 12:15 AM
Website Find
Magasztos Offline
Member

Posts: 54
Threads: 21
Joined: Jun 2012
Reputation: 0
#8
RE: how can I use 2 If statements in 1 function?

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)

~The Hulk is always greener on the other side~
07-23-2012, 10:02 AM
Find




Users browsing this thread: 1 Guest(s)