[BETA] New Vegas Script Extender (NVSE) v4

Post » Thu Jan 02, 2014 4:01 am

Previous Thread: http://www.gamesas.com/topic/1406662-beta-new-vegas-script-extender-nvse-v2

The New Vegas Script Extender, or NVSE for short, is a modder's resource that expands the scripting capabilities of Fallout: NV. It does so without modifying the executable files on disk, so there are no permanent side effects.

Website: http://nvse.silverlock.org

Download (latest version 4.1 beta 1): https://www.dropbox.com/s/njdl1sdxfzqma76/nvse_4_1_beta1.zip - compatible with runtime 1.4.0.525 and editor 1.4.0.518, plus the German "no gore" version.

Previous changes

Spoiler

http://nvse.silverlock.org/beta/nvse_2_beta1.zip
whatsnew:

- MessageEx/MessageBoxEx
- SetNameEx
- IsClonedForm/TempCloneForm
-
GetParentCellOwner/GetOwningFactionRequiredRank/GetParentCellOwningFactionRequiredRank
-
fix loader misreporting when it can't find the editor
-
GetLocalRefIndex/BuildRef

http://nvse.silverlock.org/beta/nvse_2_beta2.zip
whatsnew:
- Menu*Key functions use buffered input like they should
- log
printc to IDebugLog in _DEBUG builds
- SetUIStringEx
- fix %k format
specifier
- fix DataHandler::DoAddForm (updated address then reverted it then
fixed it again)
- enable kWeapType_OneHandThrown type

http://nvse.silverlock.org/beta/nvse_2_beta3.zip
whatsnew:
- fix formlist params so they accept any form type
- fix
SetUIStringEx
- document new vegas parameter types
- %c format type can
print the different sub-names of ammo (0 = full name, 1 = short name, 2 =
abbreviation)

http://nvse.silverlock.org/beta/nvse_2_beta4.zip
whatsnew:
- full pass on all parameter types, fix lots of mistakes
- fixes
ListAddForm and other formlist things that were using ExtractArgsix

http://nvse.silverlock.org/beta/nvse_2_beta5.zip
whatsnew:
- Get/SetWeaponLongBursts
- SetWeaponFireRate
- long strings
should not crash the compiler any more
- overhaul dinput code
- added an
optional integer parameter to IsKeyPressed (default behavior unchanged, see
whatsnew.txt for details)

http://nvse.silverlock.org/beta/nvse_2_beta6.zip
whatsnew:
- access to weapon flags: Get/SetWeaponFlags1/2
- math functions
for setting individual bits (ClearBit/SetBit)
-
Get/SetActorBaseFlagsLow/High
- improve IsControlDisabled, cache now keeps
track of partially disabled keys
- ExtractArgsRaw, new internal function for
getting detailed information about passed-in arguments (not a scripting command,
only useful for C++ API stuff)

http://nvse.silverlock.org/beta/nvse_2_beta7.zip
whatsnew:
- fix GetCrosshairRef, other things relying on
InterfaceManager
- more helpful error message when using the updated CS

http://nvse.silverlock.org/beta/nvse_2_beta8.zip
whatsnew:
- fix crash when iterating over invalid form lists (generally a
sign that a mod needs to be updated, but crashing is bad)
- support for
editor 1.4.0.518

This patch was released at a slightly awkward time, so some mods relying on
the very strange behavior of the mouse functions may need to be updated.

http://nvse.silverlock.org/beta/nvse_2_beta9.zip
whatsnew:
- document new method of getting to NiNode
- fix
IsControlDisabled, tilde/escape

http://nvse.silverlock.org/beta/nvse_2_beta10.7z
whatsnew:
- support for German "no gore" runtime
- optionally hook
internal game error log
- fix crash in GetHotkeyItem,
SetWeaponRequiredSkill
- Get/SetEquippedWeaponModFlags
-
Get/SetWeaponItemModEffect/Value1/Value2

http://nvse.silverlock.org/beta/nvse_2_beta11.7z
whatsnew:
- fixed Get/SetWeaponItemModValue2

http://nvse.silverlock.org/beta/nvse_2_beta12.7z
whatsnew:
- made weapon mod indexing the same across all functions (1-based
instead of 0-based for backwards compatibility)

http://nvse.silverlock.org/beta/nvse_3_beta1.7z
whatsnew:
3 beta 02:
Added isNogore to NVSEinterface
Fixed
GetFactionRank (Report the exact rank and not 1 after SetFactionRank)

3 alpha 01:
New functions:
HasOwnership
checks
wether an NPC owns a reference or has the required faction rank to own said
reference
IsOwned
checks wether a reference is owned by
an NPC or that said NPC as the required faction rank to own the
reference
SetOwningFactionRequiredRank
set the owning
faction required
reference

