[BETA] Oblivion Script Extender (OBSE) 0020

Post » Tue May 03, 2011 4:49 am

Continuing from the http://www.gamesas.com/index.php?/topic/1160191-beta-oblivion-script-extender-obse-v0020/.

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 stable version, recommended for general use
http://obse.silverlock.org/beta/obse_0020_beta_5.zip - beta version, recommended for testers and mod developers only
http://obse.silverlock.org/
http://obse.silverlock.org/obse_command_doc.html - newly reformatted documentation

0020 beta 5 is now available for testing.

What's new:
Spoiler
0020 beta 5:
-Get/SetLocalGravity
-Get/SetVelocity
-GetVerticalVelocity
-New events: OnHealthDamage, OnCreateSpell, OnEnchant, OnAttack, OnRelease, OnBowAttack, OnBlock, OnDodge, OnStagger, OnRecoil
-OnActorEquip event now triggered by actors equipping items due to changes in their AI
-OnHealthDamage event can now be filtered by the damaged actor
-SetVerticalVelocity now operates in game units instead of centimeters
-Internal changes to handling of parallel script execution

0020 beta 4:
-Get/SetCellWaterType
-GetEquippedTorchTimeLeft
-(Set)IsHidden/Automatic/MinimalUseDoor, SetIsOblivionGate
-OnEatIngredient, OnNewGame events
-Update active effect commands to work on non-actor magic targets (doors, furniture, etc)
-ar_Erase erases all elements if second argument omitted
-GetGameLoaded now returns true when the player starts a new game

0020 beta 3:
-OnDrinkPotion, OnActorDrop, OnSpell/ScrollCast, OnFallImpact, OnMapMarkerAdd events
-SetVerticalVelocity
-GetHigh/MiddleHighActors
-GetCurrentPackageProcedure
-Get/SetSkillSpecialization
-GetEditorID optionally does not return formID if no string editorID exists
-%B, %b format specifiers for colored text in console
-Fix compiler override not being deactivated at end of script block
-Fix crash in GetRaceHairs/Eyes if race has no hairs/eyes defined
-Fix OnHitWith event being reported multiple times per event if weapon enchanted

0020 beta 2:
-Set/ClearPlayersLastRiddenHorse
-GetNthActiveEffectActorValue
-Equip/UnequipItemSilent
-GetCurrent/CallingScript
-GetRaceVoice now returns "this" race if no voice race is defined
-SetCellWaterHeight now works with cells that aren't defined in editor as having water
-Make "stringVar[-x]" work as expected
-Make foreach/while loops thread-safe
-Fix issue with IsKeyPressed2 introduced in 0020 beta

0020 beta:
-Compiler override for passing OBSE expressions and data types as arguments to any command
-Get/SetCellLighting
-IsNthActiveEffectApplied, GetNthEffectItem
-GetMapMarkers
-PlayIdle
-ar_CustomSort
-GetPathNodesInRadius/Rect
-Is/SetPathNodeDisabled
-GetPathNodePos
-PathEdgeExists
-GetPathNodeLinkedRef
-Get/SetCellClimate
-SetCellBehavesAsixterior, SetCellHasWater
-IsCellPublic, SetCellIsPublic
-IsOblivionInterior/World, IsInOblivion
-(Set)CanFastTravelFromWorld
-GetBoundingRadius, GetEditorSize
-GetTerrainHeight
-ResolveModIndex
-SetPos_T, SetOwnership_T, ClearOwnership_T
-GetRequiredSkillExp
-HasEffectShader
-Get/SetLightDuration, Get/SetTimeLeft
-SetCreatureSkill
-SetInputText, SetTextInputControlHandler, SetTextInputDefaultControlsDisabled


Readme (abbreviated):
Spoiler
Oblivion Script Extender v0020
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

User avatar
Harry Hearing
 
Posts: 3366
Joined: Sun Jul 22, 2007 6:19 am

Post » Tue May 03, 2011 7:45 am

Previous thread died, sorry for the hiatus.

