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 
 
Spawn Plugin v106.108.1.1
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Fri Aug 31, 2007 3:56    Post subject: Reply with quote

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
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Fri Aug 31, 2007 5:01    Post subject: Reply with quote

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 Crying or Very sad
_________________
Jim (aka, Urlord)
Visit the Persistent World of Nymri
Back to top
View user's profile Send private message Send e-mail
nosfe



Joined: 25 Apr 2007
Posts: 22

PostPosted: Fri Aug 31, 2007 8:56    Post subject: Reply with quote

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
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Fri Aug 31, 2007 14:30    Post subject: Reply with quote

How do I force the /F parameter?
_________________
Jim (aka, Urlord)
Visit the Persistent World of Nymri
Back to top
View user's profile Send private message Send e-mail
nosfe



Joined: 25 Apr 2007
Posts: 22

PostPosted: Fri Aug 31, 2007 15:01    Post subject: Reply with quote

if you tape on Dos command :

Code:

del ?  <Return>


you can see as parameter /F can do

del /F c:\zfozfhzo\krfoe
Back to top
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Fri Aug 31, 2007 15:46    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Fri Aug 31, 2007 16:56    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Fri Aug 31, 2007 21:07    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sat Sep 01, 2007 1:22    Post subject: Reply with quote

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
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Sat Sep 01, 2007 20:43    Post subject: Reply with quote

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! Very Happy
_________________
Jim (aka, Urlord)
Visit the Persistent World of Nymri
Back to top
View user's profile Send private message Send e-mail
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sun Sep 02, 2007 0:53    Post subject: Reply with quote

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! Very Happy


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
View user's profile Send private message
seed



Joined: 01 Dec 2006
Posts: 44

PostPosted: Sun Sep 02, 2007 16:49    Post subject: Reply with quote

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
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Sun Sep 02, 2007 17:26    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Mon Sep 03, 2007 0:28    Post subject: Reply with quote

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
View user's profile Send private message
Urlord



Joined: 17 Nov 2006
Posts: 122

PostPosted: Mon Sep 03, 2007 17:19    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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