Post by FireIndy on Jun 11, 2007 18:10:04 GMT -8
This is an extend of my little RPG I wrote. It has options of showing a level bar, the 2 bar colors, and the width of the bar, and color of the plus sign. You can set the RPG statistic, the gain per post, and an image to set with it.
If the user stats are extend over the bar, a "+" sign is shown at the end of the bar.
Note: for the width of the rpg bar, do not use %, use actual pixels. I measured it and found the width of the mini-profile to be about 186 pixels at max.
Edit: Please do not Pm me for support for this code. Ask in the code support board.
Follow the comments in the code to modify it.
To edit the array:
rpg[0] = ["RPG STAT","POINTS PER POST","IMAGE"];
Global Footer
If the user stats are extend over the bar, a "+" sign is shown at the end of the bar.
Note: for the width of the rpg bar, do not use %, use actual pixels. I measured it and found the width of the mini-profile to be about 186 pixels at max.
Edit: Please do not Pm me for support for this code. Ask in the code support board.
Follow the comments in the code to modify it.
To edit the array:
rpg[0] = ["RPG STAT","POINTS PER POST","IMAGE"];
Global Footer
<script>
<!--
/*Forever RPG 1 by FireIndy, may be reposted, but no editing */
var bars = "yes"; //Show bars :yes or no.
var barcolor = "green" //Color of the positive bar.
var backcolor = "black" //Color of the opposite bar.
var pluscolor = "red" //Color of plus sign
var widthofbar = "186" //total width of rpg bar pixel wise: use 186 as max amount. dont use %
var fontcolor = "white" //Font color
var rpg = new Array();
rpg[0] = ["Attack","2","http://s2.images.proboards.com/xx.gif"];
rpg[1]= ["Defense","4","http://s2.images.proboards.com/xx.gif"];
if(location.href.match(/on=(displ|search2|viewpr|pmv|(user)?rece|cal\w+iew)/)){
var td = document.getElementsByTagName("td");
for(i=0;i<td.length;i++){
if(td[i].width == '20%' && td[i].innerHTML.match(/Posts:\s([\d,]+)/i)){
td[i].innerHTML +='<br /><br /><center>RPG Stats<br></center>'
for(a=0;a<rpg.length;a++){
var posts = td[i].innerHTML.match(/Posts:\s([\d,]+)/i)? RegExp.$1 : 'N/a';
if(posts.match(/,/g)){
var posts = posts.replace(/,/, '');
}
posts = posts*parseInt(rpg[a][1]);
var opptotal = parseInt(widthofbar - posts);
thetable = "";
if(bars == 'no'){
thetable += '</center><div align="left"><img src="'+rpg[a][2]+'"></img>'+rpg[a][0]+' : '+posts+'<br></div>';
}else{
if((widthofbar > posts) ){
thetable += '</center><div align="left"><img src="'+rpg[a][2]+'"></img>'+rpg[a][0]+' <br></div><table width="'+widthofbar+'" height="9" cellspacing="0" id="barname"><tr><td bgcolor="'+barcolor+'" width="'+posts+'"><center><font size="1" color="'+fontcolor+'">'+posts+'</font><center></td>';
thetable += '<td bgcolor="'+backcolor+'" ><div align="right"><font size="1" color="'+fontcolor+'">'+opptotal+'</font></div></td>';
}else{
thetable += '</center><div align="left"><img src="'+rpg[a][2]+'"></img>'+rpg[a][0]+' <br></div><table width="'+widthofbar+'" height="9" cellspacing="0" id="barname"><tr><td bgcolor="'+barcolor+'" width="'+posts+'"><center><font size="1" color="'+fontcolor+'">'+posts+'<td align="right" bgcolor="'+barcolor+'"><font color="'+pluscolor+'">+</font></td></font><center></td>';
}
thetable += '</tr></table>';
}
td[i].innerHTML += thetable;
}
}
}
}
//-->
</script>