If anyone is experiencing problems with mods not recognizing key presses correctly, or is receiving reports of such issues from their users, please post details. Specifically:
- Describe the problem and under what circumstances it seems to occur;
- Which version(s) of OBSE it occurs with;
- If the problem is resolved by reverting to a previous version of OBSE (which one?); if mods must be removed in order to revert please specify which ones;
- Full active mod list.
- Whether or not a STEAM version of the game is being used.

We've gotten sporadic reports of issues with key detection, but it's unclear what mods are involved and which versions of OBSE are being used. I am trying to determine if I should be debugging particular mods or OBSE itself. This is basically the only thing holding back official release of 0020, so your help in narrowing down the source of the problem is appreciated.
User avatar
Izzy Coleman
 
Posts: 3336
Joined: Tue Jun 20, 2006 3:34 am

Post » Tue May 03, 2011 6:06 am

If anyone is experiencing problems with mods not recognizing key presses correctly, or is receiving reports of such issues from their users, please post details.

Also whether or not they're using the Steam version of Oblivion. Under certain circumstances the NVSE DLL wasn't being loaded before the runtime code was unsuspended, causing any code hooked on startup to fail (mainly the dinput hook). I've tried reproducing this with Oblivion and it didn't happen for me, but it might be another good thing to keep track of.
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Tue May 03, 2011 1:25 am

Having a bit of trouble using GetTexturePath.

I can't seem to get it to return a value.. Here is my current code(though I've tried about every variation, ToString, $, etc,.), the Item is correct, GetName functions fine, however, IconPath always shows up as an empty string. (Even through DebugPrint\MessageEx\etc,..)

Spoiler

scn guiDisenchantshort Buttonref Itemstring_var IconPathstring_var ItemNameBegin Function { Item }	if (aaaMenuQST.SubMenu == 1)		Let ItemName := GetName Item		Let IconPath := GetTexturePath Item				Set Button to GetGenericButtonPressed		ShowGenericMenu "Disenchant.xml"					  				SetMenuStringValue "user0|%z" IconPath 1011		SetMenuStringValue "user1|%z" ItemName 1011		Set aaaMenuQST.SubMenu to 2	elseif (aaaMenuQST.SubMenu == 2)		Set Button to GetGenericButtonPressed		; Disenchant Button		if (Button == 11)			Call aaaDisenchant Item			sv_Destruct IconPath ItemName			Call aaaReleaseHotkey			Set aaaMenuQST.SubMenu to 0			Return		endif		; Exit Button		if (Button == 22)			Message "Disenchant Canceled!"			sv_Destruct IconPath ItemName			Call aaaReleaseHotkey			Set aaaMenuQST.SubMenu to 0			Return		endif	endifEnd


User avatar
Love iz not
 
Posts: 3377
Joined: Sat Aug 25, 2007 8:55 pm

Post » Tue May 03, 2011 3:36 am

@Arthmoor: Ok, I'll see what I can do plugin-wise when I get a chance.


Any word on this, and what you meant by it?
User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Post » Mon May 02, 2011 9:33 pm

Also whether or not they're using the Steam version of Oblivion. Under certain circumstances the NVSE DLL wasn't being loaded before the runtime code was unsuspended, causing any code hooked on startup to fail (mainly the dinput hook). I've tried reproducing this with Oblivion and it didn't happen for me, but it might be another good thing to keep track of.

Thanks.
Having a bit of trouble using GetTexturePath.

I can't seem to get it to return a value.. Here is my current code(though I've tried about every variation, ToString, $, etc,.), the Item is correct, GetName functions fine, however, IconPath always shows up as an empty string. (Even through DebugPrint\MessageEx\etc,..)

What type of item does the Item variable refer to? Note that if it's clothing or armor, you'll need to use GetBipedIconPath instead - there are separate icons for each gender.
Any word on this, and what you meant by it?

If it'd be useful to you, I can look into 1) where in code the game decides to set the MOVED change flag for exterior load doors, 2) why it does that, and 3) any horrendous effects potentially associated with preventing it from doing that. If I can be at least reasonably sure that #3 isn't a concern then I could provide a support plugin for Open Cities which would prevent the issue we discussed with SetPos_T and those doors. (Regardless of how safe this change turns out to be it's unlikely to be included in the OBSE core as it's not something most of our users want/need).
I don't want to promise you anything here other than that I will investigate it further if it sounds like it will be useful to you.
User avatar
Tanya Parra
 
Posts: 3435
Joined: Fri Jul 28, 2006 5:15 am

Post » Tue May 03, 2011 9:50 am

Thanks.

What type of item does the Item variable refer to? Note that if it's clothing or armor, you'll need to use GetBipedIconPath instead - there are separate icons for each gender.


I see, that may be the problem, it is indeed things like clothing\rings\etc,.

(I was thinking GetTexturePath replaced all the old icon functions, and worked for everything..)

(Edit: Still changing the code, can't tell if it's helping or not yet..)
User avatar
LuCY sCoTT
 
Posts: 3410
Joined: Sun Feb 04, 2007 8:29 am

Post » Tue May 03, 2011 8:40 am

I don't want to promise you anything here other than that I will investigate it further if it sounds like it will be useful to you.


Yes, it would be useful, but if it turns out not to be feasible, how much less of an issue is it to have a version of the command that changes the base model on a reference that doesn't make permanent changes?
User avatar
Becky Palmer
 
Posts: 3387
Joined: Wed Oct 04, 2006 4:43 am

Post » Tue May 03, 2011 3:57 am

Yes, it would be useful, but if it turns out not to be feasible, how much less of an issue is it to have a version of the command that changes the base model on a reference that doesn't make permanent changes?

Depends. Models are specified per base object, not per reference, so changing the model (using SetModelPath) will change it for any subsequently-loaded references to that base object. However, changes made by SetModelPath are not stored in the saved game, but they do persist until reset via script or the game is restarted (i.e. the norm for most OBSE commands). Judging from previous discussion this is not what you're looking for.
EDIT: Update3D might be an option; let me test it. Can you clarify what you'd be using such a command for?
User avatar
D IV
 
Posts: 3406
Joined: Fri Nov 24, 2006 1:32 am

Post » Mon May 02, 2011 9:15 pm

Okay, so I set that up, but I have a few questions..

Do I need to use the other Biped paths? I'm using 0 at the moment, but will I need to use other values to get females to work properly? (Never had to use these features b4, so I have no clue,..

Also, even though the value is now returning properly, it's still not being consumed by SetMenuStringValue, do I need to use $\ToString, etc,. ?
User avatar
anna ley
 
Posts: 3382
Joined: Fri Jul 07, 2006 2:04 am

Post » Mon May 02, 2011 10:28 pm

Okay, so I set that up, but I have a few questions..

Do I need to use the other Biped paths? I'm using 0 at the moment, but will I need to use other values to get females to work properly? (Never had to use these features b4, so I have no clue,..

Also, even though the value is now returning properly, it's still not being consumed by SetMenuStringValue, do I need to use $\ToString, etc,. ?

TBH I don't know of any vanilla items for which the male icon path differs from the female icon path. You can use 0, or you can base it on the player character's gender.

ShowGenericMenu is a MenuQue command, correct? You're not necessarily going to see a visible effect from changing the path in the menu without refreshing the menu. You can determine if the string value is being updated by calling GetMenuStringValue after modifying it and verifying the returned string matches the expected modified value. If it doesn't, it may be an issue with the generic menu type, which is unused by the game and so untested (by me, anyway) with OBSE's UI commands.
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Tue May 03, 2011 9:09 am

ShowGenericMenu is a MenuQue command, correct? You're not necessarily going to see a visible effect from changing the path in the menu without refreshing the menu. You can determine if the string value is being updated by calling GetMenuStringValue after modifying it and verifying the returned string matches the expected modified value. If it doesn't, it may be an issue with the generic menu type, which is unused by the game and so untested (by me, anyway) with OBSE's UI commands.


The menu is populated by the SetMenuStringValue functions, ItemName is working properly, IconPath is not, so it's not a problem in MenuQue, as far as I can see..

SetMenuStringValue is refusing to take the string I'm giving it... (I'll go over my code again, but I'm sure it's correct..)

Edit: Btw, I can directly pass an icon path through my function, and it also works fine(ie, shows up in the actual menu..).. So everything is pointing towards a problem in SetMenuStringValue,..
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am

Post » Tue May 03, 2011 5:52 am

EDIT: Update3D might be an option; let me test it. Can you clarify what you'd be using such a command for?


If it turns out SetPos_T isn't useful in moving the doors, I'd want to cause the model used by the doors to change to something invisible and collisionless so that the player can just walk through and not deal with it.

I forget if I explained this before, but currently the Open Cities mod removes the persistent flag from the city load doors, sets the initially disabled flag, and moves them below ground. Although it's debatable if moving them at all is even necessary. This works fine if you load from the desktop for the first time, but if someone reloads the game without completely exiting, the doors return to where Oblivion.esm wants them without regard to the changes the mod has made.

The problem is, explaining this to the users isn't working and I am getting repeated complaints about the mod being "full of bugs" when it's actually an engine issue I have no control over. Which is what's motivating me to try and find a way to get around it, because most of the usual tricks that work fine on normal objects fall apart when used on load doors and other persistent objects.

It's actually a manifestation of a bug Kivan talked about ages ago where trying to move certain things around would result in them "snapping back" if the game was reloaded. In my case it's doing this because I'm stripping the persistent flag in a non-conventional way.
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm

Post » Tue May 03, 2011 6:51 am

SetMenuStringValue is refusing to take the string I'm giving it... (I'll go over my code again, but I'm sure it's correct..)

Please explain what you mean by this - is it failing to compile, or failing to have the expected result at run-time? If the latter, please use GetMenuStringValue to determine if the change is being applied.
If it turns out SetPos_T isn't useful in moving the doors, I'd want to cause the model used by the doors to change to something invisible and collisionless so that the player can just walk through and not deal with it.

I forget if I explained this before, but currently the Open Cities mod removes the persistent flag from the city load doors, sets the initially disabled flag, and moves them below ground. Although it's debatable if moving them at all is even necessary. This works fine if you load from the desktop for the first time, but if someone reloads the game without completely exiting, the doors return to where Oblivion.esm wants them without regard to the changes the mod has made.

The problem is, explaining this to the users isn't working and I am getting repeated complaints about the mod being "full of bugs" when it's actually an engine issue I have no control over. Which is what's motivating me to try and find a way to get around it, because most of the usual tricks that work fine on normal objects fall apart when used on load doors and other persistent objects.

It's actually a manifestation of a bug Kivan talked about ages ago where trying to move certain things around would result in them "snapping back" if the game was reloaded. In my case it's doing this because I'm stripping the persistent flag in a non-conventional way.

Ok. Well, if you wanted to change the model on a per-reference basis you could do this:
let originalPath := door.getModelPathdoor.setModelPath "some_invisible_thing.nif"door.update3Ddoor.setModelPath $originalPath

This would render the door invisible without affecting other references to the door's base object. However, the change would only persist as long as the door's cell is in memory; once the cell is flushed and reloaded you'd need to repeat the above. It would also require that some_invisible_thing.nif had already been loaded by the game's resource manager before the script was executed - something that's tough to enforce script-side. All in all not a hugely useful option.
User avatar
Mr.Broom30
 
Posts: 3433
Joined: Thu Nov 08, 2007 2:05 pm

Post » Tue May 03, 2011 5:19 am

Please explain what you mean by this - is it failing to compile, or failing to have the expected result at run-time? If the latter, please use GetMenuStringValue to determine if the change is being applied.


Okay, after a bit more testing, SetMenuStringValue, is working..

Seems to be a path issue, it(xml image element) can't find the file I'm feeding it, so the path must not be in a proper format.. ? (Which makes no sense.)

Shouldn't the path retrieved(GetxxxIcon) already be relevant to what the UI already expects?
User avatar
krystal sowten
 
Posts: 3367
Joined: Fri Mar 09, 2007 6:25 pm

Post » Tue May 03, 2011 2:51 am

Okay, after a bit more testing, SetMenuStringValue, is working..

Seems to be a path issue, it(xml image element) can't find the file I'm feeding it, so the path must not be in a proper format.. ? (Which makes no sense.)

Shouldn't the path retrieved already be relevant to what the UI already expects?

Check the path returned by GetMenuStringValue *before* modifying it and see if it is relative to the same folder as the icon path you are specifying. It's quite possible it's not (e.g. path may be expected to be relative to Data/menus/icons or something along those lines) in which case you'd need to reformat your path before passing it in.
User avatar
Louise Andrew
 
Posts: 3333
Joined: Mon Nov 27, 2006 8:01 am

Post » Tue May 03, 2011 9:20 am

I forget if I explained this before, but currently the Open Cities mod removes the persistent flag from the city load doors, sets the initially disabled flag, and moves them below ground. Although it's debatable if moving them at all is even necessary. This works fine if you load from the desktop for the first time, but if someone reloads the game without completely exiting, the doors return to where Oblivion.esm wants them without regard to the changes the mod has made.


I am probably missing the point, but . . . why not place a scripted object at the center of the town, with a script that, every once in a while (at game load, at cell load, or ), cycles thru and disables all/some doors with FormID 00xxxxxx?
User avatar
emma sweeney
 
Posts: 3396
Joined: Fri Sep 22, 2006 7:02 pm

Post » Tue May 03, 2011 9:40 am

Check the path returned by GetMenuStringValue *before* modifying it and see if it is relative to the same folder as the icon path you are specifying. It's quite possible it's not (e.g. path may be expected to be relative to Data/menus/icons or something along those lines) in which case you'd need to reformat your path before passing it in.


Yeah, that's what I'm thinking, certain UI element types may be hardcoded to certain paths, so I may just be using the wrong element type for what I'm trying to display..

Thanks for the help Scruggsy, this should be enough to get me sorted.. :)

--------------

Edit: The UI element was expecting paths relative to "Textures", so just appending "Icons\" was enough to get it working.. :)
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Mon May 02, 2011 9:05 pm

I am probably missing the point, but . . . why not place a scripted object at the center of the town, with a script that, every once in a while (at game load, at cell load, or ), cycles thru and disables all/some doors with FormID 00xxxxxx?


Can't do that. Scripted changes to objects get updated in the save and aren't reversible when the mod is uninstalled.
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Tue May 03, 2011 6:28 am

Just a few questions...and another request :whistling:
  • In a forEach loop, is there any problem with useing a function that returns an array for the source array (arSet <- GetHighActors) ?
    The reason I ask is that I have a function that takes an array and returns an array with the same elements but in a random order. I just want to make sure that my function will not be called for each iteration of the loop.
  • How is sv_GetChar supposed to be used? Its only mentioned briefly in Character Functions but there is no details on it.

Also is there any chance of getting permitting versions of SetBipedSlotMask and SetEquipmentSlot?
User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am

Post » Mon May 02, 2011 9:43 pm

We've gotten sporadic reports of issues with key detection, but it's unclear what mods are involved and which versions of OBSE are being used. I am trying to determine if I should be debugging particular mods or OBSE itself. This is basically the only thing holding back official release of 0020, so your help in narrowing down the source of the problem is appreciated.
I have posted the list of questions to Enhanced Hotkey's thread at TESNexus. I still fear that there is something wrong in EH's code, and not OBSE - but IRRC there have been one or more reports unrelated to EH too.


On another note, it seems that the really, really strange issue with GetEquippedObject that I mentioned in the PM isn't completely fixed. To recap, if I have one mod regularly calling set somevar to Player.GetEquippedObject 16 (like Drop Lit Torches), and HUD Status Bars calling RunScriptLine "set tnoHSB.var to Player.GetEquippedObject 16" the other mod stops working correctly. By changing HSB's call to a regular set var to Player.GetEquippedObject 16, the issue seemed to go away, but I have just got a report of DLT behaving strangely with the last version of HSB too. The problem seems to occur with other slot numbers as well, not only #16, btw.

This seems totally weird, but I tested it myself with DLT OBSE and with the following results:

DLT alone: Worked all the time
DLT with HSB, where I disabled all bars that called the above: Worked all the time
DLT with HSB, where I enaabled one bar calling the above: DLT stopped working after 1-5 uses (equipping torch, dropping, picking up)
DLT wirh HSB, where I added a number of PrintC statements to DLT: It seemed to work all the time (but not tested very much)
DLT with HSB, where I moved the HSB call out of the RunScriptLine: Seemed to work all the time (30 uses or so), but reported in the http://www.gamesas.com/index.php?/topic/1167449-relz-hud-status-bars/page__view__findpost__p__17262411 to still stop working after a lot of mashing of the DLT hotkey.


On a related note: My HUD Status Bars (which strangely enough is my mod with highest download rate) relies A LOT on RunScriptLine calls. And I'm wondering on the effiency of this. Are RunScriptLine calls noticably slower than just calling the same code directly, or doesn't it matter much?


Finally, a (small) request. Would it be possible to have a GetCurrentEnemy function that returns the reference to the enemy who's health is currently shown in the health bar (and 0 when the health bar is invisible)? I know this isn't the best time to ask for additions, and I have a script that works well enough (by using an Event Handler to get the ref of the enemy the player attacks) so it is not a very high priority, but would be nice to have if it is easy to add.
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Tue May 03, 2011 5:43 am

Couple of bug reports:
* I can't seem to use sv_Length in a compiler-override block. It keeps complaining about a missing int (I guess the string_var parameter is converted into a string when being compiled).
* When calling GetDescription multiple times in a row for the same skill the text stays the same, even when a different whichPerk parameter is passed. Calling it on another skill in between seems to fix it.
* About SetInputText, how am I suppose to use it? I noticed it only takes a string and not a format string but using the $string_var trick doesn't work for strings longer than 512 characters.

-kyoma
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Tue May 03, 2011 7:04 am

Just a few questions...and another request :whistling:
  • In a forEach loop, is there any problem with useing a function that returns an array for the source array (arSet <- GetHighActors) ?
    The reason I ask is that I have a function that takes an array and returns an array with the same elements but in a random order. I just want to make sure that my function will not be called for each iteration of the loop.
  • How is sv_GetChar supposed to be used? Its only mentioned briefly in Character Functions but there is no details on it.

Also is there any chance of getting permitting versions of SetBipedSlotMask and SetEquipmentSlot?

1. No problem. The ForEach line is evaluated only once, at the beginning of the loop.
2. sv_GetChar pre-dates the nicer bracket syntax. The following are equivalent; use whatever is more comfortable for you:
string_var stringstring_var charlet char := string[2] ; return a string containing the third character of stringlet char := sv_GetChar string 2 ; ditto

Request: Same chance as getting permanent versions of other non-permanent OBSE commands - it's a matter of setting up the infrastructure to record changes and manage them properly based on changing load orders.
I have posted the list of questions to Enhanced Hotkey's thread at TESNexus. I still fear that there is something wrong in EH's code, and not OBSE - but IRRC there have been one or more reports unrelated to EH too.

Thanks. I'm not trying to single out EHK or any other mod - just trying to get some more solid info as the bug reports so far have been kinda short on detail.
On another note, it seems that the really, really strange issue with GetEquippedObject that I mentioned in the PM isn't completely fixed.

Checking it out. Are either of these calls to GetEquippedObject originating in token scripts?
Are RunScriptLine calls noticably slower than just calling the same code directly, or doesn't it matter much?

RunScriptLine has to compile the script text before executing it so it will take longer than executing a precompiled script containing the same text. I wouldn't call it noticeable, particularly since the command only compiles one line of script, but yeah, you're trading execution speed for run-time flexibility. Now if you're using RunBatchScript with some long complicated script the time spent compiling may become noticeable.
Finally, a (small) request. Would it be possible to have a GetCurrentEnemy function that returns the reference to the enemy who's health is currently shown in the health bar (and 0 when the health bar is invisible)? I know this isn't the best time to ask for additions, and I have a script that works well enough (by using an Event Handler to get the ref of the enemy the player attacks) so it is not a very high priority, but would be nice to have if it is easy to add.

That shouldn't be a problem. Note that the actor who's health meter is shown above the crosshair is not necessarily an enemy, though.
Couple of bug reports:
* I can't seem to use sv_Length in a compiler-override block. It keeps complaining about a missing int (I guess the string_var parameter is converted into a string when being compiled).
* When calling GetDescription multiple times in a row for the same skill the text stays the same, even when a different whichPerk parameter is passed. Calling it on another skill in between seems to fix it.
* About SetInputText, how am I suppose to use it? I noticed it only takes a string and not a format string but using the $string_var trick doesn't work for strings longer than 512 characters.

-kyoma

Thanks.
1. Fixing. Fixed.
2. Yeah, the game caches the most recently-retrieved TESDescription. Fixing. Fixed.
3. Fixed.
User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Post » Tue May 03, 2011 3:18 am

Thanks. I'm not trying to single out EHK or any other mod - just trying to get some more solid info as the bug reports so far have been kinda short on detail.
No problem. But I have learned well enough to never be sure that the problem is not a bug in my code :)

Checking it out. Are either of these calls to GetEquippedObject originating in token scripts?
HSB has it in the main quest script. Drop Lit Torches uses it in the main quest script, and in the OnAdd block on the torch you can pick up.

RunScriptLine has to compile the script text before executing it so it will take longer than executing a precompiled script containing the same text. I wouldn't call it noticeable, particularly since the command only compiles one line of script, but yeah, you're trading execution speed for run-time flexibility. Now if you're using RunBatchScript with some long complicated script the time spent compiling may become noticeable.
Thanks. I already do quite an amount of pre-"compiling" of the code strings at savegame load, and store the result in arrays for later use - which seems like the right thing to do (and expand on) for speed reasons.

That shouldn't be a problem. Note that the actor who's health meter is shown above the crosshair is not necessarily an enemy, though.
I hand't noticed, but that's OK. HUD Status Bars now has the possibility of displaying a health bar with better functionality than the vanilla one, but it can currently only display it for an enemy attacked by the player (getting its ref through the "OnHit" Event Handler), and it could be benefical to get be able to display it in situations where you have not yet hit anyone.
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Post » Tue May 03, 2011 4:19 am

Finally, a (small) request. Would it be possible to have a GetCurrentEnemy function that returns the reference to the enemy who's health is currently shown in the health bar (and 0 when the health bar is invisible)? I know this isn't the best time to ask for additions, and I have a script that works well enough (by using an Event Handler to get the ref of the enemy the player attacks) so it is not a very high priority, but would be nice to have if it is easy to add.

I'm not sure this wouldn't be any different than this:
scn GetCurrentEnemyref rTmpref rMebegin function { }  set rTmp to GetCrosshairRef  set rMe to this  if (rTmp != 0)    if (rMe.GetCombatTarget == rTmp || rTmp.GetCombatTarget == rMe)     SetFunctionValue rTmp    endif  endifend

Sadly, the GetCombatTarget doesn't work for player. Now an "IsActiveEnemy" type of function would work in there like this:

scn GetCurrentEnemyref rTmpbegin function { }  set rTmp to GetCrosshairRef  if player.IsActiveEnemy rTmp   SetFunctionValue rTmp  endifend

Meaning the person in the crosshair is an "active" enemy, in combat with the player, but to tell if they're directly attacking, GetCombatTarget on them would work.

Is this what you were meaning/looking for? What exactly are you wanting to do to the person in the crosshair?

GuruSR.
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Next

Return to IV - Oblivion