I'm making a simple RPG and I need help with a certain aspect of loading pictures. You see, the game includes a 'dungeon maker' aspect, and one part of that lets you enter in a path for the 2d image you want to use for a certain monster you created. Long story short, how do I make DBPro check and see if that file exists BEFORE loading it, so my game doesn't crash when it tries to load a non-existent file? (assuming you miss-typed the pathname for the monster image)
I already tried to use code that looked something like this:
rem this deletes the old image to make room, and inputs the new pathname
delete image monsterselectedimagenumber
input "Enter new image path: ",monster$
rem loads the monster image
load image monster$,monsterselectedimagenumber
rem check to see if the image exists
if image exist(monsterselectedimagenumber)=1
rem This saves the pathname in the associated variable
if monsterselected = 11 then bossdata$(1,2) = monster$
if monsterselected < 11 then monsterdata$(monsterselected,2) = monster$
endif
rem if the image doesn't exist, it sets the 'message$' to be displayed to the user during the refresh function.
if image exist(monsterselectedimagenumber)=0 then message$ = "That image does not exist." : load image "monsters/nothing.bmp",monsterselectedimagenumber
--Did you know that 42% of all statistics are just made up?