I am working on a media light 2d rpg (mostly text based) And using the set dir command to load data files but it wont seem to work unless I give it an absolute path eg C:/blablabla/Myfolder Instead of just /Myfolder I know my relative path is fine because I use it all over the code for loading datafiles without any trouble.
Here is one of the parts of the code thats has the Set Dirs in it (the other functions that have dirs are pretty much identical they just load different types of data files)
function LoadHSpells()
if GameLoaded = 0
cls
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\HSpells\"
find first
x = 1
do
print "Spells\HSpells\" + Get File Name$()
sync
find next
if Get File type() = -1 then exit
inc x
loop
HSpellCount = x
dim HSpellLibrary(HSpellCount) as HSpell
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\HSpells\"
find first
for y = 1 to HSpellCount
if Right$(Get File Name$(), 5) = ".ADHS"
open to read 1, GET FILE NAME$()
read string 1, HSpellLibrary(y).name
read string 1, HSpellLibrary(y).mod
read string 1, HSpellLibrary(y).desc
read float 1, HSpellLibrary(y).level
read float 1, HSpellLibrary(y).healing
read float 1, HSpellLibrary(y).casttime
print HSpellLibrary(y).name + " Loaded"
sync
close file 1
endif
find next
next y
print "HSpell Loading Complete"
sync
endif
endfunction
function LoadMonsterLibrary()
if GameLoaded = 0
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Monsters"
find first
x = 1
do
print "Monsters\" + Get File Name$()
sync
find next
if Get File type() = -1 then exit
inc x
loop
MonsterCount = x
dim MonsterLibrary(MonsterCount) as Character
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Monsters"
find first
for y = 1 to MonsterCount
if Right$(Get File Name$(), 4) = ".ADC"
open to read 1, GET FILE NAME$()
read string 1, MonsterLibrary(y).name : print MonsterLibrary(y).name
read string 1, MonsterLibrary(y).class : print MonsterLibrary(y).class
read string 1, MonsterLibrary(y).desc : print MonsterLibrary(y).desc
read float 1, MonsterLibrary(y).level : print MonsterLibrary(y).level
read float 1, MonsterLibrary(y).strength : print MonsterLibrary(y).strength
read float 1, MonsterLibrary(y).inteligence : print MonsterLibrary(y).inteligence
read float 1, MonsterLibrary(y).wisdom : print MonsterLibrary(y).inteligence
read float 1, MonsterLibrary(y).charisma : print MonsterLibrary(y).charisma
read float 1, MonsterLibrary(y).dexterity : print MonsterLibrary(y).dexterity
read float 1, MonsterLibrary(y).constitution: print MonsterLibrary(y).constitution
print MonsterLibrary(y).name + " Loaded"
sync
wait 3000
close file 1
endif
find next
next y
print "Monster Loading Complete"
sync
wait 1000
cls
endif
GameLoaded = 1
endfunction
And If it helps here is the rest of the code
`Setup
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
set display mode 1000, 1000, screen depth()
MAXIMIZE WINDOW
disable escapekey
set window off
Position camera 0, 0, -100
Point camera 0, 0, 0
Autocam off
backdrop off
set text size 25
set text font "apple chancery"
type Character
name as string
class as string
life as float
maxlife as float
level as float
xp as float
strength as float
inteligence as float
wisdom as float
charisma as float
dexterity as float
constitution as float
casting as float
x as float
y as float
action as string
desc as string
endtype
type DSpell
name as string
level as float
damage as float
casttime as float
mod as string
desc as string
endtype
type HSpell
name as string
level as float
healing as float
casttime as float
mod as string
desc as string
endtype
global CurrentDSpell as DSpell
global CurrentHSpell as HSpell
load music "Music\plans in motion.mp3", 1
load music "Music\Dangerous.mp3", 2
load music "Music\Mighty and Meek.mp3", 3
global DSpellCount as integer
global HSpellCount as integer
global MonsterCount as integer
global Escape as integer
global Selected as integer
global Monster as Character
global Main as Character
global GameStarted as integer
global GameLoaded as boolean
GameStarted = 0
Main.x = 4
Main.y = 4
main.action = "idle"
`Image loading
load image "Images\AD&D.png", 1
`Main Loop
Start:
do
`menu
loop music 1
randomize timer()
if GameStarted = 0 then MainMenu()
if GameStarted = 1
GetInput()
DrawBord()
endif
sync
loop
function MainMenu
cls
paste image 1, 300, 0
Button("New Character", 400, 400, 200, 40, 1)
Button("Save Character", 400, 500, 200, 40, 6)
Button("Load Character", 400, 600, 200, 40, 2)
Button("Data Edit", 400, 700 , 200, 40, 4)
Button("Start Game", 400, 800, 200, 40, 3)
Button("Exit Game", 400, 900, 200, 40, 5)
text 0, 40, "Current Character " + Main.name
text 0, 80, "Class " + Main.class
text 0, 120, "Level " + STR$(Main.level)
text 0, 160, "Experience " + STR$(Main.xp)
text 0, 200, "Inteligence " + STR$(Main.inteligence)
text 0, 240, "Strength " + STR$(Main.strength)
text 0, 280, "Wisdom " + STR$(Main.wisdom)
text 0, 320, "Charisma " + STR$(Main.charisma)
text 0, 360, "Dexterity " + STR$(Main.dexterity)
text 0, 400, "Constitution " + STR$(Main.constitution)
text 0, 440, "Life " + STR$(Main.life)
endfunction
function NewChar
cls
wait 300
Selected = 0
while Selected = 0
cls
CharButton("Warrior", 400, 400, 200, 30, 2)
CharButton("Thief", 400, 500, 200, 30, 1)
CharButton("Wizard", 400, 600, 200, 30, 3)
sync
endwhile
SaveChar()
wait 300
endfunction
function DataEdit()
cls
wait 300
Selected = 0
while Selected = 0
cls
DataButton("New Monster", 400, 400, 200, 30, 1)
DataButton("New DSpell", 400, 500, 200, 30, 2)
DataButton("New HSpell", 400, 600, 200, 30, 3)
DataButton("Exit", 400, 700, 200, 30, 4)
sync
endwhile
wait 300
endfunction
function DataButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
select event
case 1 : NewMonster(): endcase
case 2 : NewDspell(): endcase
case 3 : NewHSpell() : endcase
case 4 : Selected = 1 : endcase
endselect
endif
endfunction
function NewMonster()
input "Name: ", Monster.name
input "Class: ", Monster.class
input "Level: ", Monster.level
input "Strength: ", Monster.strength
input "Inteligence: ", Monster.inteligence
input "Wisdom: ", Monster.wisdom
input "Charisma: ", Monster.charisma
input "Dexterity: ", Monster.dexterity
input "Constitution: ", Monster.constitution
input "Desciption: ", Monster.desc
SaveMonster()
endfunction
function NewDSpell()
input "Name: ", CurrentDSpell.name
input "Damage: ", CurrentDSpell.damage
input "Level: ", CurrentDSpell.level
input "Cast Time: ", CurrentDSpell.casttime
input "Modifier: ", CurrentDSpell.mod
input "Description: ", CurrentDSpell.desc
SaveDSpell()
endfunction
function NewHSpell()
input "Name: ", CurrentHSpell.name
input "Healing: ", CurrentHSpell.healing
input "Level: ", CurrentHSpell.level
input "Cast Time: ", CurrentHSpell.casttime
input "Modifier: ", CurrentHSpell.mod
input "Description: ", CurrentHSpell.desc
SaveHSpell()
endfunction
function SaveDSpell()
if file exist("Spells\DSpells\" + CurrentDSpell.name + ".ADDS") = true then delete file Monster.name
open to write 1, "Spells\DSpells\" + CurrentDSpell.name + ".ADDS"
write string 1, CurrentDSpell.name
write string 1, CurrentDSpell.mod
write string 1, CurrentDSpell.desc
write float 1, CurrentDSpell.level
write float 1, CurrentDSpell.damage
write float 1, CurrentDSpell.casttime
close file 1
endfunction
function SaveHSpell()
if file exist("Spells\HSpells\" + CurrentHSpell.name + ".ADHS") = true then delete file Monster.name
open to write 1, "Spells\HSpells\" + CurrentHSpell.name + ".ADHS"
write string 1, CurrentHSpell.name
write string 1, CurrentHSpell.mod
write string 1, CurrentHSpell.desc
write float 1, CurrentHSpell.level
write float 1, CurrentHSpell.healing
write float 1, CurrentHSpell.casttime
close file 1
endfunction
function CharButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
select event
case 1 : Thief(): endcase
case 2 : Warrior(): endcase
case 3 : Wizard(): endcase
endselect
endif
endfunction
function Wizard()
cls
sync
input "Name: ", Main.name
Main.class = "Wizard"
Main.strength = 10
Main.inteligence = 18
Main.wisdom = 15
Main.charisma = 12
Main.dexterity = 10
Main.constitution = 10
Main.level = 1
Main.maxlife = Main.constitution * 3
Main.life = Main.maxlife
Selected = 1
endfunction
function Warrior()
cls
sync
input "Name: ", Main.name
Main.class = "Warrior"
Main.strength = 18
Main.inteligence = 10
Main.wisdom = 10
Main.charisma = 10
Main.dexterity = 12
Main.constitution = 15
Main.level = 1
Main.maxlife = Main.constitution * 3
Main.life = Main.maxlife
Selected = 1
endfunction
function Thief()
cls
sync
input "Name: ", Main.name
Main.class = "Thief"
Main.strength = 12
Main.inteligence = 10
Main.wisdom = 10
Main.charisma = 15
Main.dexterity = 18
Main.constitution = 10
Main.level = 1
Main.maxlife = Main.constitution * 3
Main.life = Main.maxlife
Selected = 1
endfunction
function Button(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
select event
case 1 : NewChar(): endcase
case 2 : LoadChar(): endcase
case 3
if Main.level > 0
GameStarted = 1
LoadDSpells()
LoadHSpells()
LoadMonsterLibrary()
else
cls
text 150, 200, "You must Select a Character before you can start"
sync
wait 2000
endif
endcase
case 4 : DataEdit() : endcase
case 5 : end : endcase
case 6
SaveChar()
cls
text 300, 300, "Character Saved"
sync
wait 2000
endcase
endselect
endif
endfunction
function SaveChar()
if file exist("Characters\" + Main.name + ".ADC") = true then delete file Main.name
open to write 1, "Characters\" + Main.name + ".ADC"
write string 1, Main.name
write string 1, Main.class
write float 1, Main.level
write float 1, Main.xp
write float 1, Main.strength
write float 1, Main.inteligence
write float 1, Main.wisdom
write float 1, Main.charisma
write float 1, Main.dexterity
write float 1, Main.constitution
write float 1, Main.x
write float 1, Main.y
close file 1
endfunction
function SaveMonster()
if file exist("Monsters\" + Monster.name + ".ADC") = true then delete file Monster.name
open to write 1, "Monsters\" + Monster.name + ".ADC"
write string 1, Monster.name
write string 1, Monster.class
write string 1, Monster.desc
write float 1, Monster.level
write float 1, Monster.strength
write float 1, Monster.inteligence
write float 1, Monster.wisdom
write float 1, Monster.charisma
write float 1, Monster.dexterity
write float 1, Monster.constitution
close file 1
endfunction
function LoadChar()
input "Charters Name: ", name$
if file exist("Characters\" + name$ + ".ADC") =1
open to read 1, "Characters\" + name$ + ".ADC"
read string 1, Main.name
read string 1, Main.class
read float 1, Main.level
read float 1, Main.xp
read float 1, Main.strength
read float 1, Main.inteligence
read float 1, Main.wisdom
read float 1, Main.charisma
read float 1, Main.dexterity
read float 1, Main.constitution
read float 1, Main.x
read float 1, Main.y
close file 1
Main.maxlife = Main.constitution * 3
Main.life = Main.maxlife
endif
endfunction
function LoadDSpells()
if GameLoaded = 0
cls
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\DSpells\"
find first
x = 1
do
print "Spells\DSpells\" + Get File Name$()
sync
find next
if Get File type() = -1 then exit
inc x
loop
DSpellCount = x
dim DSpellLibrary(DSpellCount) as DSpell
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\DSpells\"
find first
for y = 1 to DSpellCount
if Right$(Get File Name$(), 5) = ".ADDS"
open to read 1, GET FILE NAME$()
read string 1, DSpellLibrary(y).name
read string 1, DSpellLibrary(y).mod
read string 1, DSpellLibrary(y).desc
read float 1, DSpellLibrary(y).level
read float 1, DSpellLibrary(y).damage
read float 1, DSpellLibrary(y).casttime
print DSpellLibrary(y).name + " Loaded"
sync
close file 1
endif
find next
next y
print "DSpell Loading Complete"
sync
endif
endfunction
function LoadHSpells()
if GameLoaded = 0
cls
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\HSpells\"
find first
x = 1
do
print "Spells\HSpells\" + Get File Name$()
sync
find next
if Get File type() = -1 then exit
inc x
loop
HSpellCount = x
dim HSpellLibrary(HSpellCount) as HSpell
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Spells\HSpells\"
find first
for y = 1 to HSpellCount
if Right$(Get File Name$(), 5) = ".ADHS"
open to read 1, GET FILE NAME$()
read string 1, HSpellLibrary(y).name
read string 1, HSpellLibrary(y).mod
read string 1, HSpellLibrary(y).desc
read float 1, HSpellLibrary(y).level
read float 1, HSpellLibrary(y).healing
read float 1, HSpellLibrary(y).casttime
print HSpellLibrary(y).name + " Loaded"
sync
close file 1
endif
find next
next y
print "HSpell Loading Complete"
sync
endif
endfunction
function LoadMonsterLibrary()
if GameLoaded = 0
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Monsters"
find first
x = 1
do
print "Monsters\" + Get File Name$()
sync
find next
if Get File type() = -1 then exit
inc x
loop
MonsterCount = x
dim MonsterLibrary(MonsterCount) as Character
set dir "C:\Documents and Settings\William\Desktop\Data\Dark Basic Files\D&D\Monsters"
find first
for y = 1 to MonsterCount
if Right$(Get File Name$(), 4) = ".ADC"
open to read 1, GET FILE NAME$()
read string 1, MonsterLibrary(y).name : print MonsterLibrary(y).name
read string 1, MonsterLibrary(y).class : print MonsterLibrary(y).class
read string 1, MonsterLibrary(y).desc : print MonsterLibrary(y).desc
read float 1, MonsterLibrary(y).level : print MonsterLibrary(y).level
read float 1, MonsterLibrary(y).strength : print MonsterLibrary(y).strength
read float 1, MonsterLibrary(y).inteligence : print MonsterLibrary(y).inteligence
read float 1, MonsterLibrary(y).wisdom : print MonsterLibrary(y).inteligence
read float 1, MonsterLibrary(y).charisma : print MonsterLibrary(y).charisma
read float 1, MonsterLibrary(y).dexterity : print MonsterLibrary(y).dexterity
read float 1, MonsterLibrary(y).constitution: print MonsterLibrary(y).constitution
print MonsterLibrary(y).name + " Loaded"
sync
wait 3000
close file 1
endif
find next
next y
print "Monster Loading Complete"
sync
wait 1000
cls
endif
GameLoaded = 1
endfunction
function LoadMonster()
print "Function Started"
wait 1000
sync
y = Main.Level ` + Modifier
while MonsterLibrary(x).level <> y
cls
print "Attempting to find a properly leveld monster"
print y
print MonsterLibrary(x).level
sync
x = rnd(MonsterCount)
endwhile
Monster.name = MonsterLibrary(x).name
Monster.class = MonsterLibrary(x).class
Monster.desc = MonsterLibrary(y).desc
Monster.level = MonsterLibrary(x).level
Monster.strength = MonsterLibrary(x).strength
Monster.inteligence = MonsterLibrary(x).inteligence
Monster.wisdom = MonsterLibrary(x).wisdom
Monster.charisma = MonsterLibrary(x).charisma
Monster.dexterity = MonsterLibrary(x).dexterity
Monster.constitution = MonsterLibrary(x).constitution
Monster.maxlife = Monster.constitution * 3
Monster.life = Monster.maxlife
endfunction
Function DrawBord
cls
x = 0
y = 0
counterx# = 0
countery# = 0
boxsize = 61
for x = 0 to 1000
for y = 0 to 1000
if counterx# = Main.x && countery# = Main.y
box x, y, x + boxsize, y + boxsize, rgb(255, 0, 0), rgb(0, 255, 0), rgb(255, 0, 255), rgb(255, 255, 0)
else
box x, y, x + boxsize, y + boxsize
endif
y = y + boxsize + 2
countery# = y / 52
next y
x = x + boxsize + 2
counterx# = x / 52
next x
endfunction
function GetInput
moved = 0
if escapekey() = 1 then GameStarted = 0
if keystate(31) = 1 then Main.y = Main.y + 1 : Combat()`S
if keystate(30) = 1 then Main.x = Main.x - 1 : Combat()`A
if keystate(32) = 1 then Main.x = Main.x + 1 : Combat()`D
if keystate(17) = 1 then Main.y = Main.y - 1 : Combat()`W
endfunction
function Combat()
stop music 1
loop music 2
cls
LoadMonster()
sync
Escape = 0
wait 300
while Monster.life > 0 && Main.life > 0
cls
text 0, 0, "Your life is " + STR$(Main.life) + " / " + STR$(Main.Maxlife)
text 0, 50, "You are " + Main.action
Text 0, 100, "You are fighting a level " + STR$(Monster.level) + " " + Monster.name
text 0,150, "Your Oponents life is " + STR$(Monster.life) + " / " + STR$(Monster.Maxlife)
CombatButton("Attack", 400, 400, 200, 30, 1)
CombatButton("Magic", 400, 500, 200, 30, 2)
CombatButton("Run", 400, 600, 200, 30, 3)
if Escape = 1 then exit
sync
endwhile
sync
if Monster.life =< 0 then MonsterDefeat()
if Main.life =< 0 then PlayerDefeat()
stop music 2
endfunction
function MonsterDefeat()
Main.xp = Main.xp + Monster.level * 100
endfunction
function PlayerDefeat()
cls
text 300, 300, "You Where Killed Press any Key to continue"
sync
wait key
GameStarted = 0
endfunction
function CombatButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
select event
case 1 : Attack(): endcase
case 2 : Spell(): endcase
case 3 : Run(): endcase
endselect
endif
endfunction
function Attack()
cls
x = rnd(10) +( Main.strength / 10)
Text 200, 200, "You attack with your sword dealing " + STR$(x) + " Damage"
Monster.life = Monster.life - x
sync
wait 2000
main.action = "Idle"
endfunction
function Spell()
wait 300
Selected = 0
while Selected = 0
cls
SpellButton("Destruction", 400, 400, 200, 30, 1)
SpellButton("Healing", 400, 500, 200, 30, 2)
SpellButton("Teleport", 400, 600, 200, 30, 3)
sync
endwhile
endfunction
function Run()
cls
x = rnd(20) + ( Main.dexterity / 20)
Text 200, 200, "You Attempt to run away "
sync
wait 500
cls
if x > 15
cls
Text 200, 200, "You Managed to escape"
Escape = 1
sync
wait 600
endif
if x < 15 || x = 15
cls
Text 200, 200, "You Could not escape"
sync
wait 600
endif
endfunction
function SpellButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
select event
case 1 : DSpellMenu(): endcase
case 2 : HSpellMenu(): endcase
case 3 : Teleport(): endcase
endselect
Selected = 1
endif
endfunction
function DSpellMenu()
wait 300
Selected = 0
while Selected = 0
cls
y = 100
for c = 3 to DSpellCount
DSpellButton(DSpellLibrary(c).name, 400, y, 200, 30, c)
y = y + 100
next c
sync
endwhile
endfunction
function DSpellButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
CurrentDSpell.name = DSpellLibrary(event).name
CurrentDSpell.level = DSpellLibrary(event).level
CurrentDSpell.damage = DSpellLibrary(event).damage
CurrentDSpell.casttime = DSpellLibrary(event).casttime
CurrentDSpell.mod = DSpellLibrary(event).mod
CurrentDSpell.desc = DSpellLibrary(event).desc
Selected = 1
DamageSpell(CurrentDSpell.name, CurrentDSpell.casttime, CurrentDSpell.damage, CurrentDSpell.mod)
endif
endfunction
function HSpellMenu()
wait 300
Selected = 0
while Selected = 0
cls
y = 100
for c = 3 to HSpellCount
HSpellButton(HSpellLibrary(c).name, 400, y, 200, 30, c)
y = y + 100
next c
sync
endwhile
endfunction
function HSpellButton(txt$, x, y, sizex, sizey, event)
box x, y, x + sizex, y + sizey , rgb(150, 0, 0), rgb(0, 100, 0), rgb(100, 100, 0), rgb(0, 200, 200)
text x + (sizex/5) , y + (sizey/5) , txt$
if mouseclick() = 1 && mousex() > x && mousex() < x + sizex && mousey() > y && mousey() < y + sizey
CurrentHSpell.name = HSpellLibrary(event).name
CurrentHSpell.level = HSpellLibrary(event).level
CurrentHSpell.healing = HSpellLibrary(event).healing
CurrentHSpell.casttime = HSpellLibrary(event).casttime
CurrentHSpell.mod = HSpellLibrary(event).mod
CurrentHSpell.desc = HSpellLibrary(event).desc
Selected = 1
HealSpell(CurrentHSpell.name, CurrentHSpell.casttime, CurrentHSpell.healing, CurrentHSpell.mod)
endif
endfunction
function DamageSpell(name$, casttime, damage, mod$)
if Main.casting < casttime
Main.casting = Main.casting + 1
Main.action = "Casting " + name$
else
cls
x = Rnd(damage) + (Main.inteligence / 10)
Monster.life = Monster.life - x
Text 450, 450, "You cast " + name$ + " dealing " + STR$(x) + " Damage"
Main.casting = 0
sync
wait 1000
endif
endfunction
function HealSpell(name$, casttime, heal, mod$)
if Main.casting < casttime
Main.casting = Main.casting + 1
Main.action = "Casting " + name$
else
cls
x = Rnd(heal) + (Main.inteligence / 10)
Main.life = Main.life + x
if Main.life > Main.maxlife then Main.life = Main.maxlife
Main.casting = 0
Text 450, 450, "You heal yourself for " + STR$(x) + " Health points"
sync
wait 1000
endif
endfunction
function Teleport
if Main.casting < 2
Main.casting = Main.casting + 1
Main.action = "Casting Teleport"
else
Main.casting = 0
Text 200, 200, "You Teleport out of combat"
sync
wait 2000
Escape = 1
endif
endfunction
Btw you wont be able to compile the code as is do to the absolute paths! (unless your computer is formated exactly like mine) Media is attached
Any insights into my problem would be appreciated