Global Lerror=0 ;Set in main program Dim LerrorDat$(100,1) ;Set in main program and make sure the dimension is high enough to hold the number of loading files
Global Lerror=0 ;Set in main program Dim LerrorDat$(100,1) ;Set in main program and make sure the dimension is high enough tomg_doors=CheckAnimload("gfxDoors24x24.png",24,24,0,12)img_elevadoor=CheckAnimload("gfxelevatordoor40x32.png",40,32,0,6)img_hoteldeco=CheckLoad("gfxHotel-deco.png")img_smallplant=CheckLoad("gfxSmalllPlant.png")img_elevator=CheckLoad("gfxelevator.png")img_roomitems=CheckAnimload("gfxRoomItems24x45.png",24,45,0,7);Multi Game sprites or images definitionsSpr_Bullet02=CheckLoad("gfxLaser01.png") ;Game 01Spr_jones=CheckAnimload("gfxChucky9x14.png",9,14,0,10)spr_girl=CheckLoad("gfxGirl.png")spr_heart=CheckAnimload("gfxhearth9x8.png",9,8,0,3)spr_npcs=CheckAnimload("gfxpcs.png",24,21,0,48);Check if any loading errors have occured, and display the informationIf CheckLoadError() WaitKey () RuntimeError("Please undo the changes from the gfx folder!") ;Graphic loading errors are fatal ! EndIfsnd_shot=CheckLoad("sfxshot.ogg","s")snd_laser=CheckLoad("sfxLaserShot.ogg","s")snd_laser1=CheckLoad("sfxLaserShot01.ogg","s")snd_Pickup=CheckLoad("sfxPickupEgg.ogg","s")snd_coin=CheckLoad("sfxcoin.ogg","s")snd_explode=CheckLoad("sfxExplode.ogg","s")snd_explode1=CheckLoad("sfxExplode01.ogg","s")If CheckLoadError()=True ; Sound file errors usualy don't cause maw's but arent played WaitKey()EndIf
=CheckAnimload("gfxDoors24x24.png",24,24,0,12,2401)=CheckLoad("gfxLaser01.png","i",5550)=CheckLoad("sfxshot.ogg","s",22221)
;====================================================================; Project: PrintF function; Version: 1.0; Author: Dan; Email: -.-; Copyright: PD; Description: ; Prints Text To a file ! (easy way); every time a PrintF is called it writes the text to the end of that file.; Basic error checking is implemented,but you will need to ensure that the filename is valid; every PrintF("text") call adds CrLf ($0d and $0a bytes to the end of the end of the txt$); so that the file can be opened with notepad; Usage:; PrintF(Filename,1) to set the filename; PrintF("text") to write to the file above; PrintF("") to close the opened file !!!; so that a new filename can be set;===============================================================================================Function PrintF(Txt$="",setf=0);Copy next 8 lines to the beginning of your program, and uncomment them (remove ; ); Type writeout; Field Filename$; Field OldFilename$; Field filestreamID; Field open; Field filenameset; End Type ; Global pfile.writeout = New writeout; Const loaddebug=0 ;Used for CheckLoad + CheckAnimLoad functions; If loaddebug=1 Then PrintF("R:filesize.txt",1) ;to make a list with filenames and filesize. useful for releasing the games, to check if the file has been modified (is it only a simple size check);usage:;PrintF("r: est.txt",1) ;to set the filename;PrintF("test text") ;to write a line of text to the file ;PrintF("") ;To close the file ! Important before using another file to write!; ;else it writes to the same file again Select True Case setf=0 And pfilefilenameset=1 If Len(Txt$)>0 ;Is Length of the Text$ greater than 0 If pfileopen=0 ;has the file allready been opened ? If pfileOldFilename$="" Then pfileOldFilename$=pfileFilename$ ;if no, set the oldfilename as filename$ If FileType(pfileFilename$)=0 ;Doesnt Exists, create new one pfilefilestreamID=WriteFile(pfileFilename$) ElseIf FileType(pfileFilename$)=2 ;It is a directory, Stop the program RuntimeError "PrintF: The Filename is a directory, please check your script" ElseIf FileType(pfileFilename$)=1 ;File Exists, open it to make additions ! pfilefilestreamID=OpenFile(pfileFilename$) EndIf If pfilefilestreamID=0 ;Check if the file could be opened RuntimeError "PrintF: error cannot open "+pfileFilename$ Else ;The file exists, set the writing position to the end of the file ! SeekFile (pfilefilestreamID,FileSize(pfileFilename$)) EndIf pfileopen=1 ;Global flag to indicate that the file is open ! ElseIf pfileopen=1 ;File has allready been opened, check if the filename is same (to prevent writing data to a wrong file !) If pfileFilename$<>pfileOldFilename$ If pfilefilestreamID>0 Then CloseFile pfilefilestreamID RuntimeError ("PrintF: Filename Missmatch "+pfileFilename$+" is not "+pfileOldFilename$) EndIf EndIf ;Write text string into the FilestreamId For x=1 To Len(Txt$) WriteByte pfilefilestreamID,Asc(Mid$(Txt$,x,1)) Next ;And add cr+lf, so it can be readed in text editor as new line WriteByte pfilefilestreamID,$0d WriteByte pfilefilestreamID,$0a Else ;if length of the text$ is 0 then the file should be closed ! If pfilefilestreamID>0 Then CloseFile pfilefilestreamID pfileopen=0 pfileOldFilename="" EndIf Case setf=1 And pfilefilenameset=0 If Txt$="" Then RuntimeError "PrintF (txt$,1) is used To set a filename, And txt$ cannot be empty!" pfileFilename$=Txt$ pfilefilenameset=1 Case setf=0 And pfilefilenameset=0 RuntimeError "The Filename was not been set, use PrintF(''c:Filename'',1) before calling PrintF(''text'') writing function" Case setf=1 And pfilefilenameset=1 If pfileOldFilename="" And Txt$<>"" pfileFilename=Txt$ Else RuntimeError " Close the filehandle with PrintF('''') before setting a new filename !" EndIf End SelectEnd Function