JS_XenoArcher

08-30-2011, 07:58 AM

Hi everyone,

I just wrote a little noob script and JSL tester says no errors but I think there's some kind of problem.....can you help me fix the problem????

function doattack(baseatk, wepatk, wepcritmax, oppdef, oppdeffactor, oppextradefmax, opphealth, oppname) {

var OpponentHealth = opphealth;

var OpponentName = oppname;

var BaseATK = baseatk;

var WeaponATK = wepatk;

var WeaponCriticalMax = "100+Math.floor(Math.random()*wepcritmax+1)";

var ActualWeaponATK = "WeaponATK * WeaponCriticalMax / 100";

var OpponentDEF = oppdef;

var DEFfactor = oppdeffactor; //defensefactor: used to multiply preoppdef to calculate actualoppdef so more in number the better rmbr that deffactor must be less than 1

var DEFCriticalMax = "100+Math.floor(Math.random()*oppextradefmax+1)";

var PreOpponentDEF = "OpponentDEF * DEFCriticalMax / 100";

var ActualOpponentDEF = "PreOpponentDEF * DEFfactor";

var DamageDone = "BaseATK + ActualWeaponATK";

var OVRDamageDone = "DamageDone * ActualOpponentDEF / 100";

document.write("You just inflicted " + OVRDamageDone + " damage to " + OpponentName + "!" + "<br>");

var NewOpponentHealth = "OpponentHealth - OVRDamageDone";

if (NewOpponentHealth < 0)

{

document.write(OpponentName + " is dead!" + "<br>");

break;

}

else

{

doattack(BaseATK, WeaponATK, WeaponCriticalMax, OpponentDEF, DEFfactor, DEFCriticalMax, NewOpponentHealth, OpponentName);

}

}

doattack(5, 50, 25, 6, 0.22, 10, 200, RedBabyDragon);

GREAT THANKS

I just wrote a little noob script and JSL tester says no errors but I think there's some kind of problem.....can you help me fix the problem????

function doattack(baseatk, wepatk, wepcritmax, oppdef, oppdeffactor, oppextradefmax, opphealth, oppname) {

var OpponentHealth = opphealth;

var OpponentName = oppname;

var BaseATK = baseatk;

var WeaponATK = wepatk;

var WeaponCriticalMax = "100+Math.floor(Math.random()*wepcritmax+1)";

var ActualWeaponATK = "WeaponATK * WeaponCriticalMax / 100";

var OpponentDEF = oppdef;

var DEFfactor = oppdeffactor; //defensefactor: used to multiply preoppdef to calculate actualoppdef so more in number the better rmbr that deffactor must be less than 1

var DEFCriticalMax = "100+Math.floor(Math.random()*oppextradefmax+1)";

var PreOpponentDEF = "OpponentDEF * DEFCriticalMax / 100";

var ActualOpponentDEF = "PreOpponentDEF * DEFfactor";

var DamageDone = "BaseATK + ActualWeaponATK";

var OVRDamageDone = "DamageDone * ActualOpponentDEF / 100";

document.write("You just inflicted " + OVRDamageDone + " damage to " + OpponentName + "!" + "<br>");

var NewOpponentHealth = "OpponentHealth - OVRDamageDone";

if (NewOpponentHealth < 0)

{

document.write(OpponentName + " is dead!" + "<br>");

break;

}

else

{

doattack(BaseATK, WeaponATK, WeaponCriticalMax, OpponentDEF, DEFfactor, DEFCriticalMax, NewOpponentHealth, OpponentName);

}

}

doattack(5, 50, 25, 6, 0.22, 10, 200, RedBabyDragon);

GREAT THANKS