View previous topic :: View next topic |
Author |
Message |
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Fri Aug 31, 2007 3:56 Post subject: |
|
|
Urlord wrote: | Just thinking out loud here. Does the SpawnCommand function put the space between cmd/c and sCommand? Just grasping here. |
Not as such...
It starts a wxWidgets "Process" which is two parts. the command (cmd) and the parameters "del ..." I just let this process class do it's thing, nothing special - I've hidden as many of the gotcha's in the plugin as I could.
Cheers
Gryphyn. |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Fri Aug 31, 2007 5:01 Post subject: |
|
|
Well, I move the SpawnCommand call to the OnClientLeave event function. It is literally the last thing that happend before the PC leaves.
It still doesn't work. I don't know what to do now.
Oh well _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
nosfe
Joined: 25 Apr 2007 Posts: 22
|
Posted: Fri Aug 31, 2007 8:56 Post subject: |
|
|
ok, i made tests and work for me with this :
string sBicFileName = GetFirstName(oPC)+GetLastName(oPC);
string sCommand = SpawnQuote("del " + SpawnQuote(SpawnEscape("C:|Program Files|Atari|Neverwinter Nights 2|Servervault|"+sBicFileName+".bic")));
for when export caractere it is this file format name.
But you must force the suppression with parameter /F to the del command because it is in READONLY file |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
|
Back to top |
|
|
nosfe
Joined: 25 Apr 2007 Posts: 22
|
Posted: Fri Aug 31, 2007 15:01 Post subject: |
|
|
if you tape on Dos command :
you can see as parameter /F can do
del /F c:\zfozfhzo\krfoe |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Fri Aug 31, 2007 15:46 Post subject: |
|
|
Interestingly del ? <return> gives no feedback. Oh well, I googled it and read about the del syntax.
I have changed sCommand to:
string sCommand = SpawnQuote("del /F " + SpawnQuote(SpawnEscape("D:|games|nwn2|Servervault|"+sPlayerName+"|"+sBicFileName+".bic")));
I hope this works? _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Fri Aug 31, 2007 16:56 Post subject: |
|
|
OKAY!!! I figured it out.
The script that I had calling the DelayCommand(SpawnCommand(sCommand)) was being executed from the Player Menu conversation where both sides of the conversation are the PC object.
So, appearantly the DelayCommand assigns the command to OBJECT_SELF.
If the Delay was AFTER the PC was booted, there was nothing to Execute, because the PC was already booted.
If the Delay was BEFORE the PC was booted, the BootPC Function saved a new copy of the Bic file.
Here is how I had to do it:
AssignCommand(oModule, DelayCommand(6.0, BootPC(oPC)));
AssignCommand(oModule, DelayCommand(10.0, SpawnCommand(sCommand, 0)));
It is working like a champ now.
I want to thank everyone for their help with this. It was a bear to figure out. And thanks Gryphyn for writting NWNX_Spawn. _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Fri Aug 31, 2007 21:07 Post subject: |
|
|
After testing, NWN2 strips out most (but not all) special characters when creating the bic filename. But it keeps them in the FirstName and LastName. This causes problems because you cannot locate the Bic file.
Any ideas on how to fix that Gryphyn? _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sat Sep 01, 2007 1:22 Post subject: |
|
|
Urlord wrote: | After testing, NWN2 strips out most (but not all) special characters when creating the bic filename. But it keeps them in the FirstName and LastName. This causes problems because you cannot locate the Bic file.
Any ideas on how to fix that Gryphyn? |
The character stripping is done prior to (or during) the NWNX??? NWScript function. So the plugin never gets to see the special characters or where they would be located in the string.
This is the purpose of SpawnEscape().
As you're dealing with filenames you could use the 'wild-card' characters instead *,? (*=zero,or more, of any character, ?=any single character)
but it does mean you could catch extra files eg file? = file1, file2, file3 etc
Do you have a list (or at least examples) of what these characters are - the only definite one I know of is "\".
Cheers
Gryphyn |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Sat Sep 01, 2007 20:43 Post subject: |
|
|
Gryphyn wrote: | Do you have a list (or at least examples) of what these characters are - the only definite one I know of is "\". |
The example I tried was to create a character named:
First Name = !@#$%^&*()_+
Last Name = -={[}[|\;:'",./<>?
When using GetName(), GetFirstName() or GetLastName() the names were almost right on. I think a couple of characters got removed. However, the BIC file was named _-'.bic. I am wondering if there is a way to ensure that we can get the right bic file name?
I also tested to see if NWNX4 was vulnerable to SQL Injection and it is not. Good Job! _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sun Sep 02, 2007 0:53 Post subject: |
|
|
Urlord wrote: | Gryphyn wrote: | Do you have a list (or at least examples) of what these characters are - the only definite one I know of is "\". |
The example I tried was to create a character named:
First Name = !@#$%^&*()_+
Last Name = -={[}[|\;:'",./<>?
When using GetName(), GetFirstName() or GetLastName() the names were almost right on. I think a couple of characters got removed. However, the BIC file was named _-'.bic. I am wondering if there is a way to ensure that we can get the right bic file name?
I also tested to see if NWNX4 was vulnerable to SQL Injection and it is not. Good Job! |
Right, a couple of restrictions...you call only use characters allowable for filenames, so some of those characters just won't make it to a filename. It's an OS thing. My guess is that Obi simply strip out the invalid characters - but then add a numeric suffix to avoid duplicates (eg file1, file2, file3)
This extensive 'character-stripping' is not something I deal with in the spawn plugin. The only way to ensure you have the right filename is to read it from the BIC itself (defeats the purpose) or from the PC object in-game.
Is there a GetFile(oPC) function?
Cheers
Gryphyn |
|
Back to top |
|
|
seed
Joined: 01 Dec 2006 Posts: 44
|
Posted: Sun Sep 02, 2007 16:49 Post subject: |
|
|
from all the other GetBICName() type functions I have seen, the best way to do this is to save the character file, then read the ServerVault directory for the Account and get the Most Recently Modified file and assume that that is the current bic. |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Sun Sep 02, 2007 17:26 Post subject: |
|
|
That would work Seed. But I have no idea how to do that with Spawn. It took me 2 days to just barely get del working. _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Mon Sep 03, 2007 0:28 Post subject: |
|
|
Urlord wrote: | That would work Seed. But I have no idea how to do that with Spawn. It took me 2 days to just barely get del working. |
Don't waste any effort Urlord - spawn doesn't return results, it simply (well not so simply) runs tasks as an extra process.
dir *.* /TA/O-D (files in most recently accessed order)
dir *.* /TW/O-D (files in most recently updated/written order)
you could write a batch file (.bat/.cmd) to do the work.
and use spawn to launch the batch file SpawnCommand("batch.bat");
Cheers
Gryphyn |
|
Back to top |
|
|
Urlord
Joined: 17 Nov 2006 Posts: 122
|
Posted: Mon Sep 03, 2007 17:19 Post subject: |
|
|
Can parameters be passed in to bat/cmd files? If so, an example please? _________________ Jim (aka, Urlord)
Visit the Persistent World of Nymri |
|
Back to top |
|
|
|