Post by Ћ€ Dog Monst€Я on May 10, 2007 11:06:57 GMT -8
What does this code do?
This code will let people on your forum use an [attack] tag which will, upon posting, generate a random set of numbers to create a damage percentage. The percentage also comes with a bar, that uses by default the bar for PB warnings.
Important to Note
This code doesn't currently support the use of more than one [attack] tag in a post, although it is planned as future feature.
So, what do I edit?
Enclosed between two red colored rows is a set of variables you need to edit:
bar - The url of the image for the actual bar (the middle of it, which is a small 1-5px wide image).
barleft/baright - The urls of the images on the left and right of the bar (that give it a sort of rounded look).
NewUbbIco - States the url for the ubbc button that is to be used for the attack ubbc code.
border - Contains the border color you use for your forum.
If you don't like the way the attack percentage appears and you know a bit about javascript variables, you can edit the orange part to your liking where "prc" is the variable that states the percentage and "imgbar" contains the set of images that the bar consists of.
This code will let people on your forum use an [attack] tag which will, upon posting, generate a random set of numbers to create a damage percentage. The percentage also comes with a bar, that uses by default the bar for PB warnings.
Important to Note
This code doesn't currently support the use of more than one [attack] tag in a post, although it is planned as future feature.
So, what do I edit?
Enclosed between two red colored rows is a set of variables you need to edit:
bar - The url of the image for the actual bar (the middle of it, which is a small 1-5px wide image).
barleft/baright - The urls of the images on the left and right of the bar (that give it a sort of rounded look).
NewUbbIco - States the url for the ubbc button that is to be used for the attack ubbc code.
border - Contains the border color you use for your forum.
If you don't like the way the attack percentage appears and you know a bit about javascript variables, you can edit the orange part to your liking where "prc" is the variable that states the percentage and "imgbar" contains the set of images that the bar consists of.
<script type="text/javascript">
<!--
/*
Attack Rates UBBC Tag
Coded By The Dog Monster
Do Not Edit Or Repost Without Permission
Global Footer
*/
/*START VARIABLE PORTION - EDIT AS INSTRUCTRED*/
var bar="http://s4.images.proboards.com/warn_middle.gif"
var barleft="http://s4.images.proboards.com/warn_left.gif"
var baright="http://s4.images.proboards.com/warn_right.gif"
var NewUbbIco="http://img7.picsplace.to/img7/25/attack.gif";
var border="#000000";
/*END VARIABLE PORTION - EDIT AS INSTRUCTRED*/
/*START VARIABLE PORTION - DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING*/
function MfMr(s){
return Math.floor(Math.random()*s+1);
};
function attackValue(){
var randset=""
for(i=0;i<10;i++){
randset=randset+''+MfMr(9);
}
var rand=MfMr(100);
var substr=MfMr(10);
randset=[randset.substring(0,substr),randset.substring(substr,10)]
if(substr!="10"){
substr=substr+''+MfMr(9);
}
addr=""
if(rand!="100"){
addr=MfMr(9);
}
return substr+''+randset[0]+''+rand+''+randset[1]+''+addr
}
function callAtt(){
if(document.postForm.message.value.match(/\[attack\]/)){
document.postForm.message.value= document.postForm.message.value.replace('[attack]','[attack='+attackValue()+']');
callAtt();
}
};
function doAtt(i){
if(box.innerHTML.match(/\[attack=(\d{2})(\d{13})\]/gi)){
if(box.colSpan=="3" && box.vAlign=="top"){
ereg1=RegExp.$1
ereg2=RegExp.$2
if(ereg1>10){
ereg1=ereg1.substr(0,1)
};
prc=ereg2.replace(ereg2.substr(0,ereg1),'')
prc=prc.substr(0,3)
if(prc.substr(0,3)>100){
prc=prc.substr(0,2)
}
imgbar='<img src="'+barleft+'"/>'
imgPart=prc/5
for(k=0;k<imgPart;k++){
imgbar+='<img src="'+bar+'"/>'
}
imgbar+='<img src="'+baright+'"/>'
box.innerHTML=box.innerHTML.replace(/\[attack\=(.+?)\]/,'<center><table width="40%" style="border: 1px '+border+' solid" cellspacing="1" cellpadding="0"><tr><td><table width="100%" cellpadding="4" cellspacing="0"><tr><td width="63%" align="right"><b>Attack Damage:</b> '+prc+'%</td><td width="37%">'+imgbar+'</td></tr></table></td></tr></table></center>')
doAtt(i);
}
}
};
var box=document.getElementsByTagName('td')
/*END VARIABLE PORTION - DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING*/
/*START UBBC TAG & CODE PORTION - DO NOT EDIT*/
if(document.postForm){
dpF=document.postForm;
dpF.color.parentNode.innerHTML+='<a href=javascript:add("[attack]","")><img src="'+NewUbbIco+'" alt="Attack Rates" border="0"></a>'
dpF.onsubmit = function() { callAtt(); }
}
if(!this.location.href.match(/(headersfooters|modify)/) && !document.postForm){
for(i=0;i<box.length;i++){
doAtt(i);
}
}
/*END UBBC TAG & CODE PORTION - DO NOT EDIT*/
//-->
</script>