Ambrosia Garden Archive
    • Quote

      Originally posted by Artanis:
      **looks at javascript
      :eek:
      ...I love actionscripting...

      consults javascript textbook

      Javascript:
      function calculate(ship_strength,ship_crew,escort_strength_a,escort_strength_b,escort_strength_c,
      escort_strength_d,escort_strength_e,escort_strength_f,escort_crew_a,escort_crew_b,
      escort_crew_c,escort_crew_d,escort_crew_e,escort_crew_f,marines_crew,marines_percentage,
      target_strength,target_crew){
      if(escort_strength_a == ""){escort_strength_a=0}
      else{escort_strength_a=eval(escort_strength_a*0.1)};
      if(escort_strength_b == ""){escort_strength_b=0}
      else{escort_strength_b=eval(escort_strength_b*0.1)};
      if(escort_strength_c == ""){escort_strength_c=0}
      else{escort_strength_c=eval(escort_strength_c*0.1)};
      if(escort_strength_d == ""){escort_strength_d=0}
      else{escort_strength_d=eval(escort_strength_d*0.1)};
      if(escort_strength_e == ""){escort_strength_e=0}
      else{escort_strength_e=eval(escort_strength_e*0.1)};
      if(escort_strength_f == ""){escort_strength_f=0}
      else{escort_strength_f=eval(escort_strength_f*0.1)};
      var escort_strength=eval(escort_strength_a+escort_strength_b+escort_strength_c+escort_strength_d+escort_strength_e+escort_strength_f);
      var strength=eval(ship_strength+escort_strength);
      if(escort_crew_a == ""){escort_crew_a=0}
      else{escort_crew_a=eval(escort_crew_a*0.1)};
      if(escort_crew_b == ""){escort_crew_b=0}
      else{escort_crew_b=eval(escort_crew_b*0.1)};
      if(escort_crew_c == ""){escort_crew_c=0}
      else{escort_crew_c=eval(escort_crew_c*0.1)};
      if(escort_crew_d == ""){escort_crew_d=0}
      else{escort_crew_d=eval(escort_crew_d*0.1)};
      if(escort_crew_e == ""){escort_crew_e=0}
      else{escort_crew_e=eval(escort_crew_e*0.1)};
      if(escort_crew_f == ""){escort_crew_f=0}
      else{escort_crew_f=eval(escort_crew_f*0.1)};
      var escort_crew=eval(escort_crew_a+escort_crew_b+escort_crew_c+escort_crew_d+escort_crew_e+escort_crew_f);
      var crew=eval(marines_crew+escort_crew+ship_crew);
      target_crew=eval(target_crew*10);
      target_strength=eval(target_strength*5);
      var sub_odds=eval(crew/target_strength);
      sub_odds=eval(sub_odds*100);
      var odds=eval(sub_odds+marines_percentage);
      if(strength > target_strength){var odds=eval(odds+10)};
      var max_odds=eval(odds+5);
      var min_odds=eval(odds-5);
      if(max_odds > 75){max_odds=75};
      if(min_odds > 75){min_odds=75};
      if(max_odds < 0){max_odds=1};
      if(min_odds < 0){min_odds=1};
      max_odds=max_odds.split(".");
      min_odds=min_odds.split(".");
      document.res_form.minodds.value=min_odds(0);
      document.res_form.maxodds.value=max_odds(0);
      

      So besides the obvious "You're not pasting strings together, you're evaluating mathematic expressions," try that and see if it works.

      (edit: broke the tables)
      (edit2: fixing stupid mistakes. (of mine.))
      (edit3: changed the "/10" to "0.1", which is the same thins, but won't give the "divide by zero" error)*

      In JavaScript, if you paste strings together with an

      eval()
      

      statement and it forms a mathematical equation, it automatically evaluates it and the sum, difference, product, quotient or combination thereof is stored in the variable. You could indeed say variable a + variable b, but the way it is set up, my form sends up strings, not numbers.

      Also, the "division by zero" error won't be a problem. If you check the syntax, it performs that operation if and only if the value is not blank. If it is, it defaults to zero.

      But I'll try your modifications anyway, as soon as I get around to it. 🙂

      ------------------
      The programmer's code of entomology: there's always another bug.
      Microsquash™ Winblows™ users: stop asking for plugins. (url="http://"http://www.aznt.com/EVN/EVNEW/")Make one yourself.(/url)

    • Quote

      Originally posted by orcaloverbri9:
      In JavaScript, if you paste strings together with an

      eval()
      

      statement and it forms a mathematical equation, it automatically evaluates it and the sum, difference, product, quotient or combination thereof is stored in the variable. You could indeed say variable a + variable b, but the way it is set up, my form sends up strings, not numbers.

      Also, the "division by zero" error won't be a problem. If you check the syntax, it performs that operation if and only if the value is not blank. If it is, it defaults to zero.
      (/B)

      That's what I get for talking about something when I don't know much about it.
      Learn new things every day.

      Does it work yet? I'd love to see it.

      ------------------
      "Time flows faster on the sun..." - Me, result of too much free time. But I'd have 'less' on the sun.
      (url="http://"http://www.evula.org/artanis")www.evula.org/artanis(/url) | (url="http://"http://www.evula.org/artanis/EVNOdds.html")EVN Capture Odds Calculator(/url) | (url="http://"http://www.evula.org/artanis/Captaintripps10000.jpg")Oops.(/url)

    • Here's something I threw together that seems to work:

      <HTML>
      <head>
      <title>Test</title>
      <script language="JavaScript">
      <!--
      function Calc()
      {
      var crewtotal = 0;
      if(e1c.value != "") crewtotal += eval(e1c.value);
      if(e2c.value != "") crewtotal += eval(e2c.value);
      if(e3c.value != "") crewtotal += eval(e3c.value);
      if(e4c.value != "") crewtotal += eval(e4c.value);
      if(e5c.value != "") crewtotal += eval(e5c.value);
      if(e6c.value != "") crewtotal += eval(e6c.value);
      crewtotal *= 0.1;
      if(pc.value != "") crewtotal += eval(pc.value);
      if(mc.value != "") crewtotal += eval(mc.value);
      
      var strtotal = 0;
      if(e1s.value != "") strtotal += eval(e1s.value);
      if(e2s.value != "") strtotal += eval(e2s.value);
      if(e3s.value != "") strtotal += eval(e3s.value);
      if(e4s.value != "") strtotal += eval(e4s.value);
      if(e5s.value != "") strtotal += eval(e5s.value);
      if(e6s.value != "") strtotal += eval(e6s.value);
      strtotal *= 0.1;
      if(ps.value != "") strtotal += eval(ps.value);
      
      var ans = parseInt((crewtotal / tc.value) * 10, 10);
      if(mp.value != "") ans += eval(mp.value);
      
      if(strtotal > eval(ts.value) * 5) ans += eval(10);
      
      var ansmin = ans - 5; var ansmax = ans + eval(5);
      
      if(ansmin < 1) ansmin = 1; if(ansmin > 75) ansmin = 75;
      if(ansmax < 1) ansmax = 1; if(ansmax > 75) ansmax = 75;
      
      answer.value = ansmin + "% - " + ansmax + "%";
      }
      // -->
      </script>
      </head>
      <body>
      <table border="0" cellspacing="2" cellpadding="0">
      <tr><td> <td><center>Crew</center><td><center>Strength</center></tr>
      <tr><td>Player<td><input type="text" name="pc" size="4"><td><input type="text" name="ps" size="4"></tr>
      <tr><td>Escort 1<td><input type="text" name="e1c" size="4"><td><input type="text" name="e1s" size="4"></tr>
      <tr><td>Escort 2<td><input type="text" name="e2c" size="4"><td><input type="text" name="e2s" size="4"></tr>
      <tr><td>Escort 3<td><input type="text" name="e3c" size="4"><td><input type="text" name="e3s" size="4"></tr>
      <tr><td>Escort 4<td><input type="text" name="e4c" size="4"><td><input type="text" name="e4s" size="4"></tr>
      <tr><td>Escort 5<td><input type="text" name="e5c" size="4"><td><input type="text" name="e5s" size="4"></tr>
      <tr><td>Escort 6<td><input type="text" name="e6c" size="4"><td><input type="text" name="e6s" size="4"></tr>
      <tr><td>Target<td><input type="text" name="tc" size="4"><td><input type="text" name="ts" size="4"></tr>
      </table><br>
      <table border="0" cellspacing="2" cellpadding="0">
      <tr><td>Marines (+crew)<td><input type="text" name="mc" size="4"></tr>
      <tr><td>Marines (+percent)<td><input type="text" name="mp" size="4"></tr></table>
      <br>
      <input type="button" name="doit" value="Calculate" onclick="Calc();">
      <input type="text" name="answer" value="Answer" size="8">
      </body></HTML>
      

      ------------------
      Get (url="http://"http://www.aznt.com/EVN/EVNEW")EVNEW(/url) - the free, open-source plugin EVN Editor for Windows!

    • Damn, still can't get it to work right...

      Maybe someday I'll retry (keeping original code for formula, of course). But for now, I give up.

      ------------------
      The programmer's code of entomology: there's always another bug.
      Microsquash™ Winblows™ users: stop asking for plugins. (url="http://"http://www.aznt.com/EVN/EVNEW/")Make one yourself.(/url)

    • I like that odds calculator. Who wrote that? It's definatly going into my EV: Nova favorites folder. Now, it only there was a "Data Fiddling for Idiots" file out there...

      ------------------
      -Drew
      ------------------
      It's time for a new Sig! Here goes!
      (url="http://"http://www.ambrosiasw.com/cgi-bin/ubb/search.cgi?action=intro&default;=26")Search. It's what you need.(/url)|(url="http://"http://users.tpg.com.au/adsl4vhb/mining.html")Asteroid Mining Made Easy(/url)|(url="http://"http://home.comcast.net/~slagblah/evn_fixes.html")Slagblah's Quick Fixes(/url)

    • Quote

      Originally posted by fchsjv4:
      **I like that odds calculator. Who wrote that? It's definatly going into my EV: Nova favorites folder. Now, it only there was a "Data Fiddling for Idiots" file out there...

      **

      The Flash one was made by Artani, if that's what you mean.

      The HTML one Aprosenf just threw together? Obviously it was Aprosenf.

      ------------------
      The programmer's code of entomology: there's always another bug.
      Windows users: stop asking for plugins. (url="http://"http://www.aznt.com/EVN/EVNEW/")Make one yourself.(/url)

    • Hey! Look! Someone actually took my suggestion and ran with it! I'm gratified. 🙂

      Seriously, the calculators look good.

      ------------------
      (url="http://"http://www.geocities.com/ue_rd")Fatal Alliance- an upcoming quasi-TC for EVN.(/url)
      Secret Project: Nearing Completion. (No links available)
      Visit the (url="http://"http://www.ambrosiasw.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&number;=20&SUBMIT;=Go")Chronicles(/url) today! Be sure to read the short story ' (url="http://"http://www.ambrosiasw.com/cgi-bin/ubb/newsdisplay.cgi?action=topics &number;=20&forum;=*EV/EVO+chronicles&DaysPrune;=100&article;=000262&startpoint;=")Fiery Descent(/url)'!
      (url="http://"http://www.cwssoftware.com")Sephil Saga(/url): An upcoming TC, visit the web page today.| || Both the best and the worst plug-in editor for Windows! (url="http://"http://www.aznt.com/EVN/EVNEW")EVNEW(/url)!

    • Quote

      Originally posted by fchsjv4:
      **I like that odds calculator. Who wrote that? It's definatly going into my EV: Nova favorites folder. Now, it only there was a "Data Fiddling for Idiots" file out there...

      **

      bows

      Thank you / You're welcome
      Glad I could help.

      Random thought:
      "The programmer's code of entomology: there's always another bug."
      Corollary:
      There's always another feature to add."
      ------------------
      "Time flows faster on the sun..." - Me, result of too much free time. But I'd have 'less' on the sun.
      (url="http://"http://www.evula.org/artanis")www.evula.org/artanis(/url) | (url="http://"http://www.evula.org/artanis/EVNOdds.html")EVN Capture Odds Calculator(/url) | (url="http://"http://www.evula.org/artanis/Captaintripps10000.jpg")Oops.(/url)

      (This message has been edited by Artanis (edited 12-04-2003).)

    • Hmm, that flash calc seems a bit buggy, it gave me a bigger min value than max value for my ship with a strength of 500 and crew of 250 (Fed Carrier) vs a ship with Strenght of 450 and crew of 275 (Auroran Carrier)...

      So I made this (url="http://"http://homepage.mac.com/ragashingo/.Pictures/OddCalc.jpg")app(/url)

      It does nearly everything the flash one does, and works offline, plus it has Aqua goodness 🙂
      If you want it you can download it (url="http://"http://homepage.mac.com/ragashingo/FileSharing4.html")here(/url)

      ------------------
      Help save Ares, write a plugin!

      (This message has been edited by Ragashingo (edited 12-05-2003).)

    • I didn't realize that the labels for Maximum Odds and Minimum Odds are switched in Artanis's flash app. 🙂

      ------------------
      Get (url="http://"http://www.aznt.com/EVN/EVNEW")EVNEW(/url) - the free, open-source plugin EVN Editor for Windows!

    • Fixed!

      Now also have Flash Projector versions of the app so it can run as a stand alone and offline.
      ------------------
      "Time flows faster on the sun..." - Me, result of too much free time. But I'd have 'less' on the sun.
      (url="http://"http://www.evula.org/artanis")www.evula.org/artanis(/url) | (url="http://"http://www.evula.org/artanis/EVNOdds.html")EVN Capture Odds Calculator(/url) | (url="http://"http://www.evula.org/artanis/Captaintripps10000.jpg")Oops.(/url)

      (This message has been edited by Artanis (edited 12-06-2003).)

    • Sorry to dig this up, but do shield levels play any effect on this? I heard that they did, but I see no evidence of it in the algorithm.

      ------------------
      (url="http://"http://fenris.ma.cx/forum")Fenris(/url)

    • Quote

      Originally posted by Katana:
      **Sorry to dig this up, but do shield levels play any effect on this? I heard that they did, but I see no evidence of it in the algorithm.

      **

      They may have in a previous version of EV (prehapse EVC/O?) before there was a strength attribute. I assume that that shields would have been used in place of the strength value.
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      They may have in a previous version of EV (prehapse EVC/O?) before there was a strength attribute. I assume that that shields would have been used in place of the strength value.
      -Az

      Yes, in EVC and EVO, it depended on shield values (which makes it yet more impossible to correctly duplicate EVO or EVC in EVN).

      ------------------
      The programmer's code of entomology: there's always another bug.
      Windows users: stop asking for plugins. (url="http://"http://www.aznt.com/EVN/EVNEW/")Make one yourself.(/url)
      (url="http://"http://www.cwssoftware.com")Sephil Saga Website(/url)
      (url="http://"http://www.evula.org/infernostudios/search.html")Add-ons Search Engine(/url)

    • Er, I was under the impression that it still made a difference... Ah, well.

      ------------------
      (url="http://"http://fenris.ma.cx/forum")Fenris(/url)

    • Quote

      Originally posted by Katana:
      **Er, I was under the impression that it still made a difference... Ah, well.

      **

      Er... the formula is right at the first page of this topic....
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • A similar question that's not big enough for a new thread:
      When giving Marine Squads a mod value in plug-ins, which increases your odds of capturing a ship, a positive or negative value?
      I ask because the standard Marins Squads have a positive value, but a plug-in I found which is supposed to create an outfit with stronger marines has a negative value.
      Please help. I can post pictures of what I am refering to if that helps.

      ------------------
      Support USA Patriot Act let real Americans take away our rights before those darn foreigners can try.
      Stop defending your rights, national security demands that they be taken away in order to be defended.
      Before you do what you are about to do, think about why you are about to do what you are about to do

    • Quote

      Originally posted by Klepsacovic:
      **A similar question that's not big enough for a new thread:
      When giving Marine Squads a mod value in plug-ins, which increases your odds of capturing a ship, a positive or negative value?
      I ask because the standard Marins Squads have a positive value, but a plug-in I found which is supposed to create an outfit with stronger marines has a negative value.
      Please help. I can post pictures of what I am refering to if that helps.

      **

      There is no way to make an outfit to decrease capture chances. A negative value increases your chances by a flat |modval|, while a positive value adds modval to your crew.
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.