View previous topic :: View next topic |
Author |
Message |
zamba
Joined: 06 Mar 2008 Posts: 2
|
Posted: Thu Mar 06, 2008 18:09 Post subject: NWNX and Leto |
|
|
So I tried to get the information from other sources from the Vault (PRC, Shayan's Subraces, HGLL...) and take the things out, I need. But nothing works.
I give NWNX the Leto Leto-String, that looks like this:
"%char= q!g:/nwn/servervault/morisfearshaler.bic!; /Cha = /Cha+5; %char = '>'; close %char; "
and get an Leto Error back:
[Error] Invalid field name at NWNX-Leto line 1 pos 51 (should be the "/" before the first "Cha".
Another line was:
"%char= q{g:/nwn/servervault/blackigel/canikiwelter.bic}; /Cha = /Cha+10; %char = '>'; close %char; "
All "versions" of the script didn't work. I also tried different Leto-Versions (sometimes they are provided with packages). The letoscript.dll varies in size, but the realease-notes say, they are the same version *irritated*.
I also tried different path-formats ("g:\nwn\...", "g:/nwn/...", "//nwn//...). I'm running on Windows here.
It's working, technically, something has to be wrong in the string (otherwise I won't get an error-message).
All I need is to change stat's, give and take feats ans raise or lower skills.
Could someone be so kind to write me a string that's working? And the information which version of Leto and where to get it (latest version i found was 03+26)?
Thank's. |
|
Back to top |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Fri Mar 07, 2008 5:59 Post subject: |
|
|
Version 26 is critically bugged. The last full stable version is 24, which you can get with HGLL. There's also release candidate 3 for version 27, which should be stable, but I can't guarantee it as I don't use it.
As for the rest, you can lift the code from ApplyLetoScriptToPC in this include, as well as anything in HGLL:
Code: | const string NWN_DEV_SERVER = "123";
const string NWN_VAULT_LIVE = "/home/funkyswerve/nwn/servervault/";
const string NWN_VAULT_DEV = "/home/funkyswerve/nwn-dev/servervault/";
const string NWN_SOURCE_DIR = "/home/funkyswerve/nwn/source/";
string LetoScript (string sScript) {
SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", sScript);
return GetLocalString(GetModule(), "NWNX!LETO!SCRIPT");
}
string GetBicFilePath (object oPC) {
string sVaultPath = NWN_VAULT_LIVE;
if (GetLocalString(GetModule(), "ServerNumber") == NWN_DEV_SERVER)
sVaultPath = NWN_VAULT_DEV;
string sBicPath = sVaultPath + GetPCPlayerName(oPC) + "/";
return LetoScript("print q<" + sBicPath + "> + " + "FindNewestBic q<" + sBicPath + ">;");
}
string VerifyBicFileName (object oPC) {
string sChar, sBicFile;
string sName = GetStringLowerCase(GetName(oPC));
int i, nLen = GetStringLength(sName);
for (i = 0; i < nLen; i++) {
sChar = GetSubString(sName, i, 1);
if (TestStringAgainstPattern("(*a|*n|*w|'|-|_)", sChar)) {
if (sChar != " ")
sBicFile += sChar;
}
}
return GetStringLeft(sBicFile, 15);
}
int GetSpecialistSchool (object oPC) {
string sBic = GetLocalString(oPC, "BicFilePath");
if (sBic == "" || GetLevelByClass(CLASS_TYPE_WIZARD, oPC) < 1)
return -2;
int nPos;
if (GetClassByPosition(1, oPC) == CLASS_TYPE_WIZARD)
nPos = 0;
else if (GetClassByPosition(2, oPC) == CLASS_TYPE_WIZARD)
nPos = 1;
else
nPos = 2;
string sLeto = "%bic = q<" + sBic + ">; print /Classlist/[" +
IntToString(nPos) + "]/School; close %bic;";
int nSchool = StringToInt(LetoScript(sLeto));
return (nSchool > 0 ? nSchool : -1);
}
void RepeatFloatingTextStringOnPC (object oPC, string sString, float fDelay=3.0, int nTimes=-1) {
if (!GetIsObjectValid(oPC) || GetPCPlayerName(oPC) == "")
return;
if (--nTimes != 0)
DelayCommand(fDelay, RepeatFloatingTextStringOnPC(oPC, sString, fDelay, nTimes));
FloatingTextStringOnCreature(sString, oPC, FALSE);
}
string AddFeatAtCurrentLevel (object oPlayer, int nFeat = -1) {
if (nFeat < 0)
return "";
return "add /FeatList/Feat, type => gffWord, value => " + IntToString(nFeat) + ";" + "add /LvlStatList/[" +
IntToString(GetHitDice(oPlayer) - 1) + "]/FeatList/Feat, type => gffWord, value => " + IntToString(nFeat) + ";";
}
void ApplyLetoScriptToPC (string sScript, object oPC) {
string sBicFile = GetLocalString(oPC, "BicFilePath");
sScript =
"$RealFile = q<" + sBicFile + ">;" +
"$EditFile = $RealFile + '.utc';" +
"FileRename $RealFile, $EditFile;" +
"%bic = $EditFile or die;" +
sScript +
"%bic = '>';" +
"close %bic;" +
"FileRename $EditFile, $RealFile;";
SetLocalString(oPC, "LetoScript", sScript);
WriteTimestampedLogEntry("LETO : " + GetPCPlayerName(oPC) + " : " + GetName(oPC) + " : " + sScript);
/* Ask player to relog rather than booting them since they could crash
* server if they log out after boot delaycommanded but before executed */
RepeatFloatingTextStringOnPC(oPC, "Please relog for character edits.");
}
void DeleteFile (string sFile) {
WriteTimestampedLogEntry("DELETE : " + sFile);
LetoScript("FileDelete q<" + sFile + ">");
}
string SetPCName (object oPC, string sBicPath, string sFirstName, string sLastName) {
string sNewBicName, sChar, sName = GetStringLowerCase(sFirstName + sLastName);
int i, nLen = GetStringLength(sName);
for (i = 0; i < nLen; i++) {
sChar = GetSubString(sName, i, 1);
if (TestStringAgainstPattern("(*a|*n|*w|'|-|_)", sChar)) {
if (sChar != " ")
sNewBicName += sChar;
}
}
/* actually rename the PC */
string sNewPath = GetPCPlayerName(oPC) + "/" + GetStringLeft(sNewBicName, 16) + ".bic";
if (GetLocalString(GetModule(), "ServerNumber") == NWN_DEV_SERVER)
sNewPath = NWN_VAULT_DEV + sNewPath;
else
sNewPath = NWN_VAULT_LIVE + sNewPath;
string sScript =
"$RealFile = q<" + sBicPath + ">;" +
"$EditFile = $RealFile + '.utc';" +
"FileRename $RealFile, $EditFile;" +
"%bic = $EditFile or die;" +
"/FirstName = q~" + sFirstName + "~;" +
"/LastName = q~" + sLastName + "~;" +
"%bic = '>';" +
"close %bic;" +
"$FinalFile = q<" + sNewPath + ">;" +
"FileRename $EditFile, $FinalFile;";
SetLocalString(oPC, "LetoScript", sScript);
WriteTimestampedLogEntry("LETO : " + GetPCPlayerName(oPC) + " : " + GetName(oPC) + " : " + sScript);
RepeatFloatingTextStringOnPC(oPC, "Please relog for name change.");
return sNewPath;
}
string GetFirstName (string sBicPath) {
string sLeto = "%bic = q<" + sBicPath + ">; print /FirstName; close %bic;";
string sName = LetoScript(sLeto);
return sName;
}
string GetLastName (string sBicPath) {
string sLeto = "%bic = q<" + sBicPath + ">; print /LastName; close %bic;";
string sName = LetoScript(sLeto);
return sName;
} |
LMK if you need more help.
Funky |
|
Back to top |
|
|
zamba
Joined: 06 Mar 2008 Posts: 2
|
Posted: Fri Mar 07, 2008 17:10 Post subject: |
|
|
I'll try it, later this day. Strike is on, everything takes more time. Thank's very much, so far. |
|
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
|