Okay. First, you need to put the line: #include "aps_include" in 3 of the system's scripts, at the very beginning of the script: xp_inc, xp_sc_10k and xp_sc_50k. The rest of the scripts include xp_inc, so you don't need to add the line to them.
Next, as mentioned by GhostOfGod, you must of course pass the correct parameters to the aps_include functions. In all the system's scripts where either GetCampaignInt or SetCampaignInt is called, the object "tied" to the bank account is retrieved with GetPCSpeaker() and named oPC. This is the object you need to pass to GetPersistentInt and SetPersistentInt. Next comes the name of the variable you wish to store or retrieve, wich is the second parameter of the aforementioned functions. In the system you're using, this parameter is the cd key of oPC, retrieved with GetPCPublicCDKey(), and named sCDKey. Next comes the value(or banked xp) you want to set in SetPersistentInt() followed by the table name. So, the infos you need to pass to the new functions are already present in the system you're using, you only need to pass them in a different order in the new function calls.
For instance, let's say you want to "update" the script: xp_deposit_100k.
#include "xp_inc"
void main()
{
object oPC =GetPCSpeaker();
if (GetHitDice(oPC) >= 20)
{
int DepositXP = 100000/fraction;
string sDepositXP = IntToString(DepositXP);
string sCDKey = GetPCPublicCDKey( oPC);
int fXP = GetCampaignInt( "XP", sCDKey) + DepositXP;
int XP = GetXP(oPC) - 100000;
SetCampaignInt( "XP", sCDKey, fXP);
SetXP(oPC, XP);
SpeakString ("You have deposited "+ sDepositXP +" XP.");
}
else
{
SpeakString ("Sorry, but you need to be at least level 20 to use this feature.");
}
}
Would become:
#include "xp_inc"
void main()
{
object oPC =GetPCSpeaker();
if (GetHitDice(oPC) >= 20)
{
int DepositXP = 100000/fraction;
string sDepositXP = IntToString(DepositXP);
string sCDKey = GetPCPublicCDKey( oPC);
int fXP = GetPersistentInt(oPC, sCDKey) + DepositXP;
int XP = GetXP(oPC) - 100000;
SetPersistentInt(oPC, sCDKey, fXP);
SetXP(oPC, XP);
SpeakString ("You have deposited "+ sDepositXP +" XP.");
}
else
{
SpeakString ("Sorry, but you need to be at least level 20 to use this feature.");
}
}
This is taken from one of the system's scripts, for informational purposes, I'm not saying that the code is debugged and secure, it's only "converted" to use aps_include, with the aforementioned functions.
Using MySQL offers you a great deal of flexibility and speed, so you might want to eventually create your own table(s) and write some SQL queries, or even simply test your current queries, so I would advise you use MySQL Query Browser, a very simple and free tool wich will allow you to do all this and more.
Finally, I'm currently using several banking systems in my PW(xp, gold, objects), all custom and under MySQL, so I'd be happy to share some code snippets with you, yet I would not want to disrespect the builder of your current system...
Good luck!
Kato
Modifié par Kato_Yang, 24 juin 2011 - 06:40 .