View previous topic :: View next topic |
Author |
Message |
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Thu Mar 04, 2010 22:30 Post subject: |
|
|
Code: | NWNX-Leto module (build 03 - FF)
(c) 2004 by David Frauzel (dragonsong), dragon@weathersong.net
Information and support: http://weathersong.infopop.cc
* Loading LetoScript.dll...
* LetoScript metamodule activated (3.106ms).
<578.3µs> Req:"SCRIPT", Param:"print q<D:NWNNeverwinter Nights 1servervaultXardéx/> + FindNewestBic q<D:NWNNeverwinter Nights 1servervaultXardéx/>;"
<1.376ms> Req:"SCRIPT", Param:"$RealFile = q<D:NWNNeverwinter Nights 1servervaultXardéx/>;$EditFile = $RealFile + '.utc';FileRename $RealFile, $EditFile;%bic = $EditFile or die;/Str += '10';/Dex += '10';/Con += '10';/Wis += '10';/Int += '10';/Cha += '10';add /FeatList/Feat, 2, gffWord;add /FeatList/Feat, 3, gffWord;add /FeatList/Feat, 4, gffWord;add /FeatList/Feat, 32, gffWord;add /FeatList/Feat, 42, gffWord;add /FeatList/Feat, 44, gffWord;add /FeatList/Feat, 45, gffWord;add /FeatList/Feat, 46, gffWord;%bic = '>';close %bic;FileRename $EditFile, $RealFile;"
|
There you go... |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Thu Mar 04, 2010 22:56 Post subject: |
|
|
Code: |
<578.3µs> Req:"SCRIPT", Param:"print q<D:NWNNeverwinter Nights 1servervaultXardéx/> + FindNewestBic q<D:NWNNeverwinter Nights 1servervaultXardéx/>;"
|
The problem is with the path. letoscript doesn't like back slashes for paths. You'll have to use forward slashes:
Code: | const string SERVERVAULT = "d:/NWN/Neverwinter Nights 1/servervault/"; |
Actually you shouldn't even have to change the servervault constant from Terra's script at all.
Code: | const string SERVERVAULT = "./servervault/"; |
|
|
Back to top |
|
|
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Fri Mar 05, 2010 0:27 Post subject: |
|
|
Its always the little things isnt it...
EDIT
Alright, tried both... Neither worked.
Here is the leto log for the first...
Code: | NWNX-Leto module (build 03 - FF)
(c) 2004 by David Frauzel (dragonsong), dragon@weathersong.net
Information and support: http://weathersong.infopop.cc
* Loading LetoScript.dll...
* LetoScript metamodule activated (2.193ms).
<425.0µs> Req:"SCRIPT", Param:"print q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/> + FindNewestBic q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/>;"
<65.68ms> Req:"SCRIPT", Param:"$RealFile = q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/haminmeyne.bic>;$EditFile = $RealFile + '.utc';FileRename $RealFile, $EditFile;%bic = $EditFile or die;/Str += '10';/Dex += '10';/Con += '10';/Wis += '10';/Int += '10';/Cha += '10';add /FeatList/Feat, 2, gffWord;add /FeatList/Feat, 3, gffWord;add /FeatList/Feat, 4, gffWord;add /FeatList/Feat, 32, gffWord;add /FeatList/Feat, 42, gffWord;add /FeatList/Feat, 44, gffWord;add /FeatList/Feat, 45, gffWord;add /FeatList/Feat, 46, gffWord;%bic = '>';close %bic;FileRename $EditFile, $RealFile;"
|
..The second one was the same except the path was just that ./servervault/blahblah
Terra did hint that his script might not work nowadays... But I thought this leto stuff is ancient anyway, 2005 or something?
EDIT 2
I nearly spurted my coffee on my keyboard when I got to that "$EditFile or die" |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Fri Mar 05, 2010 1:20 Post subject: |
|
|
Actually it does work, in a way...
This line tries to find the newest character file
<425.0µs> Req:"SCRIPT", Param:"print q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/> + FindNewestBic q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/>;"
And seems to be successful because it shows up in the next line:
<65.68ms> Req:"SCRIPT", Param:"$RealFile = q<D:/NWN/Neverwinter Nights 1/servervault/Xardéx/haminmeyne.bic>;
Just tested - without any modifications - the script Terra posted to add 5 Str to a character and it works fine.
Edit:
How exactly do you know it doesn't work?
How are you testing the script? |
|
Back to top |
|
|
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Fri Mar 05, 2010 19:02 Post subject: |
|
|
Well the script is at an OnUsed event on a placeable, I use it, it boots me, then when I come back the character stats are not altered...
(Nor are the feats being added) |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Fri Mar 05, 2010 19:28 Post subject: |
|
|
Then it must be timing, you changed bic before it was saved, so game overwrited it.
What do you got in OnClientExit? _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Fri Mar 05, 2010 21:00 Post subject: |
|
|
Just a check, you're not running this localvault are you? |
|
Back to top |
|
|
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Fri Mar 05, 2010 21:22 Post subject: |
|
|
Hey Shado0ow.
Theres no OnClientLeave script and the server is server-vault-only (and so is the character) when I have tested it. |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Sat Mar 06, 2010 0:21 Post subject: |
|
|
Some more suggestions:
- Check the servervault to see if there are any files with numbers at the end and delete them
- Comment out the BootPC line in the script.
Then after you used the placeable check the servervault to see if the bic file was altered (last modification date). Alternatively, search for all files which were modified in the last, say 2 minutes. |
|
Back to top |
|
|
Lokey
Joined: 02 Jan 2005 Posts: 158
|
Posted: Sat Mar 06, 2010 12:11 Post subject: |
|
|
Feats have to be added to the levelstatlist feat section as well as to the featlist to work.
Code: | add /FeatList/Feat, type => gffWord, value => YOUR_FEAT_#;
add /LvlStatList/[0]/FeatList/Feat, type => gffWord, value => YOUR_FEAT_#; |
The number in [ ] is the level at which to add it (0 to pc's current level - 1).
We're also passing stuff like /Str = /Str + 10; I'm not sure whether leto accepts +=.
Some other stuff seems fishy... Don't delimit numbers and the leading print seems weird. Hope this helps. (Yes, edits may be being done but overwritten, you have to call leto in client exit since bic will be overwritten on logout.) _________________ Neversummer PW NWNx powered mayhem |
|
Back to top |
|
|
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Sat Mar 06, 2010 12:35 Post subject: |
|
|
Alright..
Commented boot, and the .bic was indeed modified as I used the placeable, but when I checked the file with leto (the normal leto) the file was not modified. No feats added or abilities changed.
I also tried to save the generated leto script as local string on the PC, and then execute that string with the 'filewriting' function OnClientLeave, but to no avail.
MaxRock, you said it worked with you... Could you post all the scripts related, and then I could test it that way?
EDIT
Terras script does put the feat to both lists, but I cant really do anything about the other fishiness because I dont understand the leto stuff much/at all. |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Sat Mar 06, 2010 14:57 Post subject: |
|
|
Ah, I see. This your problem.
Remove this line:
Code: | Leto_ExecuteFileWritingOperation(oPC, sScript); |
And replace it with
Code: | SetLocalString(oPC, "LETOSCRIPT", sScript); |
Then in the OnClientLeave script:
Code: | #include "inc_letoscript"
void main()
{
object oLeaving = GetExitingObject();
string sLeto = GetLocalString(oLeaving, "LETOSCRIPT");
if (sLeto != "")
{
Leto_ExecuteFileWritingOperation(oLeaving, sLeto);
}
} |
And in the OnClientEnter script, add the section:
Code: | if (GetLocalString(oEntering, "LETOSCRIPT") != "")
{
DeleteLocalString(oEntering, "LETOSCRIPT");
} |
This has to be done OnClientEnter, because SetLocalString doesn't work on leaving objects. Also you might want to consider using ActivatePortal instead of BootPC, because ActivatePortal to the player looks more like an area transition than a rude "You have been booted" message.
The reason for your problem (I suspect) is that the file writing operation happens, as normal, but BEFORE the PC leaves. When they leave, the copy of their character file in memory is saved over the changes you just made to the file on disk. To combat this, we make sure the PC is logged out at the time by executing the actual script OnClientLeave. |
|
Back to top |
|
|
xardex
Joined: 02 Mar 2010 Posts: 40
|
Posted: Sat Mar 06, 2010 18:19 Post subject: |
|
|
Thats what I figured too, and as I said in my last post, tried it... But it didnt work.
I also tried your way, but it didnt work either... |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Sat Mar 06, 2010 20:50 Post subject: |
|
|
Gff editor helped me a lot with writing letoscript commands.
http://nwvault.ign.com/View.php?view=Other.Detail&id=247
It's not as flashy as leto but you can see the structure of a bic file much better. Works for any other nwn resource file too.
Edit
Yea... helps to actually do a proper test.
Using a placeable to edit the character currently playing does indeed do nothing. I had used a DM earlier to see if the script works and it did edit the newest file in my servervault.
The problem is very simple actually: Timing!
Letoscript edits the character file before the player is really booted which causes the game to overwrite the changes with the unedit one.
Replace the Leto_ExecuteFileWritingOperation function with the following:
Code: |
//::---------------------------------------------------------------------------
void ExecuteLetoScript(string sScript) {
SetLocalString( GetModule( ), "NWNX!LETO!SCRIPT", sScript );
}
//::---------------------------------------------------------------------------
void Leto_ExecuteFileWritingOperation( object oPC, string sScript, int nBoot = TRUE ){
string sPath = Leto_GetBicPath( oPC );
if( nBoot )
BootPC( oPC );
string sEXEScript =
"$RealFile = q<" + sPath + ">;" +
"$EditFile = $RealFile + '.utc';" +
"FileRename $RealFile, $EditFile;" +
"%bic = $EditFile or die;" +
sScript +
"%bic = '>';" +
"close %bic;" +
"FileRename $EditFile, $RealFile;";
DelayCommand(1.0, ExecuteLetoScript(sEXEScript));
}
|
This will boot the player and wait 1 seconds to make sure the game has written the bic file.
Tested and it's working |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sat Mar 06, 2010 23:07 Post subject: |
|
|
Oh, yeah.
Code: | AssignCommand( GetModule(), Leto_ExecuteFileWritingOperation( ... ) ); |
If it runs on the PC it won't work since the PC is booted. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
|
|
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
|