Re: Bug or Error

new topic     » goto parent     » topic index » view thread      » older message » newer message
Lone_EverGreen_Ranger said...

What is wrong with my code ...

Yes, the first thing is that you cannot use a variable until it has been assigned something, and sending it out to a file is using it.

Secondly, the style you have chosen is not the best one from a maintenance point of view. Like others, I'd suggest that you use a database to store this stuff in, and the supplied EDS is very suitable for it - including storing images.

I'd code it more like ...

 
procedure SaveFile() 
	fName = getSaveFileName(MainWin,file,FrostType) 
	 
	if length(fName) = 0 then 
		return 
	end if 
	 
        fName = defaultext(fName, "edb") 
        delete_file(fName) 
	handle = db_create(fName) 
	 
	if handle != DB_OK then 
		fn = message_box("Save File Error", 
						"Save Error", 
						MB_TASKMODAL) 
	end if 
	 
        db_create_table("attributes") 
        db_select_table("attributes") 
 
        db_insert("Basic", { 
	    HP, 
	    Max_HP, 
	    MP, 
            Max_MP, 
            Str, 
            Def, 
           ... etc, etc, etc, ... 
            getText(Item_MagDam_Edit), 
            getText(Item_ResDam_Edit), 
            $ -- end of list marker 
            }) 
	 
	db:close() 
end procedure 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu