lordofthesword8
07-03-2004, 06:23 PM
Hi, ive got a script and netscape is telling me me that it is not defined. Would anyone take a look and tell me whats wrong? Even if its just a hunch I would be gratefull. If you need anymore info about this script and the errors its giving me, send me an email or reply to this. :)
Thanks to anyone who can help me!
function attackcalc() {
if (document.fight.answer.value=="A") {
attackenemy()
enemyattack(0)
}
if (document.fight.answer.value=="B") {
enemyattack(parseInt(document.fight.herolevel.value))
}
if (document.fight.answer.value=="C") {
document.fight.location.value = 'magicwrite'
magiclist = new Array("Do you want to use:\rA. Fire Ball\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\rD. Inferno\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\rD. Inferno\rE. Final Blow")
level = parseInt(document.fight.herolevel.value.value)
document.fight.movelist.value = magicstring[level]
}
}
function fireball() {
if (parseInt(document.fight.yourcurrentmagic.value)>=5) {
alert("You cast a Fireball!")
var enemyhealth = parseInt(document.fight.enemycurrenthealth.value)
enemyhealth = enemyhealth-5
document.fight.enemycurrenthealth.value = enemyhealth
}
if (parseInt(document.fight.yourcurrentmagic.value)<5) {
alert("You do not have enough Magic left to cast this!")
}
enemyattack(0)
}
function magiccalc() {
if (document.fight.answer.value=="A") {
fireball()
}
if (document.fight.answer.value=="B") {
meteorball()
}
if (document.fight.answer.value=="C") {
shineingblade()
}
if (document.fight.answer.value=="D") {
inferno()
}
if (document.fight.answer.value=="E") {
finalblow()
}
}
function calccalc() {
var location = document.fight.location.value
if (location=="attackwrite") {
atackcalc()
}
if (location=="magicwrite") {
magiccalc()
}
}
function youwrite() {
var totalhealth = parseInt(opener.document.darkworlds.herolevel.value)
document.fight.heroname.value = opener.document.darkworlds.hero.value
document.fight.herolevel.value = opener.document.darkworlds.herolevel.value
document.images.youpic.src=opener.document.darkworlds.hero.value + ".gif"
document.fight.yourcurrenthealth.value = opener.document.darkworlds.health.value
document.fight.yourtotalhealth.value = totalhealth*20
totalmagic = parseInt(opener.document.darkworlds.herolevel.value)
document.fight.yourcurrentmagic.value = totalmagic*10
document.fight.yourtotalmagic.value = totalmagic*10
}
function enemywrite() {
enemyname = getenemyname()
enemylevel = getenemylevel()
document.fight.enemycurrenthealth.value = enemylevel*20
document.fight.enemytotalhealth.value = enemylevel*20
document.fight.enemyname.value = enemyname
document.fight.enemylevel.value = enemylevel
document.images.enemypic.src=enemyname + ".gif"
document.fight.enemycurrentmagic.value = enemylevel*10
document.fight.enemytotalmagic.value = enemylevel*10
}
function getenemyname() {
var loc = opener.document.darkworlds.location.value
var enemy = ""
switch(loc) {
case "mountain1write":
enemy = "Stone Snake"
break
case "mountain3write":
enemy = "Mountain Troll"
break
case "mountain6write":
enemy = "Elven Sentries"
break
}
return enemy
}
function getenemylevel() {
var loc = opener.document.darkworlds.location.value
var enemy = 0
switch(loc) {
case "mountain1write":
enemy = 1
break
case "mountain3write":
enemy = 2
break
case "mountain6write":
enemy = 3
break
}
return enemy
}
function attackwrite() {
document.fight.location.value = 'attackwrite'
document.fight.movelist.value = 'Do you want to:\r A. Attack \r B. Defend \r C. Cast a Spell'
}
function attackenemy() {
var yourattack = parseInt(document.fight.herolevel.value)
yourattack = yourattack*2
var enemyhealth = parseInt(docuemnt.fight.enemycurrenthealth.value)
enemyhealth = enemyhealth-yourattack
document.fight.enemycurrenthealth.value = enemyhealth
}
function start() {
youwrite()
enemywrite()
attackwrite()
}
Thanks to anyone who can help me!
function attackcalc() {
if (document.fight.answer.value=="A") {
attackenemy()
enemyattack(0)
}
if (document.fight.answer.value=="B") {
enemyattack(parseInt(document.fight.herolevel.value))
}
if (document.fight.answer.value=="C") {
document.fight.location.value = 'magicwrite'
magiclist = new Array("Do you want to use:\rA. Fire Ball\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\rD. Inferno\r","Do you want to use:\rA. Fire Ball\rB. Meteor Ball\rC. Shining Blade\rD. Inferno\rE. Final Blow")
level = parseInt(document.fight.herolevel.value.value)
document.fight.movelist.value = magicstring[level]
}
}
function fireball() {
if (parseInt(document.fight.yourcurrentmagic.value)>=5) {
alert("You cast a Fireball!")
var enemyhealth = parseInt(document.fight.enemycurrenthealth.value)
enemyhealth = enemyhealth-5
document.fight.enemycurrenthealth.value = enemyhealth
}
if (parseInt(document.fight.yourcurrentmagic.value)<5) {
alert("You do not have enough Magic left to cast this!")
}
enemyattack(0)
}
function magiccalc() {
if (document.fight.answer.value=="A") {
fireball()
}
if (document.fight.answer.value=="B") {
meteorball()
}
if (document.fight.answer.value=="C") {
shineingblade()
}
if (document.fight.answer.value=="D") {
inferno()
}
if (document.fight.answer.value=="E") {
finalblow()
}
}
function calccalc() {
var location = document.fight.location.value
if (location=="attackwrite") {
atackcalc()
}
if (location=="magicwrite") {
magiccalc()
}
}
function youwrite() {
var totalhealth = parseInt(opener.document.darkworlds.herolevel.value)
document.fight.heroname.value = opener.document.darkworlds.hero.value
document.fight.herolevel.value = opener.document.darkworlds.herolevel.value
document.images.youpic.src=opener.document.darkworlds.hero.value + ".gif"
document.fight.yourcurrenthealth.value = opener.document.darkworlds.health.value
document.fight.yourtotalhealth.value = totalhealth*20
totalmagic = parseInt(opener.document.darkworlds.herolevel.value)
document.fight.yourcurrentmagic.value = totalmagic*10
document.fight.yourtotalmagic.value = totalmagic*10
}
function enemywrite() {
enemyname = getenemyname()
enemylevel = getenemylevel()
document.fight.enemycurrenthealth.value = enemylevel*20
document.fight.enemytotalhealth.value = enemylevel*20
document.fight.enemyname.value = enemyname
document.fight.enemylevel.value = enemylevel
document.images.enemypic.src=enemyname + ".gif"
document.fight.enemycurrentmagic.value = enemylevel*10
document.fight.enemytotalmagic.value = enemylevel*10
}
function getenemyname() {
var loc = opener.document.darkworlds.location.value
var enemy = ""
switch(loc) {
case "mountain1write":
enemy = "Stone Snake"
break
case "mountain3write":
enemy = "Mountain Troll"
break
case "mountain6write":
enemy = "Elven Sentries"
break
}
return enemy
}
function getenemylevel() {
var loc = opener.document.darkworlds.location.value
var enemy = 0
switch(loc) {
case "mountain1write":
enemy = 1
break
case "mountain3write":
enemy = 2
break
case "mountain6write":
enemy = 3
break
}
return enemy
}
function attackwrite() {
document.fight.location.value = 'attackwrite'
document.fight.movelist.value = 'Do you want to:\r A. Attack \r B. Defend \r C. Cast a Spell'
}
function attackenemy() {
var yourattack = parseInt(document.fight.herolevel.value)
yourattack = yourattack*2
var enemyhealth = parseInt(docuemnt.fight.enemycurrenthealth.value)
enemyhealth = enemyhealth-yourattack
document.fight.enemycurrenthealth.value = enemyhealth
}
function start() {
youwrite()
enemywrite()
attackwrite()
}