![]() |
Clearing array error - 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: Clearing array error (/showthread.php?tid=1525) |
Clearing array error - GIAKEN - 24-01-2008 Alrighty then...as I was looking through optimizations, I stumbled upon how to clear players and such easier: Code: Sub ClearPlayer(ByVal Index As Long) I've also stumbled upon a problem with this. For strings that are given a max length property (like Name As String * NAME_LENGTH) the value of that string is given the number of spaces the property's number is (so for Name it would be given 20 spaces, since NAME_LENGTH is 20). So now every check for If Player().Whatever = "" or vbNullString, the value will return opposite of what we want...for example: Code: Function IsLoggedIn(ByVal Index As Long) As Boolean That will always return true and won't let anybody login. What's the best way to solve this? I know to just set them = "", but that's too tedious...there has to be another way than going through all the Clear subs and checking all the strings in the array and making sure they're set to "". Re: Clearing array error - GIAKEN - 24-01-2008 Could I just remove the fixed lengths on the strings? I don't think they're needed, really...just do a length check to verify it's good when they register and so on. Re: Clearing array error - GIAKEN - 24-01-2008 Alrighty then...thanks for the help. The source is looking nice ![]() Re: Clearing array error - Robin - 25-01-2008 That's not hard :roll: Re: Clearing array error - GIAKEN - 26-01-2008 I know, it was really simple. I just thought there was an easier way with the empty array to clean it out without giving it the spaces. Re: Clearing array error - Robin - 26-01-2008 Oops, forgot to quote again. Was talking about this: GIAKEN Wrote:It's much cleaner than Elysium's is right now. |