Server Admin Remote Scriptlet
From ALFA
Server Admin Remote Scripelets are tools to access PowerShell, NWScript, and other useful tools.
Only those who have server admin access, as defined in SQL, may use the following commands.
General Commands
Command | Example | Description |
---|---|---|
#sa rs [scriptlet]
|
#sa rs $s.GetTag( $OBJECT_TARGET );
|
Run a PowerShell/NWScript scriptlet. The $s object can be used to access NWScript functions, like $s.SendMessageToPC($OBJECT_SELF, 'Message');. The $sql object (an ALFA.Database) can be used to make database accesses. The $CreatureAI object can be used to interface with the creature AI system. See Remote Scriptlets below. |
#sa runscript [scriptname]
|
#sa runscript 010_kill_all_pcs
|
Run a script by name. |
#sa getglobalint [var]
|
#sa getglobalint ACR_IMPORTANT_VARIABLE
|
Read a variable. getglobalint may be replaced by getglobalfloat, getglobalstring, getmoduleint, getmodulefloat, getmodulestring, or getmoduleobject.
|
#sa loadscript [C# Script DLL Path]
|
Load a C# script assembly and call its main function. | |
#sa boot [accountname]
|
#sa boot FoamBats4All
|
Boot a PC by account name (insensitive). |
#sa dumpvars [object]
|
#sa dumpvars #module
|
Dump variables on an object (by hex object id, tag, #module, #self, or #area). |
#sa dumpareas
|
#sa dumpareas
|
Dump a list of areas in the module. |
#sa dumpareaobjects [area]
|
#sa dumpareaobjects #area
|
Dump objects in an area (area specified by hex object id, tag, #module, #self, or #area). |
#sa runupdater
|
#sa runupdater
|
Run the ACR_UpdaterScript.cmd batch file in the NWNX4 installation directory (if it exists). |
#sa jump [object]
|
#sa jump 010_wp_bg_docks_start
|
Jump to an object (by hex object id or tag). |
#sa compilerlog
|
#sa compilerlog
|
Show last module recompilation log file. |
Remote Scriptlets
The #sa rs
command is rather powerful, able to accomplishing anything on a server, with enough technical knowledge. NWScript functions can be called by using $s.[FunctionName]( [Parameters] );
.
Special Words
Placing these in your scriptlet will provide a special target or value.
Command | Description |
---|---|
$CreatureAI
|
Refers to the AIServer object. |
$OBJECT_SELF
|
Refers to you, or what you are currently controlling. |
$OBJECT_TARGET
|
Refers to the currently selected target. A target can be defined by right clicking them, as you would as a player. |
$OBJECT_INVALID
|
An invalid object. |
$s
|
The scripting environment. This can be used to reference NWScript constants and functions. |
$sql
|
References the SQL database object, for calling queries. |
Useful Commands
Below are some commands used by HDMs, as well as a description of what they do.
Command | Description |
---|---|
#sa rs $s.ClearScriptParams(); $s.AddScriptParameterObject( $OBJECT_TARGET ); $s.AddScriptParameterInt( 0 ); $s.AddScriptParameterInt( [X] ); $s.AddScriptParameterInt( 0 ); $s.ExecuteScriptEnhanced( "ACR_Items", $OBJECT_SELF, 1 );
|
Alters an item's price by [X]. For instance, a value of -1283 would adjust the item's value by negative 1283 gold. |
#sa rs $s.ApplyEffectToObject( $s.DURATION_TYPE_INSTANT, $s.EffectDamage( [DAMAGE], $s.DAMAGE_TYPE_MAGICAL, $s.DAMAGE_POWER_NORMAL, $s.TRUE ), $OBJECT_TARGET, 0.0 );
|
Deals [DAMAGE] damage to the currently selected object. |
#sa rs $s.CreateItemOnObject( "[ITEM_RESREF]", $OBJECT_SELF, 1, "", 1 );
|
Creates a single item with ResRef [ITEM_RESREF] on the currently controlled character. |
#sa rs $s.GetResRef( $OBJECT_TARGET );
|
Returns the ResRef of the currently selected object. |
#sa rs $s.NWNXSetString( "OBJECTATTRIBUTES","SetWingVariation","",$s.ObjectToInt($OBJECT_TARGET), 16 );
|
As an example, this would provide wings of ID 16 to the currently selected object. With tweaking, this command could set a hair style, or head variation. |
#sa rs $s.SetCollision( $OBJECT_TARGET, 0 );
|
Turns collision off on the currently selected targets. |
#sa rs $s.SetWeather( $s.GetArea( $OBJECT_SELF ), 0, 0 );
|
Make it stop raining in the current area. Change the last parameter to 0-15 to indicate the strength of rain, with 0 being none and 15 being stormy. |
#sa rs foreach( $object in $s.GetItemPropertiesOnItem( $s.GetPlayerCurrentTarget( $OBJECT_SELF ) ) ) { if( $s.GetItemPropertyType( $object ) -eq 21 ) { $s.RemoveItemProperty( $s.GetPlayerCurrentTarget( $OBJECT_SELF ), $object); } } $s.DeleteLocalInt( $OBJECT_TARGET, "ACR_NLD_DAMAGE_PENALTY" );
|
Strip the damage penalty properties from a targeted item. |
#sa rs foreach( $object in $s.GetItemPropertiesOnItem( $s.GetPlayerCurrentTarget( $OBJECT_SELF ) ) ) { if( $s.GetItemPropertyType( $object ) -eq 82 ) { $s.RemoveItemProperty( $s.GetPlayerCurrentTarget( $OBJECT_SELF ), $object ); } }
|
Strip on hit cast spell (like, say, a subdual item's unique power) from a targeted item. |
#sa rs $s.ClearScriptParams(); $s.AddScriptParameterObject($OBJECT_TARGET); $s.AddScriptParameterInt(0); $s.AddScriptParameterInt(-2); $s.AddScriptParameterInt(0); $s.ExecuteScriptEnhanced("ACR_Items", $OBJECT_SELF, 1);
|
Reduce the price of a targeted item by 2 gold. The -2 in the second SetScriptParameterInt can be changed to any 32 bit integer (-2,147,483,648 to 2,147,483,647) to make the price adjust by that much. However, the total price must also be a 32 bit integer (so adding 2,147,843,647 to any positive integer will cause a memory overflow and corrupt the item). |