Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how can I use 2 If statements in 1 function?
Author Message
Magasztos Offline
Junior Member

Posts: 49
Joined: Jun 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
JMFStorm Offline
Member

Posts: 205
Joined: Aug 2011
Reputation: 28
Post: #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 all posts by this user Quote this message in a reply
Magasztos Offline
Junior Member

Posts: 49
Joined: Jun 2012
Reputation: 0
Post: #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 Tongue


(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 all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #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 all posts by this user Quote this message in a reply
JMFStorm Offline
Member

Posts: 205
Joined: Aug 2011
Reputation: 28
Post: #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 all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #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 all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,236
Joined: Jul 2011
Reputation: 216
Post: #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
Visit this user's website Find all posts by this user Quote this message in a reply
Magasztos Offline
Junior Member

Posts: 49
Joined: Jun 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)