inherit
44889
0
Apr 16, 2008 3:01:27 GMT -8
shinli
93
May 2005
shinli
|
Post by shinli on Jul 11, 2005 11:43:23 GMT -8
Oke, here it comes, be aware ;D
I am currently using the money code v2. This works fine, however it's a bit basic, and doesn't fit my boards needs. I'm admin at a Harry Potter Roleplaying board. Now, I don't know if you know it, but in the Harry Potter universe they work with Galleons, Sickles and Knuts.
17 Sickles makes 1 Galleon 29 Knuts makes 1 Sickle
Why am I explaining this? Well I wanted to ask, if it's possible in any way, to make a code where you can use these three things, Galleons, Sickles and Knuts. For instance, for every post you'll get 1 sickle (to keep it easy) then after 17 posts you actually have 1 Galleon. I hope you already understand where I'm going. Is it possible to make a code who can actual calculate this. So that it calculates that when you have 17 sickles, you have 1 galleon, and that that's displayed in the mini profile as well.
Ok, long story ;D but is it possible, simple yes or no will do ^^.
Thanks for your time
ShinLi
|
|
inherit
25405
0
Jan 1, 2007 19:34:20 GMT -8
llxwarbirdxll
16
June 2004
warbird1992
|
Post by llxwarbirdxll on Jul 11, 2005 19:12:24 GMT -8
HELL NO
|
|
inherit
22517
0
Apr 30, 2009 18:49:13 GMT -8
Bradley
Has a new webhost. :) Needs to transfer a lot of stuff. :-/
5,246
April 2004
ccworldwebmaster
|
Post by Bradley on Jul 11, 2005 21:35:46 GMT -8
Oke, here it comes, be aware ;D I am currently using the money code v2. This works fine, however it's a bit basic, and doesn't fit my boards needs. I'm admin at a Harry Potter Roleplaying board. Now, I don't know if you know it, but in the Harry Potter universe they work with Galleons, Sickles and Knuts. 17 Sickles makes 1 Galleon 29 Knuts makes 1 Sickle Why am I explaining this? Well I wanted to ask, if it's possible in any way, to make a code where you can use these three things, Galleons, Sickles and Knuts. For instance, for every post you'll get 1 sickle (to keep it easy) then after 17 posts you actually have 1 Galleon. I hope you already understand where I'm going. Is it possible to make a code who can actual calculate this. So that it calculates that when you have 17 sickles, you have 1 galleon, and that that's displayed in the mini profile as well. Ok, long story ;D but is it possible, simple yes or no will do ^^. Thanks for your time ShinLi Let's say for these examples you have 2,561 Kunts. There's a rarely used operator in most languages to find modulus (division remainders). In JS it's %. var iLeft = 5 % 2;iLeft now has the value of 1 because 5/2 is equal to 2 remainder 1. var iMoney = 2561;
// iKunts is equal to 9 var iKunts = iMoney % 29;
// subtract the Kunts from the total money iMoney -= iKunts;
// iSickles is now equal to 3 var iSickles = ((iMoney / 29) % 17);
// subtracts the Sickles from the total, remember that the total is in Kunts iMoney -= iSickles * 29;
// iGalleons is now equal to 5 var iGalleons = ((iMoney / 29) / 17);I hope that all works out. It is quite possible.
|
|
inherit
44889
0
Apr 16, 2008 3:01:27 GMT -8
shinli
93
May 2005
shinli
|
Post by shinli on Jul 12, 2005 3:05:57 GMT -8
So, that's all, and I can put that in my global footer? (I'm a noob at coding lol, altough I'm getting to understand it a bit) Edit: Anyone? (sorry for being such a noob, you must get very tired of such people like me ;D)
|
|
inherit
44889
0
Apr 16, 2008 3:01:27 GMT -8
shinli
93
May 2005
shinli
|
Post by shinli on Jul 12, 2005 8:24:28 GMT -8
So, how can I use that then in the money code? I tried to do it, but that just doesn't work...
<script type="text/javascript"> <!-- /* Money Hack v2 - Global Footers
Created by Peter
This code cannot be reposted at anywhere other than SSDesigns or ProBoards, without permission.
This header must stay intact at all times. */
// Money per post var iMonPP = 2;
// What kind is it? ie. Points, Sweets..ect var mText = "Galleons";
// Want a symbol..? $, £, etc var mSym = "";
var curMon = { money: 0 };
function fNum(num){ if(!isNaN(num)){ num = num.toLocaleString().replace(/\.\d+/, ""); } else { num = 0; } return num; }
var iCell = document.getElementsByTagName("td");
function doMiniProfile(){ for(c = 0; c < iCell.length; c ++){ var mFx = document.createElement("font"); mFx.style.fontSize = "11px"; if(iCell.item(c).width == "20%" && iCell.item(c).className.match(/^windowbg/) && iCell.item(c).innerHTML.match(/member is/)){ if(iCell.item(c).innerHTML.match(/\[M:((-)?\d+)\]/)){ curMon.money = parseInt(RegExp.$1); iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(/\[M:(-)?\d+\]/, ""); } else { curMon.money = 0; } if(iCell.item(c).innerHTML.match(/Posts: ((\d+,\d+)|(\d+))/)){ var cPosts = RegExp.$1.replace(/,/g, ""); cPosts = ((cPosts * iMonPP) + parseInt(curMon.money)); mFx.appendChild(document.createTextNode(mText + ": " + mSym + fNum(cPosts))); if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){ iCell.item(c).appendChild(document.createElement("br")); } iCell.item(c).appendChild(mFx); } else { mFx.appendChild(document.createTextNode(mText + ": " + mSym + "0")); if(iCell.item(c).lastChild.nodeName.toLowerCase() != "br"){ iCell.item(c).appendChild(document.createElement("br")); } iCell.item(c).appendChild(mFx); } } } }
if(location.href.match(/(=display|\/index.cgi$)/)){ doMiniProfile(); }
//--> </script>
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 12, 2005 8:33:39 GMT -8
Wrong board.
|
|