![]() |
acheiving urber speed question. - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: acheiving urber speed question. (/showthread.php?tid=756) |
acheiving urber speed question. - genusis - 17-02-2007 Well I was doing the tutorial called Achieving urber speed, and I got to the point where i have to change the Load Classes sub. Code: Sub Load Classes() in the tutorial It says Code: Then instead of GetVar, replace it with the Get statement, Get #nFileNum, ,Max_Classes The problem here is that The tutorial does not explain how to change the getvar stuff. It just says to change them with the Get #nFileNum, ,Max_Classes, which always throws an error. I did mine like this Code: Class(i).Name = [color=red]Get[/color] #nFileNum, ,Max_Classes - William - 17-02-2007 Should probably be: Code: Get #nFileNum, , Class(i).Name or Code: Get #nFileNum, , Class(i) - genusis - 17-02-2007 OK I think I got everything there ,but Code: Max_Classes = Val(GetVar(FileName, "INIT", "MaxClasses")) so far it looks like this for me. Code: Sub LoadClasses() So how would I change Code: Max_Classes = Val(GetVar(FileName, "INIT", "MaxClasses")) - William - 17-02-2007 Code: Get #nFileNum, , Max_Classes - genusis - 17-02-2007 so like this Code: Max_Classes = Get #nFileNum, , Max_Classes or just Code: Get #nFileNum, , Max_Classes - William - 17-02-2007 Just Code: Get #nFileNum, , Max_Classes - Robin - 17-02-2007 Instead of getting and putting all that data, you could just do the type array in one go. - William - 17-02-2007 Yeah, like this: Code: Get #nFileNum, , Class(i) - genusis - 17-02-2007 OK got that part well now I'm working on trying to convert my items to binary to. The only problem is Code: Sub SaveItem(ByVal ItemNum As Long) Code: Sub LoadItems() use a different method. one uses Code: 'Item(i). Code: "ITEM" & ItemNum Code: "ITEM" & ItemNum - funkynut - 17-02-2007 Reason their different is because ones loading and ones to save. You should be using Put instead of Get, and use ItemNum instead of i Code: put #nFileNum, , Item(itemnum).Pic And in both the example you've shown, you have forgotten to open the file Code: Open FileName For Binary As #nFileNum Oh, and you've forgotten to close it afterwards in every peice you've shown Code: Close #nFileNum And even if you got it to save load, I got a feeling it wont run right, in my mind when I run that, it loads everything fine, but when you save, you'll only save the last item[/code] - Obsidian - 17-02-2007 The tutorial i recently posted in the 'Optimized Tutorials' Section, called Simple Binary (Single File) Saving... is the same tutorial you were looking at, but much more simplified and easy to use (and it gives you the same speed as the tutorial you're currently struggling with). - genusis - 18-02-2007 thank you guys for your help. Oh and Open FileName For Binary As #nFileNum, and Close #nFileNum where not added becuase I didnt add them yet, but I didnt forget about them lol. Thank you. |