AINE: Accelerated Interactive Narrator Engine
  • Download
  • References
  • Games
  • Wiki
  • Facebook Twitter
  • Name

    else

  • Examples

    Player: {
    maxLife: 50
    maxMana: 20
    life: 50
    mana: 20
    gold: 40

    classes: ["Warrior","Mage","Rogue"]

    Event: Game_Start {
    // Declares new properties on player and assigns initial values to them

    this.str = floor(rand(0,5))
    this.agi = floor(rand(0,5))
    this.will = floor(rand(0,5))
    this.luck = floor(rand(0,5))

    // If the total value of player strength, agility and will is less than 6 (average),
    // increase luck by one
    // Else if luck is higher than 3 (above average), decrease it by one

    if (str + agi + will < 6)
    luck++
    else if (luck > 3)
    luck--

    this.class = classes[floor(rand(0,3))]
    // Assigns a random class from the list of classes to player

    // Changes the player properties according to the assigned class

    if (class == "Warrior"){
    str++
    maxLife += 10
    life = maxLife
    }
    else if (class == "Rogue"){
    will++
    gold += 40
    }
    else{
    will++
    maxMana += 5
    mana = maxMana
    }
    }
    }
  • Description

    Extends the if statement with another code block that will be read if the if statement is false.
  • Syntax

    • if (expression) { statements } else { statements }
    • if (expression) { statements } else if (expression) { statements } else { statements }
  • Related

    • ?: (conditional)

    • if

  • Contact
  • Terms of Use
  • GitHub
  • Drakkashi.com

The copyright of all images rendered by me goes to their respective owners.
© 2008 Daniel Svejstrup Christensen