Results 1 to 7 of 7
  1. #1
    1010010011010101101001
    Austin .'s Avatar
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
    Gamer IDs

    PSN ID: x-CrimsoN-x21

    Contact info:

    Youtube Channel: http://www.youtube.com/user/xCrimmYx?feature=mhee

    Default Multiple If's in js?

    Well my syntax is going to be bad, but is something like this possible?

    choiceIsTrue
    Alert ( 'lets get started!' );

    If(value == true);
    {
    Thread choiceIsTrue
    }
    Else( value == false);
    {
    Alert ( 'fine then' )
    }

    I'm just making a script for my site. If you'd like, I can post what I have when I get home (I'm on tapatalk, like usual.)

    0 Not allowed! Not allowed!

    1v1 (as of June) :
    Wins: 2 Losses: 0
    We accept the love we think we deserve.

  2. #2
    Curret n3wbit
    Russ's Avatar
    Join Date
    Aug 2011
    Location
    California
    Posts
    3,193
    Points
    3,398
         User Info     Contact     Gamer ID
    Join Date
    Aug 2011
    Location
    California
    Posts
    3,193
    Points
    3,398
    Gamer IDs

    Gamertag: SSRunts PSN ID: DCCoexist Steam ID: dcrunts

    Default

    that looks like it would work

    0 Not allowed! Not allowed!

    "Sense is not made like money, sense is had like heart, pride, and integrity."~Russ

  3. #3
    Robot Universe Owner
    Creator of DarkFrost
    demon450's Avatar
    Join Date
    Apr 2010
    Location
    New York
    Posts
    2,714
    Points
    6,203
         User Info     Contact     Gamer ID
    Join Date
    Apr 2010
    Location
    New York
    Posts
    2,714
    Points
    6,203
    Gamer IDs

    Gamertag: Medius450 PSN ID: Medius1337

    Contact info:

    Youtube Channel: http://www.youtube.com/user/Roceso1337

    Default

    its case sensative, so its just all lowercase
    also its else if*
    you also need to learn to put the ; in the right places
    so:
    Code:
    var choiceIsTrue;//assuming you are trying to define it
    alert ( 'lets get started!' );
    
    if(value == true)
    {
    Thread choiceIsTrue//whats this? take it out
    }
    else if( value == false)
    {
    alert ( 'fine then' );
    }

    0 Not allowed! Not allowed!
    Check out Darkfrost
    Check out Robot Universe






  4. #4
    1010010011010101101001
    Austin .'s Avatar
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
    Gamer IDs

    PSN ID: x-CrimsoN-x21

    Contact info:

    Youtube Channel: http://www.youtube.com/user/xCrimmYx?feature=mhee

    Default

    Told you my syntax would be bad I wanted to make it so that if choice is true, start a new if statement, without it looking super sloppy.

    0 Not allowed! Not allowed!

    1v1 (as of June) :
    Wins: 2 Losses: 0
    We accept the love we think we deserve.

  5. #5
    Robot Universe Owner
    Creator of DarkFrost
    demon450's Avatar
    Join Date
    Apr 2010
    Location
    New York
    Posts
    2,714
    Points
    6,203
         User Info     Contact     Gamer ID
    Join Date
    Apr 2010
    Location
    New York
    Posts
    2,714
    Points
    6,203
    Gamer IDs

    Gamertag: Medius450 PSN ID: Medius1337

    Contact info:

    Youtube Channel: http://www.youtube.com/user/Roceso1337

    Default

    in that case do the following, but idk the return values so you might have to debug it
    Code:
    var choiceIsTrue;//assuming you are trying to define it
    choiceIsTrue=prompt ( 'lets get started!' );
    
    if(choiceIsTrue == 0)
    {
    //do something
    }
    else if( choiceIsTrue == 1)
    {
    //do something else
    }

    0 Not allowed! Not allowed!
    Check out Darkfrost
    Check out Robot Universe






  6. #6
    1010010011010101101001
    Austin .'s Avatar
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
    Gamer IDs

    PSN ID: x-CrimsoN-x21

    Contact info:

    Youtube Channel: http://www.youtube.com/user/xCrimmYx?feature=mhee

    Default

    But that's not it... unless I'm reading it wrong. I want it to have an if in an if statement... so its like:

    If( choiceistrue == 1)
    {
    /*then somehow run a whole new set of instructions... I.e.:

    Say ( 'now you guess' )
    If( guess == x)
    Say ( 'you win!' )
    elseif (guess != x)
    Say try again
    */
    }
    Elseif( choiceistrue != 1)
    {
    Say ( 'No hard feelings' )
    }

    If, you understand that mess. Lol. Sorry, I'm at the instacare with my dad so I'm trying to make it quick.

    0 Not allowed! Not allowed!

    1v1 (as of June) :
    Wins: 2 Losses: 0
    We accept the love we think we deserve.

  7. #7
    Nooblet angrymasteryoda's Avatar
    Join Date
    Mar 2010
    Posts
    6
    Points
    9
         User Info     Contact     Gamer ID
    Join Date
    Mar 2010
    Posts
    6
    Points
    9
    Gamer IDs

    Steam ID: angrymasteryoda

    Default

    try this on for size
    work on your indenting it really helps to see where your statements end and start
    Code:
    if(choiseIsTrue == 1){
    	//then run these
    	alert ("now you guess");
    	if(guess==x){
    		alert ("you win");
    	}
    	else if(guess != x){
    		alert ("try again");
    	}
    }
    //else if is not really needed here you can you use a simple 
    //else{
    //	alert("No hard feelings")
    //}
    else if(choiceIsTrue!=1){
    	alert("No hard feelins");
    }

    0 Not allowed! Not allowed!
    I is here

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 06:59 PM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.