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);
284 NWNXCall(NWNX_Util,
"GetCurrentScriptName");
285 return NWNXPopString();
290 NWNXCall(NWNX_Util,
"GetAsciiTableString");
291 return NWNXPopString();
297 NWNXCall(NWNX_Util,
"Hash");
303 NWNXCall(NWNX_Util,
"GetModuleMtime");
309 NWNXCall(NWNX_Util,
"GetModuleFile");
310 return NWNXPopString();
315 NWNXPushInt(customTokenNumber);
316 NWNXCall(NWNX_Util,
"GetCustomToken");
317 return NWNXPopString();
323 NWNXCall(NWNX_Util,
"EffectTypeCast");
324 return NWNXPopItemProperty();
329 NWNXPushItemProperty(ip);
330 NWNXCall(NWNX_Util,
"EffectTypeCast");
331 return NWNXPopEffect();
337 NWNXCall(NWNX_Util,
"StripColors");
338 return NWNXPopString();
343 NWNXPushString(sVarname);
344 NWNXCall(NWNX_Util,
"GetEnvironmentVariable");
345 return NWNXPopString();
350 NWNXCall(NWNX_Util,
"GetMinutesPerHour");
356 NWNXPushInt(minutes);
357 NWNXCall(NWNX_Util,
"SetMinutesPerHour");
362 NWNXPushString(sURL);
363 NWNXCall(NWNX_Util,
"EncodeStringForURL");
364 return NWNXPopString();
369 NWNXPushInt(bModuleResourcesOnly);
370 NWNXPushString(sRegexFilter);
372 NWNXCall(NWNX_Util,
"GetFirstResRef");
373 return NWNXPopString();
378 NWNXCall(NWNX_Util,
"GetNextResRef");
379 return NWNXPopString();
384 NWNXPushInt(nNthLast);
385 NWNXPushInt(nObjectType);
386 NWNXCall(NWNX_Util,
"GetLastCreatedObject");
387 return NWNXPopObject();
390 string NWNX_Util_AddScript(
string sFileName,
string sScriptData,
int bWrapIntoMain = FALSE,
string sAlias =
"NWNX")
392 NWNXPushString(sAlias);
393 NWNXPushInt(bWrapIntoMain);
394 NWNXPushString(sScriptData);
395 NWNXPushString(sFileName);
396 NWNXCall(NWNX_Util,
"AddScript");
397 return NWNXPopString();
402 NWNXPushString(sAlias);
403 NWNXPushString(sContents);
404 NWNXPushString(sFileName);
405 NWNXCall(NWNX_Util,
"AddNSSFile");
411 NWNXPushString(sAlias);
413 NWNXPushString(sFileName);
414 NWNXCall(NWNX_Util,
"RemoveNWNXResourceFile");
420 NWNXPushInt(nInstructionLimit);
421 NWNXCall(NWNX_Util,
"SetInstructionLimit");
426 NWNXCall(NWNX_Util,
"GetInstructionLimit");
432 NWNXPushInt(nInstructions);
433 NWNXCall(NWNX_Util,
"SetInstructionsExecuted");
438 NWNXCall(NWNX_Util,
"GetInstructionsExecuted");
444 NWNXPushString(sScriptChunk);
445 NWNXPushString(sCommand);
446 NWNXCall(NWNX_Util,
"RegisterServerConsoleCommand");
452 NWNXPushString(sCommand);
453 NWNXCall(NWNX_Util,
"UnregisterServerConsoleCommand");
458 NWNXCall(NWNX_Util,
"GetUserDirectory");
459 return NWNXPopString();
464 NWNXCall(NWNX_Util,
"GetScriptReturnValue");
468 object NWNX_Util_CreateDoor(
string sResRef, location locLocation,
string sNewTag =
"",
int nAppearanceType = -1)
470 NWNXPushInt(nAppearanceType);
471 NWNXPushString(sNewTag);
472 NWNXPushLocation(locLocation);
473 NWNXPushString(sResRef);
474 NWNXCall(NWNX_Util,
"CreateDoor");
475 return NWNXPopObject();
480 NWNXPushObject(oObject);
481 NWNXCall(NWNX_Util,
"SetItemActivator");
486 NWNXPushFloat(fAdjustment);
487 NWNXCall(NWNX_Util,
"GetWorldTime");
490 strWorldTime.nCalendarDay = NWNXPopInt();
496 NWNXPushString(sNewName);
497 NWNXPushString(sOldName);
498 NWNXPushInt(nResType);
499 NWNXCall(NWNX_Util,
"SetResourceOverride");
504 NWNXPushString(sName);
505 NWNXPushInt(nResType);
506 NWNXCall(NWNX_Util,
"GetResourceOverride");
507 return NWNXPopString();
512 NWNXPushString(sParamName);
513 NWNXCall(NWNX_Util,
"GetScriptParamIsSet");
519 NWNXPushInt(nDawnHour);
520 NWNXCall(NWNX_Util,
"SetDawnHour");
525 NWNXCall(NWNX_Util,
"GetDawnHour");
531 NWNXPushInt(nDuskHour);
532 NWNXCall(NWNX_Util,
"SetDuskHour");
537 NWNXCall(NWNX_Util,
"GetDuskHour");
544 NWNXCall(NWNX_Util,
"GetHighResTimeStamp");
545 t.microseconds = NWNXPopInt();
546 t.seconds = NWNXPopInt();
552 NWNXCall(NWNX_Util,
"GetTTY");
553 return NWNXPopString();
558 NWNXPushInt(nEventID);
559 NWNXCall(NWNX_Util,
"SetCurrentlyRunningEvent");
564 NWNXPushString(sCompareTo);
565 NWNXPushString(sString);
566 NWNXCall(NWNX_Util,
"GetStringLevenshteinDistance");
572 NWNXPushObject(oPlayer);
573 NWNXPushObject(oObjectToUpdate);
574 NWNXCall(NWNX_Util,
"UpdateClientObject");
579 NWNXPushInt(nResType);
580 NWNXPushString(sAlias);
581 NWNXCall(NWNX_Util,
"CleanResourceDirectory");
587 string sFunc =
"GetModuleTlkFile";
588 NWNXCall(NWNX_Util, sFunc);
589 return NWNXPopString();
594 NWNXPushString(sAlias);
595 NWNXCall(NWNX_Util,
"UpdateResourceDirectory");
601 NWNXPushVector(vDirection);
602 NWNXPushLocation(locLocation);
603 NWNXPushString(sResRef);
604 NWNXCall(NWNX_Util,
"SetStartingLocation");
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.
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.