Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Zetaboards Modifications
  • RuneScape Calculator
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
RuneScape Calculator
Tweet Topic Started: Apr 27 2010, 05:31 PM (2,046 Views)
Sacktapped_U Apr 27 2010, 05:31 PM Post #1
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
Name: RuneScape Calculator
Description: This code places a link on your sub-menu labeled Max Hit Calculator, or whatever you change it too. Once you select the link, a pop-up box will appear and you will need to enter in your RuneScape information. After, hit submit, and your Max Hit will be shown.
Preview: (Picture)
Installation:
Step 1
1.) Open the Admin CP and click on the Board Template under the Themes section.
2.) Under the Top of Page section of the Board Template, place this code:
Code:
 
<script type="text/javascript">
// Max Hit Calculator by Sacktapped_U of ZBCode.com
// Special Thanks to RedBldSandman of ZBCode.com

$(function() {
$("#submenu").append("<a href='javascript:max_calc()'>Max Hit Calculator (Melee)</a>")
});

function max_calc() {
if (!$("#calc").html()) {
$("#nav").after("<div id='calc' style='display:none;margin:10px;position:fixed;bottom:20px;right:20px;z-index:999;'><table id='calc_table' cellspacing='0' style='margin:10px auto;width:450px;text-align:center;'><thead><tr><th colspan='2'><span style='float:right;cursor:pointer;' onclick='calc_close()'><img src='http://s5.tinypic.com/30wt6ja_th.jpg'></img></span>Max Hit Calculator</th></tr></thead><tbody><tr><td style='width:50%'><label>Strength Level:</label></td><td><input type='text' name='str' size='5' /></td></tr><tr><td><label>Equipment Bonus:</label></td><td><input type='text' name='equip' size='5' /></td></tr><tr><td><label>Max Hit:</label></td><td id='maxhit'></td></tr><tr><td colspan='2'><button id='Engage'>Submit</button></td></tr></tbody></table></div>")
$("#calc").fadeIn("slow",function() {
$("#Engage").click(function(e) {
e.preventDefault();
e.returnValue = false;
var str = $("input[name=str]").val();
var equip = $("input[name=equip]").val();
var equip_bonus = ((equip*0.00175)+0.1);
var result = "";

result = Math.floor((((str*equip_bonus)+1.05)*10));

$("#maxhit").html("<strong>"+result+"</strong>");
});
});
} else {
calc_close();
}
}

function calc_close() {
$("#calc").fadeOut("slow",function() { $(this).remove(); });
}
</script>
Edited by Sacktapped_U, Jun 6 2010, 10:43 AM.
Posted Image
Offline Profile Goto Top
 
Gorgor Apr 27 2010, 05:49 PM Post #2
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Ok... HOW did you get the max hit formula???
Offline Profile Goto Top
 
Sacktapped_U Apr 27 2010, 05:59 PM Post #3
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
I'm good like that!

Been at it on Spreadsheet. Trial and Error. Then I saw RedBldSandman's code. And put it to the test. Hope you enjoy!
Posted Image
Offline Profile Goto Top
 
RedBldSandman Apr 27 2010, 06:19 PM Post #4
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
I'd prefer if you asked for my permission to use any of my codes as a base for another code. I'm fine with it in most cases, I just like to be kept in the know and I can even suggest improvements to what I did so the new codes are even better :) Thanks for crediting me in the copyright though :)

Nice code too :P
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Sacktapped_U Apr 27 2010, 06:39 PM Post #5
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
Oh, sorry. I do have a question. If you tested the code, you may notice that you might get some crazy number like 573.8700000000000000002. How do you get it so that number is rounded up to 574?
Posted Image
Offline Profile Goto Top
 
Gorgor Apr 27 2010, 06:48 PM Post #6
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Code:
 
Math.ceil(number)
Offline Profile Goto Top
 
Sacktapped_U Apr 27 2010, 06:51 PM Post #7
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
Thank you kind sir. :P
Posted Image
Offline Profile Goto Top
 
Reid Apr 28 2010, 10:42 AM Post #8
Member Avatar
What? The land of the free? Whoever told you that was your enemy.

Posts:
1,790
Group:
Distinguished Coder
Member
#148
Joined:
Jul 20, 2008
Math.round is a better option. Math.ceil always rounds up, and Math.floor always rounds down.
The Resource Board
Offline Profile Goto Top
 
Sacktapped_U Apr 29 2010, 03:55 PM Post #9
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
Where do I put that in the code? I tried where I thought it would go and got a big huge
ERROR
Posted Image
Offline Profile Goto Top
 
mohanr2222 Jun 5 2010, 11:43 PM Post #10


Posts:
1
Group:
Member
Member
#3,489
Joined:
Sep 23, 2009
Reid
Apr 28 2010, 10:42 AM
Math.round is a better option. Math.ceil always rounds up, and Math.floor always rounds down.
Therefore, Math.floor is better. because there in RunScape, Your max hit would be 542 even if you had 542.99999999
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
ZetaBoards - Free Forum Hosting
Free Forums with no limits on posts or members.
Learn More · Sign-up Now
Go to Next Page
« Previous Topic · Zetaboards Modifications · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2

Track Topic · E-mail Topic Time: 7:49 PM Jul 10
Hosted for free by ZetaBoards · Privacy Policy