Post by Rocket! on Feb 6, 2010 19:29:44 GMT -8
This...!
Is a code.
A very nice code, I might add.
This is a UBBC RPG Health Bar code, styled in the look and feel of the game Kingdom Hearts II. By typing in some quick UBBC text, a very cool and very functional Health Bar will appear!
PLACE IN:
UBBC:
EXAMPLES:
DO NOT:
WHAT CAN BE EDITED:
THE CODE:
Is a code.
A very nice code, I might add.
This is a UBBC RPG Health Bar code, styled in the look and feel of the game Kingdom Hearts II. By typing in some quick UBBC text, a very cool and very functional Health Bar will appear!
PLACE IN:
Global Footer.
UBBC:
[HP=#/#][/b]
EXAMPLES:
[HP=100/100]
[HP=29/44]
[hp=0/299]
DO NOT:
Use negative numbers. Code does not look good with negative numbers.
WHAT CAN BE EDITED:
Optionally, you can have text show up below the Health Bar, stating that bar's stats. This can be done by changing the "showvalues" variable from "false" to "true", like so:var showstats=false; //show actual values below barvar showstats=true; //show actual values below bar
THE CODE:
<!--
UBBC RPG Health Bar v1.0
Wormopolis - Coder -- wormocodes.proboards.com
Rocket! - Graphics -- ofthehearts.proboards.com
Prythian - Concept -- ofthehearts.proboards.com
Use as ya will. xD Keep header, plz!
GLOBAL FOOTER ONLY!
//-->
<style type="text/css">
.faded
{
filter:alpha(opacity=60);
opacity:0.6;
position: relative;
right: -2px;
}
</style>
<script type="text/javascript">
<!--
var showstats=false; //show actual values below bar
if (location.href.match(/action=(display|recent|userrecentposts)/)) {
td=document.getElementsByTagName('td');
for (a=0;a<td.length; a++) {
if (td.width=='80%' && td.innerHTML.match(/\[HP=(.+?)\/(.+?)\]/i)) {
currenthp=RegExp.$1;
maxHp=RegExp.$2;
if (maxHp!='') {
td.innerHTML = td.innerHTML.replace(/\[HP=(.+?)\/(.+?)\]/i,healthbar(parseInt(RegExp.$1),parseInt(RegExp.$2)));
a--;
}
}
}
}
function healthbar(currenthp,maxHp) {
endLeftOfUpperBarGreen='<img CLSCHK src="http://i38.tinypic.com/vg1sgz.png" />';
endLeftOfUpperBarGrey='<img src="http://i36.tinypic.com/2cyo6lz.png" />';
middleOfUpperBarGrey='<img src="http://i36.tinypic.com/dmpp3n.png" />';
middleOfUpperBarGreen='<img CLSCHK src="http://i38.tinypic.com/28vyq8i.png" />';
endRightOfUpperBarGreen='<img src="http://i33.tinypic.com/t5rkee.png" />';
endRightOfUpperBarGrey='<img src="http://i37.tinypic.com/2n0lq40.png" />';
endLeftOfLowerBar='<img src="http://i34.tinypic.com/21jyuky.png" />';
greyBlip='<img src="http://i37.tinypic.com/2n6ugkx.png" />';
greenBlip='<img src="http://i38.tinypic.com/2lbj6tx.png" />';
endRightOfLowerBar='<img src="http://i35.tinypic.com/jzb3us.png" />';
leftEndBracket='<img style="right:-1px; position: relative; z-index:1;" src="http://i49.tinypic.com/30mq355.png" />';
hb_result="";
var maxHpBar = 16;
var healthlost = maxHp-currenthp;
blipMax=Math.floor((maxHp-1)/maxHpBar);
greenBlipCnt=Math.floor((currenthp-1)/maxHpBar);
greyBlipCnt=(currenthp>0 ? blipMax-greenBlipCnt : blipMax);
zeroHealth= (currenthp == 0);
// 16/18
if ((maxHpBar * blipMax) < currenthp && maxHp%maxHpBar!=0) { //top HB level
chk='A';
greenBarCnt=(currenthp%maxHpBar==0 ? (currenthp>0 ? 16: 0) : currenthp%maxHpBar);
greyBarCnt=(maxHp%maxHpBar==0 ? 16 : maxHp%maxHpBar)-greenBarCnt; //=0
remainderCnt=(blipMax==0 ? 0 : maxHpBar-greyBarCnt-greenBarCnt); //=0
leftEnd=(maxHp%maxHpBar==0 ? (currenthp==0 ? endLeftOfUpperBarGrey : endLeftOfUpperBarGreen.replace('CLSCHK',' ')) : (blipMax==0 ? leftEndBracket : endLeftOfUpperBarGreen.replace('CLSCHK','class="faded" ')) );
} else {
chk='B';
remainderCnt=0;
greenBarCnt=(currenthp%maxHpBar==0 ? (currenthp>0 ? 15 : 1) : currenthp%maxHpBar);
greyBarCnt=(maxHp<maxHpBar ? maxHp : maxHpBar)-greenBarCnt-1;
leftEnd=(currenthp%maxHpBar==0 ? (currenthp==0 ? endLeftOfUpperBarGrey : endLeftOfUpperBarGreen.replace('CLSCHK',' ')) : endLeftOfUpperBarGrey );
}
hb_result="<br><table><tr><td align='right'>";
//begin upper bar construction
hb_result+=leftEnd;
for (i=0; i<remainderCnt-1; i++) hb_result += middleOfUpperBarGreen.replace('CLSCHK','class="faded" ');
hb_result+=(remainderCnt>0 ? leftEndBracket : "");
for (i=0; i<greyBarCnt; i++) hb_result+=middleOfUpperBarGrey;
for (i=0; i<greenBarCnt-1; i++) hb_result+=middleOfUpperBarGreen;
hb_result+=(zeroHealth ? endRightOfUpperBarGrey : endRightOfUpperBarGreen) + "<br>";
//begin lower bar construction
hb_result+=endLeftOfLowerBar;
for (i=0; i<greyBlipCnt; i++) hb_result+=greyBlip;
for (i=0; i<greenBlipCnt; i++) hb_result+=greenBlip;
hb_result+=endRightOfLowerBar+"<br>";
hb_result+=(showstats ? currenthp+"/"+maxHp : '')+"</td></tr></table>";
return hb_result;
} //-->
</script>
<!--
END UBBC RPG HEALTH BAR
//-->