GetDialogueSubject
Get the
subject reference in a converation. That is the reference who STARTED the
conversation, (subject of Hello/Greatings
topic)
GetDialogueTarget
Get the target reference in a
conversation. That is the reference who ANSWERS the conversation, (target
of Hello/Greatings topic)
GetDialogueSpeaker
Get the
current speaker in a conversation. That is the current subject in a
topic.

note: GetCurentPackageTarget does not provide
the other member of a conversation
reliably.

SetPackageLocationReference
Change
the target reference of a
package.

GetAgeClass
Classify the age of
the standard races: -1 undefined. 0 is Child, 1 is default, 2 is Old, 3 is
OldAged.

RemoveMeIR,
removes an inventory reference from its
container, optionally transferring it to a different container, in much the same
way as the vanilla RemoveMe command. The inventory reference becomes invalid
once this command is called and should no longer be used.

CopyIR
copies an inventory reference to the specified
container. The calling object needn't be in a container and remains valid after
the command is called. If the calling object is equipped, the copy will not be
equipped.

CreateTempRef
creates a
temporary reference to the specified form. This reference does not exist in the
gameworld or in a container, and remains valid for only one frame. It is mostly
useful for creating a stack of one or more items to be added to a container with
CopyIR

GetFirstRefForItem,
returns the first entry in an array
of temp refs to objects of the specified type in the calling container

GetNextRefForItem
returns the next entry in the array of
temp refs to objects of the specified type in the calling container

AddItemOwnership
Specifies the ownership info while
adding an
item

AddItemHealthPercentOwner
Specifies
both the ownership info and the health while adding an
item

"Token" functions: A token is an Item that can
only be present once in inventory, and must allow Health and Ownership. Most
likely created from an Armor with no biped slot so it can't be
equipped.
GetTokenValue, GetTV
Get the value of a
token

SetTokenValue, SetTV
Add or modify
the value of a token

GetTokenRef,
GetTR
Get the referenece of a
token

SetTokenRef, SetTR
Add or modify
the reference of a token

SetTokenValueAndRef,
SetTVR
Add or modify both the value and the reference of a
token

GetPaired
Detects if ref and actor
cross references each other (through item ownership). Usage for thinks like is
familly member, is partner of where there maybe multiple instances (n n
links)

GetRespawn
Checks the respawn
flag on Actor
SetRespawn
Sets the respawn flag on actor.
Effective on standard NPC, unreliable on
LevelledCharacters
GetPermanent
Checks the permanent
flag on Reference
SetPermanet
Sets the permanent flag on
Reference. Effective on standard NPC, unreliable on LevelledCharacters

GetBaseForm
Find the actual baseForm of a Levelled
form

IsRefInList
Checks whether a ref, its baseform or its
leveled baseForm is in a FormList

Changed
functions
TempCloneForm
IsClonedForm
Both
accept any Form as the source, rather than just 3D object to allow for cloning
of packages for example.
ListGetFormIndex
Eval version
of the function created

2 beta 14
- PluginApi extended to support:
* condition functions
in plugins.
* function alternate name in plugins using
DEFINE_COMMAND_ALT_PLUGIN.
* NVSECommandTableInterface (like OBSE).

2 beta 13
- PluginApi extended to support Messaging Interface (like OBSE).
Implemented messages are GameLoad and GameSave.

https://www.dropbox.com/s/njdl1sdxfzqma76/nvse_4_1_beta1.zip whatsnew:
4.1 beta 01 mostly ports OBSE plugin events/strings/arrays/user functions/expressions and the relevant serialization
I tried to keep function names identical to OBSE, so I can refer directly to the OBSE online documentation. http://obse.silverlock.org/obse_command_doc.html

added variables to nvse_settings.ini to help control debugging without recompiling.

ported support for serialization/messages/strings/arrays... to the pluginAPI
messages available:

Spoiler
PostLoad sent to registered plugins once all plugins have been loaded (no data)

ExitGame exit to windows from main menu or in-game menu

ExitToMainMenu exit to main menu from in-game menu

LoadGame Dispatched immediately before plugin serialization callbacks invoked, after savegame has been read by Fallout
// dataLen: length of file path, data: char* file path of .fos savegame file
// Receipt of this message does not *guarantee* the serialization callback will be invoked
// as there may be no .nvse file associated with the savegame

SaveGame as above

Precompile EDITOR: Dispatched when the user attempts to save a script in the script editor.
// NVSE first does its pre-compile checks; if these pass the message is dispatched before
// the vanilla compiler does its own checks.
// data: ScriptBuffer* to the buffer representing the script under compilation

