| Mirage Source http://web.miragesource.net/forums/ |
|
| I need some help http://web.miragesource.net/forums/viewtopic.php?f=201&t=4141 |
Page 1 of 1 |
| Author: | Shadow Dragon [ Mon Aug 11, 2008 10:31 pm ] |
| Post subject: | I need some help |
Hey guys I decided to try and make DarkX's code that he posted a while back, actually complete but I can't seem to get it to even make the file it just saves but the file does not show up. And I can't get it to load or save any of the files I need it to load Code: Sub SavePlayer(ByVal Index As Long) Dim FileName As String Dim i As Long Dim n As Long FileName = App.Path & "\Accounts\" & Trim(player(index).Name) & "\" & Trim(Player(Index).Login) & ".ini" Call PutVar(FileName, "GENERAL", "Login", Trim(Player(Index).Login)) Call PutVar(FileName, "GENERAL", "Password", Trim(Player(Index).Password)) For i = 1 To MAX_CHARS ' General Call PutVar(FileName, "CHAR" & i, "Name", Trim(Player(Index).Char(i).Name)) Call PutVar(FileName, "CHAR" & i, "Class", STR(Player(Index).Char(i).Class)) Call PutVar(FileName, "CHAR" & i, "Sex", STR(Player(Index).Char(i).Sex)) Call PutVar(FileName, "CHAR" & i, "Sprite", STR(Player(Index).Char(i).Sprite)) Call PutVar(FileName, "CHAR" & i, "Level", STR(Player(Index).Char(i).Level)) Call PutVar(FileName, "CHAR" & i, "Exp", STR(Player(Index).Char(i).Exp)) Call PutVar(FileName, "CHAR" & i, "Access", STR(Player(Index).Char(i).Access)) Call PutVar(FileName, "CHAR" & i, "PK", STR(Player(Index).Char(i).PK)) Call PutVar(FileName, "CHAR" & i, "Guild", STR(Player(Index).Char(i).Guild)) ' Vitals Call PutVar(FileName, "CHAR" & i, "HP", STR(Player(Index).Char(i).HP)) Call PutVar(FileName, "CHAR" & i, "MP", STR(Player(Index).Char(i).MP)) Call PutVar(FileName, "CHAR" & i, "SP", STR(Player(Index).Char(i).SP)) ' Stats Call PutVar(FileName, "CHAR" & i, "STR", STR(Player(Index).Char(i).STR)) Call PutVar(FileName, "CHAR" & i, "DEF", STR(Player(Index).Char(i).DEF)) Call PutVar(FileName, "CHAR" & i, "SPEED", STR(Player(Index).Char(i).SPEED)) Call PutVar(FileName, "CHAR" & i, "MAGI", STR(Player(Index).Char(i).MAGI)) Call PutVar(FileName, "CHAR" & i, "POINTS", STR(Player(Index).Char(i).POINTS)) ' Worn equipment Call PutVar(FileName, "CHAR" & i, "ArmorSlot", STR(Player(Index).Char(i).ArmorSlot)) Call PutVar(FileName, "CHAR" & i, "WeaponSlot", STR(Player(Index).Char(i).WeaponSlot)) Call PutVar(FileName, "CHAR" & i, "HelmetSlot", STR(Player(Index).Char(i).HelmetSlot)) Call PutVar(FileName, "CHAR" & i, "ShieldSlot", STR(Player(Index).Char(i).ShieldSlot)) ' Check to make sure that they aren't on map 0, if so reset'm If Player(Index).Char(i).Map = 0 Then Player(Index).Char(i).Map = START_MAP Player(Index).Char(i).x = START_X Player(Index).Char(i).y = START_Y End If ' Position Call PutVar(FileName, "CHAR" & i, "Map", STR(Player(Index).Char(i).Map)) Call PutVar(FileName, "CHAR" & i, "X", STR(Player(Index).Char(i).x)) Call PutVar(FileName, "CHAR" & i, "Y", STR(Player(Index).Char(i).y)) Call PutVar(FileName, "CHAR" & i, "Dir", STR(Player(Index).Char(i).Dir)) ' Inventory For n = 1 To MAX_INV Call PutVar(FileName, "CHAR" & i, "InvItemNum" & n, STR(Player(Index).Char(i).Inv(n).Num)) Call PutVar(FileName, "CHAR" & i, "InvItemVal" & n, STR(Player(Index).Char(i).Inv(n).Value)) Call PutVar(FileName, "CHAR" & i, "InvItemDur" & n, STR(Player(Index).Char(i).Inv(n).Dur)) Next n ' Spells For n = 1 To MAX_PLAYER_SPELLS Call PutVar(FileName, "CHAR" & i, "Spell" & n, STR(Player(Index).Char(i).Spell(n))) Next n Next i Sub LoadPlayer(ByVal Index As Long, ByVal Name As String) Dim FileName As String Dim i As Long Dim n As Long Call ClearPlayer(Index) FileName = App.Path & "\Accounts\" & Trim(Player(Index).Name) & Trim(Name) & ".ini" Player(Index).Login = GetVar(FileName, "GENERAL", "Login") Player(Index).Password = GetVar(FileName, "GENERAL", "Password") For i = 1 To MAX_CHARS ' General Player(Index).Char(i).Name = GetVar(FileName, "CHAR" & i, "Name") Player(Index).Char(i).Sex = Val(GetVar(FileName, "CHAR" & i, "Sex")) Player(Index).Char(i).Class = Val(GetVar(FileName, "CHAR" & i, "Class")) Player(Index).Char(i).Sprite = Val(GetVar(FileName, "CHAR" & i, "Sprite")) Player(Index).Char(i).Level = Val(GetVar(FileName, "CHAR" & i, "Level")) Player(Index).Char(i).Exp = Val(GetVar(FileName, "CHAR" & i, "Exp")) Player(Index).Char(i).Access = Val(GetVar(FileName, "CHAR" & i, "Access")) Player(Index).Char(i).PK = Val(GetVar(FileName, "CHAR" & i, "PK")) Player(Index).Char(i).Guild = Val(GetVar(FileName, "CHAR" & i, "Guild")) ' Vitals Player(Index).Char(i).HP = Val(GetVar(FileName, "CHAR" & i, "HP")) Player(Index).Char(i).MP = Val(GetVar(FileName, "CHAR" & i, "MP")) Player(Index).Char(i).SP = Val(GetVar(FileName, "CHAR" & i, "SP")) ' Stats Player(Index).Char(i).STR = Val(GetVar(FileName, "CHAR" & i, "STR")) Player(Index).Char(i).DEF = Val(GetVar(FileName, "CHAR" & i, "DEF")) Player(Index).Char(i).SPEED = Val(GetVar(FileName, "CHAR" & i, "SPEED")) Player(Index).Char(i).MAGI = Val(GetVar(FileName, "CHAR" & i, "MAGI")) Player(Index).Char(i).POINTS = Val(GetVar(FileName, "CHAR" & i, "POINTS")) ' Worn equipment Player(Index).Char(i).ArmorSlot = Val(GetVar(FileName, "CHAR" & i, "ArmorSlot")) Player(Index).Char(i).WeaponSlot = Val(GetVar(FileName, "CHAR" & i, "WeaponSlot")) Player(Index).Char(i).HelmetSlot = Val(GetVar(FileName, "CHAR" & i, "HelmetSlot")) Player(Index).Char(i).ShieldSlot = Val(GetVar(FileName, "CHAR" & i, "ShieldSlot")) ' Position Player(Index).Char(i).Map = Val(GetVar(FileName, "CHAR" & i, "Map")) Player(Index).Char(i).x = Val(GetVar(FileName, "CHAR" & i, "X")) Player(Index).Char(i).y = Val(GetVar(FileName, "CHAR" & i, "Y")) Player(Index).Char(i).Dir = Val(GetVar(FileName, "CHAR" & i, "Dir")) ' Check to make sure that they aren't on map 0, if so reset'm If Player(Index).Char(i).Map = 0 Then Player(Index).Char(i).Map = START_MAP Player(Index).Char(i).x = START_X Player(Index).Char(i).y = START_Y End If ' Inventory For n = 1 To MAX_INV Player(Index).Char(i).Inv(n).Num = Val(GetVar(FileName, "CHAR" & i, "InvItemNum" & n)) Player(Index).Char(i).Inv(n).Value = Val(GetVar(FileName, "CHAR" & i, "InvItemVal" & n)) Player(Index).Char(i).Inv(n).Dur = Val(GetVar(FileName, "CHAR" & i, "InvItemDur" & n)) Next n ' Spells For n = 1 To MAX_PLAYER_SPELLS Player(Index).Char(i).Spell(n) = Val(GetVar(FileName, "CHAR" & i, "Spell" & n)) Next n Next i End Sub Could you someone please help me out with this it seems like it would be so useful any help is appreciated. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|