Probably an easy answer.

Game Editor comments and discussion.

Probably an easy answer.

Postby RippeR7420 » Tue May 28, 2013 9:23 pm

How would I go about doing this:

Code: Select all
        if(P2SQUARECOUNT>P1SQUARECOUNT&&P2SQUARECOUNT>P3SQUARECOUNT&&P2SQUARECOUNT>P4SQUARECOUNT)
        {
            CreateActor("Shoot", "Needs More People", "view", "(none)", 160, 240, false);
        }
        else
        if(P2SQUARECOUNT<P1SQUARECOUNT&&P2SQUARECOUNT>P3SQUARECOUNT&&P2SQUARECOUNT>P4SQUARECOUNT)
        {
            CreateActor("Shoot", "Needs More People", "view", "(none)", 160, 240, false);
        }


This will only tell the engine if P2SQUARECOUNT is greater than the rest or lower than the rest. But I want to be able to check if just P3SQUARECOUNT is higher but the rest are lower etc.. without a huge code..?

is there a way to use "&&" better? like maybe, "||" or "&|"?

what exactly does this "||" mean?

Thanks to anyone that can help me!
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Probably an easy answer.

Postby AliceXIII » Tue May 28, 2013 10:46 pm

|| is a conditional or
as in:
Code: Select all
int i;
if(i=0||i=1||i=2) //if i = 0 or 1 or 2
{
    //put code here
}
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest