View Full Version : can't find error

08-02-2006, 03:46 AM
Ok i cant find the problem, in this script its supposed to add up the total of my attack and defense. But when i press the button that adds one to the attack variable and i press the button that displays the total, it still says 2. The default level is 2. I dont know how why its not adding it to the total. Heres the script:

<!-- Begin
var armour=3;
var defense=1;
var attack=1;
var gp=0;
var total=defense+attack;

function stats(){
var disp=0;
if (disp==0) { alert("Your Attack Level Is:"+attack+"\nYour Defense Level Is:"+defense+"\nYour Armour Bonus

Is:"+armour+"\n_________________\nINVENTORY\nYou Have "+ gp +" Gold Pieces\n\n_________________\nYour Total Level

Is:"+total+"\nWith a bonus of "+armour+" Defense Points");}

function raiseattack(){
var goupa=0;
if (goupa==0) { attack++; alert("You gained One Level In Attack!\nIts now:"+attack); }

function raisedefense(){
var goupd=0;
if (goupd==0) { defense++; alert("You gained One Level In Defense!\nIts now:"+defense); }

// End -->

08-02-2006, 04:41 AM
ok i redone my script and it works now.