Results 1 to 4 of 4

Thread: Problem with a few symbols in a Java calculator.

  1. #1
    Join Date
    Nov 2011
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Problem with a few symbols in a Java calculator.

    Hey, i'm trying to make a RuneScape Classic calculator in Simba,

    this is the formula for the RuneScape Classic calculator!(in Java):
    Code:
    public static double combatFormulaRSC(int attack, int strength, int defence, int hitpoints, int prayer, int ranged, int magic)
    
            {
    
                    double combatLevel = ((defence + hitpoints) * 0.25) + ((magic + prayer) * 0.125);
    
                    
    
                    double warrior = (attack + strength) * 0.25;
    
                    double ranger = ranged * 0.375;
    
                    
    
                    return combatLevel + (((ranged * 1.5) > (attack + strength)) ? ranger : warrior);
    
            }
    I understand a bit of the calculator but i'm having a problem with this:
    Code:
      return combatLevel + (((ranged * 1.5) > (attack + strength)) ? ranger : warrior);
    what does the '?' represent in the formula? and the (ranger: warrior) thanks in advance.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    it's a boolean thing, if its true it will call the first function/proc being ranger else it will call warrior

  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Quote Originally Posted by pur3b100d View Post
    it's a boolean thing, if its true it will call the first function/proc being ranger else it will call warrior
    Edit : in simba the code would be

    Simba Code:
    If (combatLevel + (((ranged * 1.5) > (attack + strength))) then
        Ranger;
      else
        Warrior;

  4. #4
    Join Date
    Nov 2011
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Explained well, thanks. +rep

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •