Page 1 of 9

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 7:38 pm
by Nienna garcia
Please note: OBSE 0019 has been updated to 0019b. Please upgrade to the latest version.

Continuing from the http://www.gamesas.com/index.php?/topic/1131224-relz-oblivion-script-extender-obse-0019/.

The Oblivion Script Extender, or OBSE for short, is a modder's resource that expands the scripting capabilities of Oblivion. It doesn't make any modifications to oblivion.exe, TESConstructionSet.exe, or any other files in your oblivion install, so don't worry about permanent side effects. As of v0017, OBSE requires the 1.2.0.416 version of Oblivion.

http://obse.silverlock.org/download/obse_0019b.zip - current version
http://obse.silverlock.org/
http://obse.silverlock.org/obse_command_doc.html - newly reformatted documentation

0019 is now available for general use. Many thanks to the modders and testers who helped shape this release.

What's new:
Spoiler
0019b:
-Fix changes made to inventory references not being saved if the item previously had no associated extra data
-Fix a potential issue with string variables
-Prevent infinite loop in RemoveEventHandler if more than one script registered for a particular event type
-Partially fix an issue with Quest Log Manager mod generating array access errors

0019a:
-Fixes an issue with stolen items in inventory

0019:
-GetAllModLocalData
-Optional flag to RunScriptLine and RunBatchScript allows suppression of console output during script execution
-Suppress editor warning about unquoted string when using the '->' operator
-Add 'type' field to array returned by GetPackageData
-GetBaseAVForActor now works for all actor values defined on base actors
-Fix GetCellChanged command not reliably reporting cell transitions
-Fix editor CTD associated with a buffer overrun bug present in the unmodified Construction Set
-GetFirst/NextRef now support extremely large worldspaces
-Prevent OnHitWith events from being reported to event handler scripts twice per event
-Fix issues with GetBarterItem
-GetPackageData now includes a 'Type' field indicating the package type
-Various miscellaneous tweaks and bug fixes

0019 beta 4:
-GetWeatherOverride
-GetPackageType
-RemoveModLocalData
-ClearActiveQuest
-GetCurrentEventName
-Get/SetLightRGB
-GetTransactionInfo
-PrintActiveTileInfo
-MagicEffectCodeFromChars
-Fix potential vanilla buffer overrun when parsing commands entered at console (so-called '73-byte bug')
-Add OnActivate event handler support
-Event handlers can now be used with non-actor references
-Add PostLoadGame event handler
-GetActiveMenuSelection correctly recognizes and returns scrolls in magic menu
-GetInputText takes an optional argument to strip HTML from the returned string
-Make game preserve ownership data on inventory references
-Inventory references now correctly handle large quantities of items in a single stack
-Fix potential CTD in AddToLeveledList if called with an invalid list
-Updates to serialization of array/string variables
-Fix potential CTD if GetBarterItem called while a transaction is in progress
-SetClassSkills2 now works as advertised

0019 beta 3:
-GetClassMenuSelected/HighlightedClass
-GetEnchMenuBaseItem
-IsQuestCompleted, UncompleteQuest
-GetRaceHairs/Eyes, GetRaceDefaultHair
-GetInvRefsForItem
-Update plugin API to allow calling user-defined function scripts from plugin code
-Allow plugins to accept array variables by ID as command arguments
-Expand plugin array variable interface
-Fix incorrect number of parameters for SetPCAttributeBonusC
-Fix potential crash when saving after iterating over inventory references
-GetFirst/NextRef now ignore partially-loaded references
-Fix issue with ToggleSpecialAnim
-Misc. fixes and tweaks

0019 beta 2:
-RemoveEventHandler
-GetBookLength
-Get/Set/ModGoldValue now return correct values for alchemy items
-ar_Map and ar_List now accept up to 20 elements
-Fix potential crash when passing strings to script commands
-Fix issue with token/activator scripts which could cause Super Hotkeys to stop functioning

0019 beta 1:
-Inventory reference-walking functionality
-GetMagicEffectChars©
-Getters/Setters for spell flags
-Get/SetActiveQuest
-GetCurrent/CompletedQuests
-Commands for getting and setting location/target/schedule data for AI packages
-ar_Map, ar_Append
-Get/SetTexturePath
-Get/Set/ModSigilStoneUses
-SetDescription
-SetCreatureSoundBase
-GetBoundingBox
-Update3D
-Commands for getting information about the most recent barter transaction
-Commands for getting information about the quantity menu
-IsEquipped
-Get/SetPCAttributeBonusC
-RemoveMeIR, CopyIR
-CreateTempRef
-GetCellChanged
-SetClassSkills2
-Commands for getting information about the most recent Sigil Stone enchantment
-New operators: unary*, unary&, ::, ->
-Updates to plugin API
-New, more readable command documentation format (courtesy of TheMagician)
-Allow use of SetModelPath with creatures and NPCs
-Allow user-defined functions to be called from within array elements
-IsOffLimits uses player by default if argument omitted
-Move SetScript out of beta status
-SetEventHandler
-Linear Algebra functions
-Commands for manipulating actor value modifiers
-Miscellaneous bug fixes and tweaks


Readme (abbreviated):
Spoiler
Oblivion Script Extender v0019
by Ian Patterson, Stephen Abel, and Paul Connelly
(ianpatt, behippo, and scruggsywuggsy the ferret)

Additional contributions from Timeslip, The J, DragoonWraith, SkyRanger-1, badhair, JRoush, shademe, and kyoma.

The Oblivion Script Extender, or OBSE for short, is a modder's resource that expands the scripting capabilities of Oblivion. It doesn't make any modifications to oblivion.exe, TESConstructionSet.exe, or any other files in your oblivion install, so don't worry about permanent side effects. It is compatible with the 1.2.0.416 Oblivion patch, as well as the 1.2 version of the Construction Set. Versions of Oblivion downloaded via Steam are supported as well.

[ Installation ]

If you are using a retail (non-Steam) version of the game:

1. Copy obse_1_2_416.dll, obse_editor_1_2.dll, and obse_loader.exe to your Oblivion directory. This is usually in your Program Files folder, and should contain files called "Oblivion.exe" and "OblivionLauncher.exe".
2. Run oblivion by running obse_loader.exe from the Oblivion directory.

If you use a desktop shortcut to launch Oblivion normally, just update the shortcut to point to obse_loader.exe instead of oblivion.exe.

If you are using the Steam version of the game:

1. Copy obse_1_2_416.dll, obse_editor_1_2.dll, and obse_steam_loader.dll to your Oblivion directory. This is usually "C:\Program Files\Valve\Steam\SteamApps\common\oblivion".
2. OBSE will automatically be run along with Oblivion when launched. To disable this, rename or move obse_steam_loader.dll. You do not need to use obse_loader.exe unless you are running the editor.

Scripts written with these new commands must be written via the TESConstructionSet launched with obse_loader. Open a command prompt window, navigate to your oblivion install folder, and type "obse_loader -editor". The normal editor can open plugins with these extended scripts fine, it just can't recompile them and will give errors if you try.

For mod developers:
  • http://home.comcast.net/~scruggsyW/obse/ScriptViewer.zip - View offsets into compiled scripts to help debug errors reported by OBSE at run-time


[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 10:08 pm
by Vera Maslar
Thanks so much for this.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Thu Sep 02, 2010 1:31 am
by Skivs
Thanks so much for this.


Double that :D - AN 1.1 is going back in. Thank you very much for looking into the Array errors.

Not giving too much away but TheNiceOne should have some news soon if anyones wondering ;)

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 6:50 pm
by Jade MacSpade
[quote name='alt3rn1ty' date='19 November 2010 - 03:25 PM' timestamp='1290183921' post='16699867']
Double that :D - AN 1.1 is going back in. Thank you very much for looking into the Array errors.



Thriple that :)

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 4:09 pm
by Meghan Terry
Not giving too much away but TheNiceOne should have some news soon if anyones wondering ;)

To clarify: users of TheNiceOne's Display Stats and/or Quest Log Manager should be aware that the current versions of those mods have an issue with the way they initialize array variables. This is not at all TNO's fault - the OBSE docs fail to mention that arrays and string variables created at the game's main menu screen become invalid (by necessity) once a new game is started or a saved game is loaded. He has graciously agreed to release updates to those two mods shortly to address this issue. Users of those mods should update as soon as that happens; for the time being they will probably want to remove those mods from their load orders.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 11:12 pm
by NAkeshIa BENNETT
Thanks! :foodndrink:

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 8:43 pm
by Queen Bitch
Sweet, an update. :) I take it the OBSEArrayInterface::GetElement was fixed too?

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 2:26 pm
by michael flanigan
I take it the OBSEArrayInterface::GetElement was fixed too?

Yes.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 6:23 pm
by Zualett
I'm getting an unresolved external error when compiling MenuQue with the latest source. :(
1>    Creating library D:\Oblivion\src\obse_kyoma_menuque\Release\OBSE_Kyoma_MenuQue.lib and object D:\Oblivion\src\obse_kyoma_menuque\Release\OBSE_Kyoma_MenuQue.exp1>GameExtraData.obj : error LNK2001: unresolved external symbol "void __cdecl SetRetainExtraOwnership(bool)" (?SetRetainExtraOwnership@@YAX_N@Z)1>D:\Oblivion\src\obse_kyoma_menuque\Release\OBSE_Kyoma_MenuQue.dll : fatal error LNK1120: 1 unresolved externals


[edit]
Adding Hooks_Gameplay.h and Hooks_Gameplay.cpp to the project seems to fix the error but then I get dozens of other errors. And adding all the OBSE files to my project seems overkill to me....
[/edit]

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 9:40 pm
by Jimmie Allen
I'm getting an unresolved external error when compiling MenuQue with the latest source. :(

Ah, yes - sorry. I'll PM you in a minute or two with info on how to get around that.

EDIT: http://home.comcast.net/~scruggsyW/obse/GameExtraData.zip

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 9:39 pm
by Jah Allen
Ah, yes - sorry. I'll PM you in a minute or two with info on how to get around that.

EDIT: http://home.comcast.net/~scruggsyW/obse/GameExtraData.zip
Cool thanks! :D

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Thu Sep 02, 2010 12:05 am
by Kelly Osbourne Kelly
Well done ferret and thanks for the update. :celebration:

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 9:41 am
by Sunny Under
To clarify: users of TheNiceOne's Display Stats and/or Quest Log Manager should be aware that the current versions of those mods have an issue with the way they initialize array variables. This is not at all TNO's fault - the OBSE docs fail to mention that arrays and string variables created at the game's main menu screen become invalid (by necessity) once a new game is started or a saved game is loaded. He has graciously agreed to release updates to those two mods shortly to address this issue. Users of those mods should update as soon as that happens; for the time being they will probably want to remove those mods from their load orders.


Could you clarify this please? Oblivion XP makes extensive use of arrays and strings and has been working for years. Do I have to do anything to make it work with OBSE 19+? I'm not quite sure what you mean by "arrays and string variables created at the game's main menu screen".

Oblivion XP only requires OBSE 18. I did do some testing with the beta versions of OBSE 19, but I'm running OBSE 18 right now because I'm working on another mod that only requires 18. Ob XP worked with the beta versions of 19.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 5:31 pm
by Alberto Aguilera
Could you clarify this please?

Here is a quest script which illustrates the problem:
scriptName someQuestSCRarray_var anArraystring_var aStringbegin menumode  ; this block will run at the game's title screen, before the user chooses to load a game or start a new one  let anArray := ar_construct Array  let aString := "some string"endbegin gamemode  ; this will run once the player loads a game or starts a new one  let anArray[0] := "something"  let aString += " some more stuff"end

The game starts, and the main menu is visible. Quest scripts start running. The array and string variables in the script get initialized with some ID, probably ID #1.
The user loads a saved game. All arrays and strings in memory are destroyed to make room for arrays and strings stored in his saved game. But the quest variables still contain the IDs they were previously assigned.
Now a couple of things can happen when the quest script's gamemode block runs:

1. The array or string ID stored in each variable no longer is valid, and an error about an uninitialized string or array shows up in the console and obse.log.
2. (more likely) Some other script created string and array variables after or during game load, which were assigned the same IDs as those created by the quest script at the main menu. The assignments in the quest script's gamemode block will alter an array and string which actually belong to a different script -> mayhem ensues.

#2 is what happened with QLM and Display Stats.

There's really no good way around this because we cannot know before the user loads a saved game whether or not any array or string IDs assigned during main menu will conflict with IDs stored in a saved game. As of 0019b you can sort of get away with doing it if the user starts a new game, but it's not recommended.

Nutshell: don't create arrays and string during the main menu and expect them to remain valid after the player starts a new game or loads a saved game. That has AFAICT never worked and it just happens that TNO, being unaware of this, brought it to my attention. If Oblivion XP doesn't do this (and I can't see how it could and still work, regardless of OBSE version), you don't have to worry about it.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 11:39 am
by naomi
Here is a quest script which illustrates the problem:
scriptName someQuestSCRarray_var anArraystring_var aStringbegin menumode  ; this block will run at the game's title screen, before the user chooses to load a game or start a new one  let anArray := ar_construct Array  let aString := "some string"endbegin gamemode  ; this will run once the player loads a game or starts a new one  let anArray[0] := "something"  let aString += " some more stuff"end

The game starts, and the main menu is visible. Quest scripts start running. The array and string variables in the script get initialized with some ID, probably ID #1.
The user loads a saved game. All arrays and strings in memory are destroyed to make room for arrays and strings stored in his saved game. But the quest variables still contain the IDs they were previously assigned.
Now a couple of things can happen when the quest script's gamemode block runs:

1. The array or string ID stored in each variable no longer is valid, and an error about an uninitialized string or array shows up in the console and obse.log.
2. (more likely) Some other script created string and array variables after or during game load, which were assigned the same IDs as those created by the quest script at the main menu. The assignments in the quest script's gamemode block will alter an array and string which actually belong to a different script -> mayhem ensues.

#2 is what happened with QLM and Display Stats.

There's really no good way around this because we cannot know before the user loads a saved game whether or not any array or string IDs assigned during main menu will conflict with IDs stored in a saved game. As of 0019b you can sort of get away with doing it if the user starts a new game, but it's not recommended.

Nutshell: don't create arrays and string during the main menu and expect them to remain valid after the player starts a new game or loads a saved game. That has AFAICT never worked and it just happens that TNO, being unaware of this, brought it to my attention. If Oblivion XP doesn't do this (and I can't see how it could and still work, regardless of OBSE version), you don't have to worry about it.


Ah, it's a scope issue - gotcha :) Just like declaring variables in functions (or methods in java parlance). You can't access those variables outside the scope of the function. Ob XP does have some array declarations in menu mode, but it's in a specific menu and is only valid for the duration of the menu. That's why I panicked a bit when you said they become invalid.

Another question: do strings declared while in menu mode need to be explicitly destroyed? Ob XP currently does, because once again, any strings declared in menu mode are not needed outside of that scope, so they are destroyed before the end of the menu mode block, but I'm curious if you actually have to do so.

Thanks for clarifying that.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 2:29 pm
by Taylor Tifany
This version of OBSE seems to cause my game to crash when I teleport. Has anyone else had that problem? I use teleportation often, so I may have to go back to v0018.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 11:23 pm
by N3T4
Quest Log Manager and Display Stats are now upgraded, where the array initialization is moved to GameMode. I recommend a clean save to get rid of any incorrect array references.

Sorry for the inconvenience :)

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 10:47 am
by Cedric Pearson
Upgraded from version 19 to 19b. Sound is now all messed up and sometimes space bar does not work to initialize conversations, open doors, handle objects
Get this at the end of the obse text documnet

DoLoadGameHook: C:\Users\Monkey\Documents\My Games\Oblivion\Saves\quicksave.ess
loading from C:\Users\Monkey\Documents\My Games\Oblivion\Saves\quicksave.obse
plugin did not read all of its data (at 000000000001E825 expected 000000000001E826)
OBSE: deinitialize

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Thu Sep 02, 2010 12:03 am
by Vicki Gunn
Got to test 19b a little bit myself too, and everything seemed to work just as intended here :foodndrink:

SetCurrentHealth on Inventory references now seem to work as I hoped, and I tested Fast Travel, sounds and conversations a bit, and they all worked here. Not a thorough test, but at least a good sign (for me).

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 6:56 pm
by Dan Scott
Thank you so much for addressing 19 and 19a's issues so quickly. I love you. <3

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 9:29 am
by mimi_lys
I don't know if anyone have asked this question before. :unsure:

Is it possible to download obse0019. with an http://img199.imageshack.us/img199/4754/searchfilepath.png such as \Oblivion\Data\obse\ and files is already in the corrects folders. Is this an idea you would consider to change the archive for newer obse versions?


That picture was taken just to show you what I've used for my own convenience instead of copying files into the correct folders.
You can ignore pluggy if you like and that has worked for me in the past without any issues.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 6:06 pm
by Sheila Esmailka
I can *tentatively* say that the new version seems to have fixed the disappearing mouse pointer problem I've been having (I've played for ~6 hours now with no problems), so thank you for this update!

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Thu Sep 02, 2010 1:30 am
by chinadoll
New function request: GetSize. This would return the size of an object, as listed in the Size column in the CS. See this http://i855.photobucket.com/albums/ab118/AndalayBay/Oblivion/SizeColumn.jpg. In itself, this function will be of limited utility, but I have found it is quite useful if you are trying to categorize a bunch of similar items by size. If such a function exists already, please let me know! But I've hunted around and didn't find anything. I see that there are a variety of functions and attributes available for inventory, but size doesn't seem to be one of them. GetWeight is available and it's this kind of information that I'm referring to.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 8:47 pm
by Justin Bywater
New function request: GetSize. This would return the size of an object, as listed in the Size column in the CS. See this http://i855.photobucket.com/albums/ab118/AndalayBay/Oblivion/SizeColumn.jpg. In itself, this function will be of limited utility, but I have found it is quite useful if you are trying to categorize a bunch of similar items by size. If such a function exists already, please let me know! But I've hunted around and didn't find anything. I see that there are a variety of functions and attributes available for inventory, but size doesn't seem to be one of them. GetWeight is available and it's this kind of information that I'm referring to.
Size appears to be calculated only for bound objects and derives from the attached mesh's NiTriShapeData::Radius. In fact, it seems to be the rounded off value of radius. I'm not sure if the value is stored in each TESBound object, but NifSE should be able to get it for you.

EDIT: It might in the editor. I'll take a look.

[RELz] Oblivion Script Extender (OBSE) 0019b

PostPosted: Wed Sep 01, 2010 5:58 pm
by IM NOT EASY
Size appears to be calculated only for bound objects and derives from the attached mesh's NiTriShapeData::Radius. In fact, it seems to be the rounded off value of radius. I'm not sure if the value is stored in each TESBound object, but NifSE should be able to get it for you.

EDIT: It might in the editor. I'll take a look.


Actually I've been looking at objects with bhkBoxShape, which doesn't have a radius.

For example: folio04.nif
Dimensions of bhkBoxShape: x=1.5344, y=2.3025, z=0.4552
Minimum size: 0.4552

Size in CS: 19

I don't think this is available in NifSE yet because I asked PacificMorrowind (er, that would be DragoonWraith :)) about GetDimensions, which is in NifLib. He said he hasn't done anything with collision at all yet. I thought the size might be easier since it seems to be in the base CS.

As I said, probably of limited utility, but I think it would be handy in certain circumstances.