Ok I fixed the majority of a code and based the fixes off of Robin's code but I can not seem to get it to completely function, it makes the Bank folder and sets everything up for the system but it will not save the players bank within the bank folder, and here seems to be why but I can't figure out how to fix it and I have tried about every way I can think of
Ok first off in packet 'Login' it highlights .Bank and gives the error message "method or data member not found"
Code: If FileExist("banks\" & Trim(Name) & ".ini") = False Then
For i = 1 To MAX_CHARS
For n = 1 To MAX_BANK
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemNum" & n, STR(Player(Index).Char(i).Bank(n).Num))
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemVal" & n, STR(Player(Index).Char(i).Bank(n).Value))
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemDur" & n, STR(Player(Index).Char(i).Bank(n).Dur))
Next n
Next i
End If
and in sub clear player
Code: For n = 1 To MAX_BANK
Player(index).Char(i).Bank(n).Num = 0
Player(index).Char(i).Bank(n).Value = 0
Player(index).Char(i).Bank(n).Dur = 0
Next n
By the way if it helps any this is server side only, the Code: for n = 1 to max_bank
is when I try running it, and Code: If FileExist("banks\" & Trim(Name) & ".ini") = False Then
is when I try to login and or create a new account, I worked out the rest and got it working(because origanally it was not saving the bank folder) but so far I am at a loss for a answer.
Code: If FileExist("\banks\" & Trim(Name) & ".ini") = False Then
Or..
Code: If FileExist(app.path & "\banks\" & Trim(Name) & ".ini") = False Then
So try with another \ or create the app.path is what your saying?
DarkX Wrote:So try with another \ or create the app.path is what your saying?
Yeah, I'm not 100%, cause I don't have the fileexist function in front of me, but those would be my guesses.
Ok well here's the one from sub saveplayer with some moding to it
Code: FileName = App.Path & "\Accounts\" & Trim(player(index).Name) & Trim(Player(Index).Login) & ".ini"
look about close enough to you
DarkX Wrote:Ok well here's the one from sub saveplayer with some moding to it
Code: FileName = App.Path & "\Accounts\" & Trim(player(index).Name) & Trim(Player(Index).Login) & ".ini"
look about close enough to you
I would need an example of another if fileexist statement to tell you. Though, I'm pretty sure it's the second one.
I think that is possibly the right way(number 2), I will try it when I get home later tonight and let you know how it works out.
Ok I realise that I am double posting and I am sorry for that, but... I hate this f-n code I'm working with, I chaged the app.path to be as if it were in another save system but that did not work, it still issues the same error. as I said when I made the post in the first place I have tried everything that I am familiar with, and Perfekt's Idea. No solution yet.
Thanks for any help
Posts: 2,742
Threads: 115
Joined: Jun 2006
Reputation:
0
Obviously not, hence the lack of posts.
If you can't sort your bank system out, re-do it from scratch and this time plan it out first.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
I have started to re-do it, from the basics of the Inventory system, adding a deposit and withdraw system, which are sort of acting as the pickup item and dropitem code, then modifing it to have a actual defined system to Identify that the bank has the item. Which is going to take me a little longer, but if it works it'll be good(And I think I figured out what I did wrong with the other one.) Since I had made the code to where the Bank was actually stored within the players account like the inventory,
example:
Code: player
all the normal stats
then
Inv 1-20
Spell 1-20
Bank 1-100
anyother things stored in player profile
So I am taking out the this Code: If FileExist("banks\" & Trim(Name) & ".ini") = False Then
For i = 1 To MAX_CHARS
For n = 1 To MAX_BANK
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemNum" & n, STR(Player(Index).Char(i).Bank(n).Num))
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemVal" & n, STR(Player(Index).Char(i).Bank(n).Value))
Call PutVar(App.Path & "\banks\" & Trim(Name) & ".ini", "CHAR" & i, "BankItemDur" & n, STR(Player(Index).Char(i).Bank(n).Dur))
and doing like Robin and making it's own sub, and making the Code: bank(1 to MAX_BANK) as BankRec
instead of Code: bank(1 to MAX_BANK) as BankRec
and making the BankRec Identify the Num, Val and Dur instead of using the PlayerRec. (Hoping that it works)
So X you figured out this code? Your signiture says so, mind sharing some basics?
Yeah, but it is not compatible with MSE build 1 or above, so if you want to use it. I might share and you can have fun... Trying to make it work on MSE but that damned .Bank thing does not wanna work. which is causing alot of issues towards me making a tutorial. And if I give it to you it's straight code so you have to figure out where it goes on your own.
by the way, I removed the saving in a seperate folder, in {playername}.ini, it saves to the characters .ini just like the inventory,
so it's like call save player
Code: [char1]
'name
'pass
'stats
blah
'inventory
blah
'spells
blah
'Bank
blah
I don't suppose anyone feels like making a MS4 bank tut, or possibly explaining in-depth how to do it? I'd really like to get one/make one, but I'm far too inexperienced.
Posts: 2,742
Threads: 115
Joined: Jun 2006
Reputation:
0
I'll add a client-side part to mine when I get some free time.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
I found out why the other one was not working, I had to remove the check if fileexist and putvars from the login packet and it's working pretty nicely now, just it for some odd reason saves the entire char stat set in the banks, it's like having a back up character.
Robin Wrote:I'll add a client-side part to mine when I get some free time.
Alright sounds great. Thanks.
I just wanted to let you guys know that you should consider converting your player accounts to binary. Having that much data stored in a .INI file is gonna make it huge, which means you'll likely experience server lag when a lot of players are online and the server saves. It'll probably also lag when players leave the game.
Posts: 2,742
Threads: 115
Joined: Jun 2006
Reputation:
0
Saving it in the player's .ini file is stupid anyway. Just store it in a separate file, as .dat.
Like I did
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
|