PreLoadGame dispatched immediately before savegame is read by Fallout
// dataLen: length of file path, data: char* file path of .ess savegame file

ExitGame_Console exit game using 'qqq' console command

PostLoadGame dispatched after an attempt to load a saved game has finished (the game's LoadGame() routine
//has returned). You will probably want to handle this event if your plugin uses a Preload callback
//as there is a chance that after that callback is invoked the game will encounter an error
//while loading the saved game (eg. corrupted save) which may require you to reset some of your
//plugin state.
//data: bool, true if game successfully loaded, false otherwise */

PostPostLoad sent right after kMessage_PostLoad to facilitate the correct dispatching/registering of messages/listeners
// plugins may register as listeners during the first callback while deferring dispatches until the next

RuntimeScriptError dispatched when an NVSE script error is encountered during runtime/
// data: char* errorMessageText

DeleteGame sent right before deleting the .nvse cosave and the .fos save.
// dataLen: length of file path, data: char* file path of .fos savegame file

RenameGame sent right before renaming the .nvse cosave and the .fos save.
// dataLen: length of old file path, data: char* old file path of .fos savegame file
// you are expected to save the data and wait for kMessage_RenameNewGame

RenameNewGame sent right after RenameGame.
// dataLen: length of new file path, data: char* new file path of .fos savegame file

NewGame sent right before iterating through plugins newGame.
// dataLen: 0, data: NULL

Some NPC functions:

Spoiler

SetEyes sets an NPCs eyes
[ref.]SetEyes eye:form [NPC:npc]

GetEyes gets an NPCs eyes
[ref.]GetEyes [NPC:npc]

SetHair sets an NPCs hair
[ref.]SetHair hair:form [NPC:npc]

GetHair gets an NPCs hair
[ref.]GetHair [NPC:npc]

GetHairLength sets an NPC hairLength (apparently unused, but still :smile: )
[ref.]GetHairLength [NPC:npc]

SetHairLength sets an NPC hairLength (apparently unused, but still :smile: )
[ref.]SetHairLength hairLength:float [NPC:npc]

GetHairColor gets an NPCs hair color (code: 1=Red, 2=Green, 3=Blue, other=color)
[ref.]GetHairColor hairColorCode:int [NPC:npc]

SetHairColor sets an NPCs hair color (color as RGB bytes)
[ref.]SetHairColor hairColor:int

GetNPCWeight gets an NPCs weight
[ref.]GetNPCWeight [NPC:npc]

SetNPCWeight sets an NPCs weight (no idea if that has any effect :smile: , the code seems to igore it for NPC (using height instead) but it is used for the PC)
[ref.]SetNPCWeight weight:float [NPC:npc]

GetNPCHeight gets an NPCs height
[ref.]GetNPCHeight [NPC:npc]

SetNPCHeight sets an NPCs height
[ref.]SetNPCHeight weight:float [NPC:npc]

To see the effect of any of those functions, you should call Update3D (But NOT on the player at the moment)
Update3D

patched ModFactionRank same issue as SetFactionRank, exact rank was not taken into account if modified on the reference.

some scripts functions from OBSE:

Spoiler

GetVariable looks up the value of a variable by name. If called on a reference, the ref must be scriptable, but not necessary a quest.
[ref.]GetVariable variableName:string [QUEST:quest]

HasVariable returns true if the script has a variable with the specified name
[ref.]HasVariable variableName:string [QUEST:quest]

GetRefVariable looks up the value of a ref variable by name
[ref.]GetRefVariable variableName:string [QUEST:quest]

GetArrayVariable looks up an array variable by name on the calling object or specified quest
[ref.]GetArrayVariable variableName:string [QUEST:quest]

CompareScripts returns true if the compiled scripts are identical
CompareScripts script:formID script:formID

ResetAllVariables sets all variables in a script to zero, unless called on a reference, apply to the calling script.
[ref.]ResetAllVariables

GetNumExplicitRefs returns the number of literal references in a script
GetNumExplicitRefs script:formID

GetNthExplicitRef returns the nth literal reference in a script
GetNthExplicitRef script:formID

RunScript
GetCurrentScript
GetCallingScript

OBSE expressions, see http://obse.silverlock.org/obse_command_doc.html#OBSE_Expressions

Spoiler

Let
eval
While
Loop
ForEach
Continue
Break
ToString (and $)
Print
testexpr (did I test that one ? Can't remember :smile: )
TypeOf
GetUserTime
GetModLocalData (verified ?)
SetModLocalData

OBSE user-defined functions, see http://obse.silverlock.org/obse_command_doc.html#User_Defined_Functions

Spoiler

Call
Function
SetFunctionValue

OBSE Array variables, see http://obse.silverlock.org/obse_command_doc.html#Array_Variables
ar_Construct
ar_Size
ar_Dump
ar_DumpID
ar_Erase
ar_Sort
ar_CustomSort (to be verified, had to wait for user functions and then forgot)
ar_SortAlpha
ar_Find
ar_First
ar_Last
ar_Next
ar_Prev
ar_Keys
ar_HasKey
ar_BadStringIndex
ar_BadNumericIndex
ar_Copy
ar_DeepCopy
ar_Null
ar_Resize
ar_Insert
ar_InsertRange
ar_Append
ar_List
ar_Map
ar_Range

OBSE String variables, see http://obse.silverlock.org/obse_command_doc.html#String_Variables

Spoiler

sv_Destruct
sv_Construct
sv_Set
sv_Compare
sv_Length
sv_Erase
sv_SubString
sv_ToNumeric
sv_Insert
sv_Count
sv_Find
sv_Replace
sv_GetChar
sv_Split
sv_Percentify
sv_ToUpper
sv_ToLower
IsLetter
IsDigit
IsPrintable
IsPunctuation
IsUpperCase
CharToAscii
ToUpper
ToLower
AsciiToChar
NumToHex
ToNumber
GetNthModName
GetName
GetKeyName
GetFormIDString
GetRawFormIDString
GetFalloutDirectory
ActorValueToString
ActorValueToStringC
GetModelPath
GetIconPath
GetBipedModelPath
GetBipedIconPath
GetTexturePath
SetModelPathEX
SetIconPathEX
SetBipedIconPathEX
SetBipedModelPathEX
SetTexturePath
GetNthFactionRankName
SetNthFactionRankNameEX
GetStringGameSetting
SetStringGameSettingEX

3 beta 05 again some package functions.

Spoiler

SetPackageTargetReference sets package target to the calling reference
[ref.]SetPackageTarget package:form [target:ref]

SetPackageTargetCount sets package target count or distance (alias is SetPackageTargetDistance)
SetPackageTargetCount package:form count:int

GetPackageTargetCount gets package target count or distance (alias is GetPackageTargetDistance)
GetPackageTargetCount package:form

SetPackageLocationRadius sets package start location radius
SetPackageLocationRadius package:form radius:float

GetPackageLocationRadius gets package start location radius
GetPackageLocationRadius package:form

3 beta 04 complements SetOpenKey
ClearOpenKey clears the key used to unlock the calling object (shows the lock has broken until unlocked).
ref.ClearOpenKey

3 beta 03 more package functions mainly.

Spoiler

SetOpenKey sets the key used to unlock the calling object
ref.SetOpenKey Key:formID

GetCurrentPackage gets the current package from an actor
[ref.]GetCurrentPackage [actor:ref]

GetPackageLocation gets package start location
GetPackageLocation package:form

The following, while called on a reference, runs on the reference baseForm
GetPackageCount gets the count of packages from an actor base form
[ref.]GetPackageCount [actor:ref]

GetNthPackage gets the Nth package from an actor base form (O is the package with the highest priority)
[ref.]GetNthPackage packageIndex:int [actor:ref]

SetNthPackage sets and returns the Nth package to an actor base form
[ref.]SetNthPackage package:form packageIndex:int [actor:ref]

AddPackageAt adds the Nth package to an actor base form : 0 at top, -1 at end, returns index
[ref.]AddPackageAt package:form packageIndex:int [actor:ref]

RemovePackageAt removes and returns the Nth package from an actor base form: -1 at end
[ref.]RemovePackageAt packageIndex:int [actor:ref]

RemoveAllPackages removes all packages from an actor base form, returns count removed
[ref.]RemoveAllPackages [actor:ref]

Edit: some spoilers to shorten the text.

User avatar
Chelsea Head
 
Posts: 3433
Joined: Thu Mar 08, 2007 6:38 am

Post » Wed Jan 01, 2014 9:40 pm

Thread created on behalf of IanPatt, who is currently very busy with RL.

The new version should be available on the silverlock site when ianpatt returns to his PC.

Note that I ported and wrote all the changes since 3 beta 1 and I will be supporting them in this thread.

User avatar
Dominic Vaughan
 
Posts: 3531
Joined: Mon May 14, 2007 1:47 pm

Post » Thu Jan 02, 2014 2:37 am

Xmas time : arrays & strings, users, Hair and Package functions. Thank you, Santa.

Nice to see all these OBSE stuffs ported, it's working very well.

User avatar
JUDY FIGHTS
 
Posts: 3420
Joined: Fri Jun 23, 2006 4:25 am


Return to Fallout: New Vegas