Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 32

Thread: Would like to use a script to input Math functions...

  1. #21
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    okay I made ability.html:

    Code:
    <html>
    <head>
    <title>Ability Check!</title>
    </head>
    <body>
    <p>&nbsp;</p>
    <form method="POST" action="ability_calculator.jsp">
    <p><font color="#800000" size="5">Enter Effort Value:</font><input type="text" name="eff" size="20"></p>
    <p><font color="#800000" size="5">Enter Base Stat:</font><input type="text" name="bas" size="20"></p>
    <p><font color="#800000" size="5">Enter Individual Value:</font><input type="text" name="ind" size="20"></p>
    <p><font color="#800000" size="5">Enter Level:</font><input type="text" name="lev" size="20"></p>
    <p><font color="#800000" size="5">Enter Personality:</font><input type="text" name="per" size="20"></p>
    <p><input type="submit" value="Submit" name="B1"></p>
    </form>
    </body>
    </html>
    When I enter values and click submit I get this:

    Code:
    rg.apache.jasper.JasperException: Unable to compile class for JSP
    
    An error occurred at line: 20 in the jsp file: /ability_calculator.jsp
    Generated servlet error:
    Syntax error, insert ")" to complete MethodInvocation
    
    An error occurred at line: 20 in the jsp file: /ability_calculator.jsp
    Generated servlet error:
    Syntax error, insert ";" to complete Statement
    
    An error occurred at line: 20 in the jsp file: /ability_calculator.jsp
    Generated servlet error:
    Syntax error on token ")", delete this token
    Ideas??
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #22
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    HOLY CRAP!

    I did it!

    OMG! I DID IT!

    and guess what... just like always it was a damn carriage return... All I did was delete the space and carriage return at the VERY bottom, and brought the %> up next to the last ) and it works!!!


    TWEY! THANK YOU!!! This is AWESOME!!!!

    so... C+, java, php or perl... it was a 3 way choice.. which do I learn first????
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #23
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This works nicely for me:
    Code:
    <HTML>
    <HEAD>
    <TITLE>Ability Calculator</TITLE></HEAD>
    <BODY BGCOLOR="#FDF5E6">
    <%!
     double CalculateAbility( double effortValue, double baseValue,
            double individualValue, double level, double personality )
       {
            double quarterEffort = Math.floor( effortValue / 4 );
            double doubleBase = baseValue * 2;
            double levelValue =
                    ( doubleBase + individualValue + quarterEffort ) * level;
            double levelPercentage = levelValue / 100;
            double personalityValue =
                    Math.floor( ( levelPercentage + 5 ) * personality );
    
            return personalityValue;
       }
    %>
    <% if(request.getParameter("eff") == null) { %>
    <form action="?" method="post">
      <label>Effort:
        <input type="text" name="eff" size="3">
      </label>
      <label>Base:
        <input type="text" name="bas" size="3">
      </label>
      <label>Individual:
        <input type="text" name="ind" size="3">
      </label>
      <label>Level:
        <input type="text" name="lev" size="3">
      </label>
      <label>Personality:
        <input type="text" name="per" size="3">
      </label>
      <input type="submit" value="go" size="3">
    </form>
    <% } else { %>
    Personality value for values given:  <%= CalculateAbility(
      Double.parseDouble(request.getParameter("eff")),
      Double.parseDouble(request.getParameter("bas")),
      Double.parseDouble(request.getParameter("ind")),
      Double.parseDouble(request.getParameter("lev")),
      Double.parseDouble(request.getParameter("per"))
    ) %>
    <% } %>
    </BODY>
    </HTML>
    so... C+, java, php or perl... it was a 3 way choice.. which do I learn first????
    I recommend Java Depends what you plan to be doing, though, really. Java's a good starting point for just about everything, though.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #24
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Twey
    I recommend Java Depends what you plan to be doing, though, really. Java's a good starting point for just about everything, though.

    Well, 85% of my time is spent on my website, which is mostly basic HTML, being a riddle/puzzle/game site

    10% of my time is spent in Flash and ActionScript (which is very similar to PHP)

    3% of my time I am at work (and NOT on the computer, running my forums and chat rooms)

    and 2% is sleeping, eating, sh**/shower/shave, playing games, and writing screenplays...

    I don't really have a need for the computer languages, EXCEPT of course to have an idea like today, and to be able to sit down and do it without having to ask for step by step help. (Which I GREATLY appreciate you doing with me)

    I want to learn them all, and I don't need to be an expert, just have a good understanding.

    I heard Java was the hardest though, is this not true?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #25
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Here is a quick (hopefully) Q and A for you Twey (or anyone)...

    My webhost is currently not using any jsp/servelet apps. They are looking into it as many customers are demanding it.

    So, now that I have this wonderful script and I can run it fine from home, is there anyway to tweak it so it works with php, or something else my web host can support, so that perhaps I can make a page on my site where ANYONE can find the ability points of their player?

    If you haven't guessed by now, this script is used to figure out the hidden values that go into the math formula for leveling up an RPG character.

    Dragon Quest, Pokemon, Sword Coast and others use it (Final Fantasy still uses the table method) Anyway, my RPG that I am building uses this math based method, and it would be great if I could make a web page that players could use to "fine tune" their Characters, instead of just doing the ol' kill 'em all and level up.

    Thanks for the help!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. #26
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I want to learn them all, and I don't need to be an expert, just have a good understanding.
    Wrong attitude. You'll go much further being an expert in one language than knowing the basics in twenty, especially if that language is one you can use to do just about anything, such as Java.
    I heard Java was the hardest though, is this not true?
    Well, I've heard people say that Java is a real bear to wrestle with, but it was my first (and still my favourite) language, and I've had no problems with it, though it took me a few tries to grasp. Be warned, though: using Java will force you to learn how to use OOP.
    is there anyway to tweak it so it works with php?
    So I could've translated it in the first place.

    Code:
    <html>
      <head>
        <title>Ability Calculator</title>
        <style type="text/css">
          body {
            background-color: #fdf5e6;
            color: black;
          }
        </style>
      </head>
      <body>
    <?php
     function CalculateAbility( $effortValue, $baseValue,
            $individualValue, $level, $personality )
       {
            $quarterEffort = floor( $effortValue / 4 );
            $doubleBase = $baseValue * 2;
            $levelValue =
                    ( $doubleBase + $individualValue + $quarterEffort ) * $level;
            $levelPercentage = $levelValue / 100;
            $personalityValue =
                    floor( ( $levelPercentage + 5 ) * $personality );
    
            return $personalityValue;
       }
    ?>
    <?php if(!isset($_POST['eff'])) { ?>
        <form action="?" method="post">
          <label>Effort:
            <input type="text" name="eff" size="3">
          </label>
          <label>Base:
            <input type="text" name="bas" size="3">
          </label>
          <label>Individual:
            <input type="text" name="ind" size="3">
          </label>
          <label>Level:
            <input type="text" name="lev" size="3">
          </label>
          <label>Personality:
            <input type="text" name="per" size="3">
          </label>
          <input type="submit" value="go" size="3">
        </form>
    <?php } else { ?>
    Personality value for values given:  <?php echo(CalculateAbility(
      $_POST['eff'],
      $_POST['bas'],
      $_POST['ind'],
      $_POST['lev'],
      $_POST['per']
    )); ?>
    <?php } ?>
      </body>
    </html>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #27
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Twey
    So I could've translated it in the first place.
    Well, you could've READ...

    Quote Originally Posted by VERY FIRST POST!
    what I would like is something (php?) where it asks me for the 3 variables in a text box, then when I hit the submit button, it enters the numbers I have input and runs the calculation, and displays the result.


    Thank you for the php though, I will put it up and test it soon as I finish the FC upgrade

    ~BLiZZ
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #28
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Well, you could've READ...
    Hah, true.
    the FC upgrade
    Oh good.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #29
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    HOLY CRAP! You didn't tell me FC5 had 5 iso discs, LMAO!!!

    I guess I could have done the dvd, but I didn't want to tie up my laptop. I have decided I am going to wipe the harddrive and do a complete fresh install. I don't have any new programs on my FC3 drive except a couple games I never play and netbeans, which I can get again...

    Should be a fun weekend though, I love geeking my wife out when I do things like this with my computer... she sits on the couch and rolls her eyes at me.... fun.

    The php script works PERFECT! Thanks again for that! AND it includes new functions I haven't used before, so it is something else I can pick apart! COOL!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. #30
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    HOLY CRAP! You didn't tell me FC5 had 5 iso discs, LMAO!!!
    Only one more than 32-bit FC4; same number as 64-bit FC4
    it includes new functions I haven't used before
    What, floor()?
    she sits on the couch and rolls her eyes at me.... fun.
    Haha, same with the girlfriend. I'm a geek, she's a barbarian.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •