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);
288 NWNXCall(NWNX_Util,
"GetCurrentScriptName");
289 return NWNXPopString();
294 NWNXCall(NWNX_Util,
"GetAsciiTableString");
295 return NWNXPopString();
301 NWNXCall(NWNX_Util,
"Hash");
307 NWNXCall(NWNX_Util,
"GetModuleMtime");
313 NWNXCall(NWNX_Util,
"GetModuleFile");
314 return NWNXPopString();
319 NWNXPushInt(customTokenNumber);
320 NWNXCall(NWNX_Util,
"GetCustomToken");
321 return NWNXPopString();
327 NWNXCall(NWNX_Util,
"EffectTypeCast");
328 return NWNXPopItemProperty();
333 NWNXPushItemProperty(ip);
334 NWNXCall(NWNX_Util,
"EffectTypeCast");
335 return NWNXPopEffect();
341 NWNXCall(NWNX_Util,
"StripColors");
342 return NWNXPopString();
347 NWNXPushString(sVarname);
348 NWNXCall(NWNX_Util,
"GetEnvironmentVariable");
349 return NWNXPopString();
354 NWNXCall(NWNX_Util,
"GetMinutesPerHour");
360 NWNXPushInt(minutes);
361 NWNXCall(NWNX_Util,
"SetMinutesPerHour");
366 NWNXPushString(sURL);
367 NWNXCall(NWNX_Util,
"EncodeStringForURL");
368 return NWNXPopString();
373 NWNXPushInt(bModuleResourcesOnly);
374 NWNXPushString(sRegexFilter);
376 NWNXCall(NWNX_Util,
"GetFirstResRef");
377 return NWNXPopString();
382 NWNXCall(NWNX_Util,
"GetNextResRef");
383 return NWNXPopString();
388 NWNXPushInt(nNthLast);
389 NWNXPushInt(nObjectType);
390 NWNXCall(NWNX_Util,
"GetLastCreatedObject");
391 return NWNXPopObject();
394 string NWNX_Util_AddScript(
string sFileName,
string sScriptData,
int bWrapIntoMain = FALSE,
string sAlias =
"NWNX")
396 NWNXPushString(sAlias);
397 NWNXPushInt(bWrapIntoMain);
398 NWNXPushString(sScriptData);
399 NWNXPushString(sFileName);
400 NWNXCall(NWNX_Util,
"AddScript");
401 return NWNXPopString();
406 NWNXPushString(sAlias);
407 NWNXPushString(sContents);
408 NWNXPushString(sFileName);
409 NWNXCall(NWNX_Util,
"AddNSSFile");
415 NWNXPushString(sAlias);
417 NWNXPushString(sFileName);
418 NWNXCall(NWNX_Util,
"RemoveNWNXResourceFile");
424 NWNXPushInt(nInstructionLimit);
425 NWNXCall(NWNX_Util,
"SetInstructionLimit");
430 NWNXCall(NWNX_Util,
"GetInstructionLimit");
436 NWNXPushInt(nInstructions);
437 NWNXCall(NWNX_Util,
"SetInstructionsExecuted");
442 NWNXCall(NWNX_Util,
"GetInstructionsExecuted");
448 NWNXPushString(sScriptChunk);
449 NWNXPushString(sCommand);
450 NWNXCall(NWNX_Util,
"RegisterServerConsoleCommand");
456 NWNXPushString(sCommand);
457 NWNXCall(NWNX_Util,
"UnregisterServerConsoleCommand");
462 NWNXCall(NWNX_Util,
"GetUserDirectory");
463 return NWNXPopString();
468 NWNXCall(NWNX_Util,
"GetScriptReturnValue");
472 object NWNX_Util_CreateDoor(
string sResRef, location locLocation,
string sNewTag =
"",
int nAppearanceType = -1)
474 NWNXPushInt(nAppearanceType);
475 NWNXPushString(sNewTag);
476 NWNXPushLocation(locLocation);
477 NWNXPushString(sResRef);
478 NWNXCall(NWNX_Util,
"CreateDoor");
479 return NWNXPopObject();
484 NWNXPushObject(oObject);
485 NWNXCall(NWNX_Util,
"SetItemActivator");
490 NWNXPushFloat(fAdjustment);
491 NWNXCall(NWNX_Util,
"GetWorldTime");
494 strWorldTime.nCalendarDay = NWNXPopInt();
500 NWNXPushString(sNewName);
501 NWNXPushString(sOldName);
502 NWNXPushInt(nResType);
503 NWNXCall(NWNX_Util,
"SetResourceOverride");
508 NWNXPushString(sName);
509 NWNXPushInt(nResType);
510 NWNXCall(NWNX_Util,
"GetResourceOverride");
511 return NWNXPopString();
516 NWNXPushString(sParamName);
517 NWNXCall(NWNX_Util,
"GetScriptParamIsSet");
523 NWNXPushInt(nDawnHour);
524 NWNXCall(NWNX_Util,
"SetDawnHour");
529 NWNXCall(NWNX_Util,
"GetDawnHour");
535 NWNXPushInt(nDuskHour);
536 NWNXCall(NWNX_Util,
"SetDuskHour");
541 NWNXCall(NWNX_Util,
"GetDuskHour");
548 NWNXCall(NWNX_Util,
"GetHighResTimeStamp");
549 t.microseconds = NWNXPopInt();
550 t.seconds = NWNXPopInt();
556 NWNXCall(NWNX_Util,
"GetTTY");
557 return NWNXPopString();
562 NWNXPushInt(nEventID);
563 NWNXCall(NWNX_Util,
"SetCurrentlyRunningEvent");
568 NWNXPushString(sCompareTo);
569 NWNXPushString(sString);
570 NWNXCall(NWNX_Util,
"GetStringLevenshteinDistance");
576 NWNXPushObject(oPlayer);
577 NWNXPushObject(oObjectToUpdate);
578 NWNXCall(NWNX_Util,
"UpdateClientObject");
583 NWNXPushInt(nResType);
584 NWNXPushString(sAlias);
585 NWNXCall(NWNX_Util,
"CleanResourceDirectory");
591 string sFunc =
"GetModuleTlkFile";
592 NWNXCall(NWNX_Util, sFunc);
593 return NWNXPopString();
598 NWNXPushString(sAlias);
599 NWNXCall(NWNX_Util,
"UpdateResourceDirectory");
605 NWNXPushVector(vDirection);
606 NWNXPushLocation(locLocation);
607 NWNXPushString(sResRef);
608 NWNXCall(NWNX_Util,
"SetStartingLocation");
614 NWNXPushString(sString);
615 NWNXCall(NWNX_Util,
"RawPrint");
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
int NWNX_Util_SetStartingLocation(string sResRef, location locLocation, vector vDirection)
Set the starting location.
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.
void NWNX_Util_RawPrint(string sString)
Print a string with no log decorations.
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.