logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Baby Got Back?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Tue Aug 13, 2013 20:21    Post subject: Baby Got Back? Reply with quote

I'm trying to use the nwnx_systemdata32 to backup characters by moving them to another folder for 7 days before they're actually deleted. The part that checks the folder(on server startup) works without a hitch, but ACTUALLY moving the file to the other folder always seems to fail no matter what I do. Log below:

NWNX Systemdata V.2.2
Created By Terra_777

o 225 <- STRFTIME( ~j, 0, , , );
o 13 <- STRFTIME( ~H, 0, , , );
o NeverwinterNightsNWNsavesCharacter Backup <- GETFIRSTFILE( C:NeverwinterNightsNWNsavesCharacter Backup, , , , );
o 1376424315 <- GETFILEUNIX( 1, NeverwinterNightsNWNsavesCharacter Backup, , , );
o 225 <- STRFTIME( ~j, 1376424315, , , );
o 0 <- GETNEXTFILE( , , , , );
o 0 <- GETLASTUSEDFILE( C:NeverwinterNightsNWNservervaulthighv priest, , , , );
o 0 <- COPYFILE( 0, C:NeverwinterNightsNWNsavesCharacter Backup, 0, , );


The paths are:
Original folder = C:\NeverwinterNights\NWN\servervault

Destination folder = C:\NeverwinterNights\NWN\saves\Character Backup

Code involved here:
Code:
void ClearBackup(string SystemDay, string SystemHour)
{
string sPath = "C:\NeverwinterNights\NWN\saves\Character Backup\";
string sFirst = NWNX_GetFirstFile(sPath);
int Stamp;
int nSystemDay = StringToInt(SystemDay);
int nSystemHour = StringToInt(SystemHour)+6;
while(sFirst != "0")
{
Stamp = NWNX_GetTimeStampFromFile(1, sFirst);
if(nSystemDay >= StringToInt(NWNX_RealLifeClock("%j", Stamp))+7)
{
if(nSystemHour >= StringToInt(NWNX_RealLifeClock("%H", Stamp)))
{
NWNX_DeleteFile(sFirst);
}
}
sFirst = NWNX_GetNextFile();
}
}


Code:
string BicFile = GetBicPath(oPC);
string sGuild = GetGuildName(oPC);
string sOrigin = NWNX_GetLatestUsedFile("C:\NeverwinterNights\NWN\servervault\"+GetPCPlayerName(oPC)+"\");
if(GetItemPossessedBy(oPC, "Storage_Box1") != OBJECT_INVALID)
{
StoreBoxes(oPC);
}
if(GetStringLeft(GetName(oPC), 6) != "<TEST>")
{
if(sGuild != "")
{
string sPrivateXP = RetrieveGuildBankAmount(sGuild, 0, 1, oPC);
string sPrivateGP = RetrieveGuildBankAmount(sGuild, 0, 0, oPC);
int nPrivateXP = StringToInt(sPrivateXP);
int nPrivateGP = StringToInt(sPrivateGP);
SetGuildBankAmount(sGuild, 0, 1, nPrivateXP+GetXP(oPC), oPC);
SetGuildBankAmount(sGuild, 0, 0, nPrivateGP+GetGold(oPC), oPC);
}
NWNX_CopyFile(sOrigin, "C:\NeverwinterNights\NWN\saves\Character Backup\");
}[quote][/quote]
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Tue Aug 13, 2013 23:57    Post subject: Reply with quote

You have to specify the name of the destination file too.

NWNX_CopyFile(sOrigin, "C:\NeverwinterNights\NWN\saves\Character Backup\newfileandstuff.bic");

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363851%28v=vs.85%29.aspx
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Tue Aug 20, 2013 20:29    Post subject: Reply with quote

Now I'm having a different issue. After you specified that I did some more testing and found multiple issues in my implementation of it.

o 232 <- STRFTIME( ~j, 0, , , );
o 13 <- STRFTIME( ~H, 0, , , );
o loreklenner.bic <- GETFIRSTFILE( C:/NeverwinterNights/NWN/saves/Character Backup/*.bic, , , , );
o 0 <- GETFILEUNIX( 3, loreklenner.bic, , , );
o 232 <- STRFTIME( ~j, 0, , , );
o reaper.bic <- GETNEXTFILE( , , , , );
o 0 <- GETFILEUNIX( 3, reaper.bic, , , );
o 232 <- STRFTIME( ~j, 0, , , );
o 0 <- GETNEXTFILE( , , , , );

The copy function now works great(thanks for the help there), but as you can see GETFILEUNIX ALWAYS gets 0... but I can't understand why because the file is valid.
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Tue Aug 20, 2013 21:25    Post subject: Reply with quote

Missing the filepath to loreklenner.bic
_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group