6 const string NWNX_Util =
"NWNX_Util";
134 string NWNX_Util_AddScript(
string sFileName,
string sScriptData,
int bWrapIntoMain = FALSE,
string sAlias =
"NWNX");
190 object NWNX_Util_CreateDoor(
string sResRef, location locLocation,
string sNewTag =
"",
int nAppearanceType = -1);
277 NWNXCall(NWNX_Util,
"GetCurrentScriptName");
278 return NWNXPopString();
283 NWNXCall(NWNX_Util,
"GetAsciiTableString");
284 return NWNXPopString();
290 NWNXCall(NWNX_Util,
"Hash");
296 NWNXCall(NWNX_Util,
"GetModuleMtime");
302 NWNXCall(NWNX_Util,
"GetModuleFile");
303 return NWNXPopString();
308 NWNXPushInt(customTokenNumber);
309 NWNXCall(NWNX_Util,
"GetCustomToken");
310 return NWNXPopString();
316 NWNXCall(NWNX_Util,
"EffectTypeCast");
317 return NWNXPopItemProperty();
322 NWNXPushItemProperty(ip);
323 NWNXCall(NWNX_Util,
"EffectTypeCast");
324 return NWNXPopEffect();
330 NWNXCall(NWNX_Util,
"StripColors");
331 return NWNXPopString();
336 NWNXPushString(sVarname);
337 NWNXCall(NWNX_Util,
"GetEnvironmentVariable");
338 return NWNXPopString();
343 NWNXCall(NWNX_Util,
"GetMinutesPerHour");
349 NWNXPushInt(minutes);
350 NWNXCall(NWNX_Util,
"SetMinutesPerHour");
355 NWNXPushString(sURL);
356 NWNXCall(NWNX_Util,
"EncodeStringForURL");
357 return NWNXPopString();
362 NWNXPushInt(bModuleResourcesOnly);
363 NWNXPushString(sRegexFilter);
365 NWNXCall(NWNX_Util,
"GetFirstResRef");
366 return NWNXPopString();
371 NWNXCall(NWNX_Util,
"GetNextResRef");
372 return NWNXPopString();
377 NWNXPushInt(nNthLast);
378 NWNXPushInt(nObjectType);
379 NWNXCall(NWNX_Util,
"GetLastCreatedObject");
380 return NWNXPopObject();
383 string NWNX_Util_AddScript(
string sFileName,
string sScriptData,
int bWrapIntoMain = FALSE,
string sAlias =
"NWNX")
385 NWNXPushString(sAlias);
386 NWNXPushInt(bWrapIntoMain);
387 NWNXPushString(sScriptData);
388 NWNXPushString(sFileName);
389 NWNXCall(NWNX_Util,
"AddScript");
390 return NWNXPopString();
395 NWNXPushString(sAlias);
396 NWNXPushString(sContents);
397 NWNXPushString(sFileName);
398 NWNXCall(NWNX_Util,
"AddNSSFile");
404 NWNXPushString(sAlias);
406 NWNXPushString(sFileName);
407 NWNXCall(NWNX_Util,
"RemoveNWNXResourceFile");
413 NWNXPushInt(nInstructionLimit);
414 NWNXCall(NWNX_Util,
"SetInstructionLimit");
419 NWNXCall(NWNX_Util,
"GetInstructionLimit");
425 NWNXPushInt(nInstructions);
426 NWNXCall(NWNX_Util,
"SetInstructionsExecuted");
431 NWNXCall(NWNX_Util,
"GetInstructionsExecuted");
437 NWNXPushString(sScriptChunk);
438 NWNXPushString(sCommand);
439 NWNXCall(NWNX_Util,
"RegisterServerConsoleCommand");
445 NWNXPushString(sCommand);
446 NWNXCall(NWNX_Util,
"UnregisterServerConsoleCommand");
451 NWNXCall(NWNX_Util,
"GetUserDirectory");
452 return NWNXPopString();
457 NWNXCall(NWNX_Util,
"GetScriptReturnValue");
461 object NWNX_Util_CreateDoor(
string sResRef, location locLocation,
string sNewTag =
"",
int nAppearanceType = -1)
463 NWNXPushInt(nAppearanceType);
464 NWNXPushString(sNewTag);
465 NWNXPushLocation(locLocation);
466 NWNXPushString(sResRef);
467 NWNXCall(NWNX_Util,
"CreateDoor");
468 return NWNXPopObject();
473 NWNXPushObject(oObject);
474 NWNXCall(NWNX_Util,
"SetItemActivator");
479 NWNXPushFloat(fAdjustment);
480 NWNXCall(NWNX_Util,
"GetWorldTime");
483 strWorldTime.nCalendarDay = NWNXPopInt();
489 NWNXPushString(sNewName);
490 NWNXPushString(sOldName);
491 NWNXPushInt(nResType);
492 NWNXCall(NWNX_Util,
"SetResourceOverride");
497 NWNXPushString(sName);
498 NWNXPushInt(nResType);
499 NWNXCall(NWNX_Util,
"GetResourceOverride");
500 return NWNXPopString();
505 NWNXPushString(sParamName);
506 NWNXCall(NWNX_Util,
"GetScriptParamIsSet");
512 NWNXPushInt(nDawnHour);
513 NWNXCall(NWNX_Util,
"SetDawnHour");
518 NWNXCall(NWNX_Util,
"GetDawnHour");
524 NWNXPushInt(nDuskHour);
525 NWNXCall(NWNX_Util,
"SetDuskHour");
530 NWNXCall(NWNX_Util,
"GetDuskHour");
537 NWNXCall(NWNX_Util,
"GetHighResTimeStamp");
538 t.microseconds = NWNXPopInt();
539 t.seconds = NWNXPopInt();
545 NWNXCall(NWNX_Util,
"GetTTY");
546 return NWNXPopString();
551 NWNXPushInt(nEventID);
552 NWNXCall(NWNX_Util,
"SetCurrentlyRunningEvent");
557 NWNXPushString(sCompareTo);
558 NWNXPushString(sString);
559 NWNXCall(NWNX_Util,
"GetStringLevenshteinDistance");
565 NWNXPushObject(oPlayer);
566 NWNXPushObject(oObjectToUpdate);
567 NWNXCall(NWNX_Util,
"UpdateClientObject");
572 NWNXPushInt(nResType);
573 NWNXPushString(sAlias);
574 NWNXCall(NWNX_Util,
"CleanResourceDirectory");
580 string sFunc =
"GetModuleTlkFile";
581 NWNXCall(NWNX_Util, sFunc);
582 return NWNXPopString();
587 NWNXPushString(sAlias);
588 NWNXCall(NWNX_Util,
"UpdateResourceDirectory");
const int NWNX_UTIL_RESREF_TYPE_CREATURE
const int NWNX_UTIL_RESREF_TYPE_ITEM
string NWNX_Util_GetAsciiTableString()
Gets a string that contains the ascii table.
void NWNX_Util_UpdateClientObject(object oObjectToUpdate, object oPlayer=OBJECT_INVALID)
Sends a full object update of oObjectToUpdate to all clients.
string NWNX_Util_GetModuleFile()
Gets the module short file name.
void NWNX_Util_SetDuskHour(int nDuskHour)
Set the module dusk hour.
const int NWNX_UTIL_RESREF_TYPE_WAYPOINT
int NWNX_Util_RegisterServerConsoleCommand(string sCommand, string sScriptChunk)
Register a server console command that will execute a script chunk.
struct NWNX_Util_WorldTime NWNX_Util_GetWorldTime(float fAdjustment=0.0f)
Get the world time as calendar day and time of day.
string NWNX_Util_GetModuleTlkFile()
Return the filename of the tlk file.
string NWNX_Util_GetNextResRef()
Get the next resref.
const int NWNX_UTIL_RESREF_TYPE_TRIGGER
const int NWNX_UTIL_RESREF_TYPE_STORE
const int NWNX_UTIL_RESREF_TYPE_AREA_GIT
string NWNX_Util_StripColors(string str)
Strip any color codes from a string.
const int NWNX_UTIL_RESREF_TYPE_NSS
int NWNX_Util_GetModuleMtime()
Gets the last modified timestamp (mtime) of the module file in seconds.
object NWNX_Util_GetLastCreatedObject(int nObjectType, int nNthLast=1)
Get the last created object.
int NWNX_Util_UpdateResourceDirectory(string sAlias)
Update a resource directory by having ResMan reindex it.
string NWNX_Util_GetCustomToken(int customTokenNumber)
Gets the value of customTokenNumber.
string NWNX_Util_EncodeStringForURL(string str)
Encodes a string for usage in a URL.
int NWNX_Util_RemoveNWNXResourceFile(string sFileName, int nType, string sAlias="NWNX")
Remove sFileName of nType from the UserDirectory/nwnx folder, or from the location of sAlias.
int NWNX_Util_Hash(string str)
Gets an integer hash of a string.
const int NWNX_UTIL_RESREF_TYPE_AREA_ARE
int NWNX_Util_GetStringLevenshteinDistance(string sString, string sCompareTo)
Calculate the levenshtein distance of two strings.
const int NWNX_UTIL_RESREF_TYPE_ENCOUNTER
int NWNX_Util_GetInstructionsExecuted()
Get the number of NWScript instructions currently executed.
int NWNX_Util_GetDawnHour()
Get the module dawn hour.
const int NWNX_UTIL_RESREF_TYPE_DOOR
const int NWNX_UTIL_RESREF_TYPE_DIALOG
int NWNX_Util_GetScriptParamIsSet(string sParamName)
Get if a script param is set.
itemproperty NWNX_Util_EffectToItemProperty(effect e)
Convert an effect type to an itemproperty type.
object NWNX_Util_CreateDoor(string sResRef, location locLocation, string sNewTag="", int nAppearanceType=-1)
Create a door.
int NWNX_Util_GetInstructionLimit()
Get the NWScript instruction limit.
void NWNX_Util_SetResourceOverride(int nResType, string sOldName, string sNewName)
Set a server-side resource override.
string NWNX_Util_GetCurrentScriptName(int depth=0)
Gets the name of the currently executing script.
int NWNX_Util_GetScriptReturnValue()
Get the return value of the last run script with a StartingConditional.
const int NWNX_UTIL_RESREF_TYPE_TWODA
void NWNX_Util_SetCurrentlyRunningEvent(int nEventID)
Set the currently running script event.
string NWNX_Util_GetEnvironmentVariable(string sVarname)
Retrieves an environment variable.
struct NWNX_Util_HighResTimestamp NWNX_Util_GetHighResTimeStamp()
int NWNX_Util_AddNSSFile(string sFileName, string sContents, string sAlias="NWNX")
Adds a nss file to the UserDirectory/nwnx folder, or to the location of sAlias.
void NWNX_Util_SetMinutesPerHour(int minutes)
Set module real life minutes per in game hour.
int NWNX_Util_CleanResourceDirectory(string sAlias, int nResType=0xFFFF)
Clean a resource directory, deleting all files of nResType.
string NWNX_Util_GetUserDirectory()
Gets the server's current working user folder.
string NWNX_Util_AddScript(string sFileName, string sScriptData, int bWrapIntoMain=FALSE, string sAlias="NWNX")
Compiles and adds a script to the UserDirectory/nwnx folder, or to the location of sAlias.
void NWNX_Util_SetDawnHour(int nDawnHour)
Set the module dawn hour.
int NWNX_Util_GetDuskHour()
Get the module dusk hour.
const int NWNX_UTIL_RESREF_TYPE_NCS
void NWNX_Util_SetInstructionLimit(int nInstructionLimit)
Set the NWScript instruction limit.
effect NWNX_Util_ItemPropertyToEffect(itemproperty ip)
Convert an itemproperty type to an effect type.
void NWNX_Util_SetInstructionsExecuted(int nInstructions)
Set the number of NWScript instructions currently executed.
string NWNX_Util_GetFirstResRef(int nType, string sRegexFilter="", int bModuleResourcesOnly=TRUE)
Get the first resref of nType.
string NWNX_Util_GetTTY()
const int NWNX_UTIL_RESREF_TYPE_SOUND
void NWNX_Util_UnregisterServerConsoleCommand(string sCommand)
Unregister a server console command that was registered with NWNX_Util_RegisterServerConsoleCommand()...
string NWNX_Util_GetResourceOverride(int nResType, string sName)
Get a server-side resource override.
int NWNX_Util_GetMinutesPerHour()
Gets the module real life minutes per in game hour.
void NWNX_Util_SetItemActivator(object oObject)
Set the object that will be returned by GetItemActivator.
const int NWNX_UTIL_RESREF_TYPE_PLACEABLE
A high resolution timestamp.
int microseconds
Microseconds.
int seconds
Seconds since epoch.
int nTimeOfDay
The time of day.
int nCalendarDay
The calendar day.