[BETA] Oblivion Script Extender (OBSE) 0020

Post » Tue May 03, 2011 9:55 am

To OBSE team:

I have just received a http://www.gamesas.com/index.php?/topic/1167647-relz-enhanced-hotkeys/page__view__findpost__p__17299321 (as requested), in Enhanced Hotkey's thread, saying:

There were reports of oddness when using EH with obse20b5 in the last thread, didn't have any resolution yes? Just thought I'd drop a note here again since I encountered the issue when Oblivion XP's latest version required obse20b5. Basically key "2" stopped functioning, there's just one weapon assigned to it. Holding block, which is at default right mouse button, brings up the hotkey grid.

EH:3 -> 1EH:Ready hotkey 0/1EH:Opening wheel 0/1EH:Display wheel 0EH:3 -> 1EH:Select 3 -> 1EH:Update commands for 0/1/0EH:Don't activate hotkey 1 with wheel open


This is just holding the right mouse button. From the console debug, seems right mouse button is now keyboard "2"? Downgrade back to obse19b and the issue goes away.

For the record, what the debug log says, is that Enhanched Hotkey discovers that key 2 (dx code 3) is pressed, Where the press is discovered by:
	let numKeys := GetNumKeysPressed	if numKeys > 0				let i := 0		While i < numKeys			let dx := GetKeyPress i			...


or by:
	let numKeys := GetNumMouseButtonsPressed	if numKeys > 0		let i := 0		While i < numKeys			let dx := GetMouseButtonPress i			...


The debug log doesn't differ between the two, so it seems that either GetNumKeysPressed/GetKeyPressed returns a false 3 when right mouse button is pressed, or that GetNumMouseButtonsPressed/GetMouseButtonPress returns 3 (and not 257 as it should) when the rmb is pressed. But as omeletted writes, the issue goes away when downgrading to obse19b - which seems to match this report by other users.

Anyway, after the press is detected, EH uses "if IsKeyPressed2 tnoEH.keyDx" to check when the button is lifted (where tnoEH.keyDx is the dx code, in this case 3), and since the hotkey menu gets displayed when the rmb is held for some time, that proves that "if IsKeyPressed2 tnoEH.keyDx" returns 1 as long as the rmb is held down.
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Tue May 03, 2011 4:55 am

Just a quick request;

When you equip an enchanted item the AE's are immediately added, but they are not applied until a frame (or two?) later.

Currently the GetTotalAE*Magnitude functions behave a little strange when an ActiveEffect has been added but is not yet active... for drain effects it seems the AE is included, but it has a inverted magnitude until it has been applied. This means GetTotalAE*Magnitude functions give you a very strange value when there are AE's that are not yet applied. I guess the strange "negative magnitude" and delayed application is the reason the IsNthActiveEffectApplied function was added.

Would it be possible to fix the GetTotalAE*Magnitude functions to not include effects that are not yet applied? This will fix the screwy inverted value "bug" and will also allow things like modAVmod fixers to use the GetTotalAE*Magnitude functions without strange race conditions with AE's added but not yet applied. They can just do things like this to ensure that the modavmod fatigue max value correctly reflects the currently applied fatigue fortify and drain effects.

  let fatigueDrain := GetTotalAENonAbilityMagnitude FOFA + GetTotalAENonAbilityMagnitude DRFA  modAVmod fatigue max fatigueDrain


I realise that this is a slight change in behaviour from previous releases, but I'd be very surprised if anyone was taking advantage of this behaviour, and it's probably also the cause of a few mysterious bugs in mods that are using these GetTotalAE*Magnitude.
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Tue May 03, 2011 1:34 am

I have just received a http://www.gamesas.com/index.php?/topic/1167647-relz-enhanced-hotkeys/page__view__findpost__p__17299321 (as requested), in Enhanced Hotkey's thread, saying:

Ok thanks. If you can, try to get this user to provide the information requested in the second post of this thread.
IsDigit seems to be returning true no matter what ASCII code gets passed.

Fixed. In the interim you should be able to use:
if char >= "0" && char <= "9"  ; it's a digit

I would like to request a command for swapping the first person skeleton.
[snip]
Also, would it be possible to create a version of PlayIdle that works on the player in 1st person?

Thanks for the code, that will make it easier to put something together.
GetTerrainSlope (or GetTerrainNormal) - return the slop (normal) of the terrain mesh at the specified x and y coordinates within the current exterior worldspace, for a distance d and a direction z
(height:float) GetTerrainSlope x:float y:float d:float z:float

ar_EraseAll - Erase all elements of all arrays of the current script

GetDimension - returns the object's current dimension in the specified axis.
(dimension:float) reference.GetDimension axis:axis

Terrain slope is on the agenda.
If you want to erase all the arrays of a particular script you'll need to erase them manually. OBSE doesn't keep track of which arrays are in use by which scripts.
I've located code in the editor executable to calculate an object's extents along each axis, I need to translate it into something usable at run-time.
ummm... CS is giving me an error (invaild actor value ) when I try to use GetPlayerSkillUse 28

It will accept GetPlayerSkillUse marksman

I am very confused.

Typo in the docs, the argument is an actor value. Sorry.
A quick request: GetCellNorthMarker(Angle). The related ExtraData was already decoded so I'm guessing it is (relatively) easy to add.

Yes it is.

Can anyone comment on array iteration speed

It is fast enough. Once we've put the lid on 0020 I will be looking at swapping out the data structures underlying the string/array variable stuff to give it constant-time lookup.
WARNING: substantial numbers of string variables exist for the following files (may indicate savegame bloat):
Advanced Magecraft.esp (633 strings)

Send me the .obse file.
Would it be possible to fix the GetTotalAE*Magnitude functions to not include effects that are not yet applied?

Those commands have already been upgraded to included an additional optional boolean argument specifying that not-yet-applied effects should be ignored.
User avatar
Brooks Hardison
 
Posts: 3410
Joined: Fri Sep 07, 2007 3:14 am

Post » Tue May 03, 2011 1:27 am

I've located code in the editor executable to calculate an object's extents along each axis, I need to translate it into something usable at run-time.
I might be able to help with that - I've already ported that code for runtime use.
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Mon May 02, 2011 9:46 pm

I might be able to help with that - I've already ported that code for runtime use.

Cool. Is it still in assembly though? Most of the floating point arithmetic can be pretty much copied and pasted, but I'd like to convert it into C++ code (mainly so I can flesh out the NetImmerse types it operates on).
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Tue May 03, 2011 8:47 am

Cool. Is it still in assembly though? Most of the floating point arithmetic can be pretty much copied and pasted, but I'd like to convert it into C++ code (mainly so I can match it up to the NetImmerse types it operates on).
Sadly, yeah. I took a shot at rewriting it in C++ but didn't end up with good results (probably due to improperly interpreted local variables). If I recall correctly, it mostly worked around with the root NiNode's component NiTriShapes/Stripes. Utility types NiVector3 and NiMatrix33 are primarily used. I'll send you the ported code (and the rewrite, if I can find it) in a bit.
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm

Post » Tue May 03, 2011 11:02 am

Ok thanks. If you can, try to get this user to provide the information requested in the second post of this thread.
I have PM'd him with the list. I guess you can say that the three first points have already been answered:
- Describe the problem and under what circumstances it seems to occur;
Enhanced Hotkey thinks keyboard key 2 is pressed when rmb is pressed

- Which version(s) of OBSE it occurs with;
obse20b5

- 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;
"Downgrade back to obse19b and the issue goes away."

...but as said, I have PM'd him and asked him to post the rest here. It occurred to me that maybe it could be a conflict with a mod that's dependent on OBSEv20 for doing the things that cause incompatibility - but that's a pretty wild guess.
User avatar
Hot
 
Posts: 3433
Joined: Sat Dec 01, 2007 6:22 pm

Post » Tue May 03, 2011 6:06 am

I experienced the bugs with both combat magic and EH even when I had no mod that required OBSE20b5 installed. So just OBSE20b5 and the issues with these mods were there and reverting to 19b and all was good again.

Not steam.
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm

Post » Tue May 03, 2011 3:51 am

Her. :tongue:

To make things easier, I started a new game to experiment with. Think I've something.

1) obse19b + EH 2.1.1 + Deadly Reflex 6 = ok
2) obse20b5 + EH 2.1.1 + Deadly Reflex 6 = quirkiness
3) obse19b or obse20b5 + EH 2.1.1 = ok

This is a new game, in a nice quiet cell with nothing happening. Holding right mouse button (block) gets the issue described earlier. Downgrade back to obse19b and it fixes itself. No other mods and non steam version.
User avatar
Killah Bee
 
Posts: 3484
Joined: Sat Oct 06, 2007 12:23 pm

Post » Tue May 03, 2011 5:53 am

Her. :tongue:

To make things easier, I started a new game to experiment with. Think I've something.

1) obse19b + EH 2.1.1 + Deadly Reflex 6 = ok
2) obse20b5 + EH 2.1.1 + Deadly Reflex 6 = quirkiness
3) obse19b or obse20b5 + EH 2.1.1 = ok

This is a new game, in a nice quiet cell with nothing happening. Holding right mouse button (block) gets the issue described earlier. Downgrade back to obse19b and it fixes itself. No other mods and non steam version.

Great, thanks (you too, Psymon). Definitely going to be an OBSE issue then.
I'd be interested to know if you find any issue running obse 20b5 + Deadly Reflex 6 (without EH) and if so, if the issue goes away with 0019b. Could indicate a conflict arising from multiple mods using the input functions simultaneously.
User avatar
Devils Cheek
 
Posts: 3561
Joined: Sun Aug 13, 2006 10:24 pm

Post » Tue May 03, 2011 5:24 am

Send me the .obse file.


http://rapidshare.com/files/451732170/Save_553_-_Damien_-_My_Imperial_City_House__Level_27__Playing_Time_40.44.26.obse

I've been using sv_Destruct String1 String2, and it's called on all my strings.. Should I be using the other one?

Let String1 := sv_Destruct...

---

Not that I know to much about what you're doing, but yeah, I"m surprised there isn't an issue, given the number of mods using the input functions at once.. You may end up having to create new instances of the key handler for each mod requesting them.. (or per mod, regardless..) (Just curious, after reading about it, are you using a static method, or what? I've been trying to learn how to do this kind of stuff myself, I'm kinda stuck on decoding data structures, and reading the stack, and finding info on the subject, can be hard. I have created an .exe hook that works on GTA2 though(just hooks the addmoney function from killing peds), so, I'm learning..)

Anways, I just wanted to add, my mods been doing well, no key issues, and I haven't had any reports of problems from users yet..
User avatar
Emily Martell
 
Posts: 3469
Joined: Sun Dec 03, 2006 7:41 am

Post » Tue May 03, 2011 3:58 am

I'd be interested to know if you find any issue running obse 20b5 + Deadly Reflex 6 (without EH) and if so, if the issue goes away with 0019b. Could indicate a conflict arising from multiple mods using the input functions simultaneously.


Mmm, don't really know what to test for with just DR6 but didn't run into any issues. Didn't test extensively so might not mean anything.
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Mon May 02, 2011 6:50 pm

http://rapidshare.com/files/451732170/Save_553_-_Damien_-_My_Imperial_City_House__Level_27__Playing_Time_40.44.26.obse

Lots of strings identifying the names and icon paths of inventory items. e.g. "icons\weapons\daedricarrow.dds", "Glass Cuirass", etc. There appear to be several copies of each icon path. They are all recorded as belonging to Advanced Magecraft. If you don't intend for those strings to be persistent you will want to look through your scripts to figure out where one or more string_vars are not being disposed of.
User avatar
Etta Hargrave
 
Posts: 3452
Joined: Fri Sep 01, 2006 1:27 am

Post » Mon May 02, 2011 8:12 pm

Lots of strings identifying the names and icon paths of inventory items. e.g. "icons\weapons\daedricarrow.dds", "Glass Cuirass", etc. There appear to be several copies of each icon path. They are all recorded as belonging to Advanced Magecraft. If you don't intend for those strings to be persistent you will want to look through your scripts to figure out where one or more string_vars are not being disposed of.


That's the thing, like I've said, I do dispose of every single string, I used CSE, and searched out string_var, and ensured it.. (Twice.)
User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am

Post » Tue May 03, 2011 1:19 am

That's the thing, like I've said, I do dispose of every single string, I used CSE, and searched out string_var, and ensured it.. (Twice.)

Hmm, the .obse file disagrees. Please provide a link to the .esp if you want me to take a look at it.
User avatar
Soraya Davy
 
Posts: 3377
Joined: Sat Aug 05, 2006 10:53 pm

Post » Mon May 02, 2011 7:04 pm

Hmm, the .obse file disagrees. Please provide a link to the .esp if you want me to take a look at it.


Have at it.

http://rapidshare.com/files/451739318/Advanced_Magecraft.esp

---

Btw, that's probably not going to run, if you need a working versions, let me know, that requires some assets, XML's, etc,..

And thanks for looking into this for me. :)
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Tue May 03, 2011 4:02 am

Have at it.
I took a quick look and I may have found the problem. You are setting/creating the string_vars in one frame. And you are destroying them in the next one. But function scripts do not retain their variables in between calls. So you are actually destroying nothing.

So in this script you'll need to move the sv_Destruct to the same block as where you create them
scn guiCloneref Itemstring_var IconPathstring_var ItemNamelong ItemValuefloat Quantityshort ButtonBegin Function { Item }	if (aaaMenuQST.SubMenu == 1)			Let ItemName := GetName Item		Let IconPath := Call zzzGetIconPath Item		Set ItemValue to (GetFullGoldValue Item)						Set Button to GetGenericButtonPressed		ShowGenericMenu "AdvancedMagecraft\QuantityMenu.xml"					  				SetMenuStringValue "user0|Cloning Menu" 1011		SetMenuStringValue "user1|%z" IconPath 1011		SetMenuStringValue "user2|%z" ItemName 1011		SetMenuStringValue "user3|%0.f" ItemValue 1011		; Minimum Quantity			SetMenuFloatValue "form_background\quantity_scroll\user1" 1011 1		; Maximum Quantity		SetMenuFloatValue "form_background\quantity_scroll\user2" 1011 1000		Set aaaMenuQST.SubMenu to 2		;these string_vars are no longer needed		sv_Destruct IconPath ItemName	elseif (aaaMenuQST.SubMenu == 2)		Set Button to GetGenericButtonPressed			; Yes		if (Button == 11)			Set Quantity to GetMenuFloatValue "form_background\quantity_scroll\user7" 1011			Call aaaClone Item Quantity			Set aaaMenuQST.SubMenu to 0			Return		endif		; No		if (Button == 22)			Message "Cloning Canceled!"			Set aaaMenuQST.SubMenu to 0			Return		endif	endifEnd

User avatar
CORY
 
Posts: 3335
Joined: Sat Oct 13, 2007 9:54 pm

Post » Mon May 02, 2011 8:25 pm

I took a quick look and I may have found the problem. You are setting/creating the string_vars in one frame. And you are destroying them in the next one. But function scripts do not retain their variables in between calls. So you are actually destroying nothing.

So in this script you'll need to move the sv_Destruct to the same block as where you create them

snip..


That seems like a flaw in OBSE to me, if that is the case.

If these are persisting refs, I should be able to delete them somehow, regardless, and that's what sv_Destruct claims to do. ?

---

Edit:

Actually, re-reading this, I kinda get why that may be the case... Still, it seems weird to me doing things like this, I'm used to local vars being disposed at the end of the function... (And only surviving if returned..)

(Edit2: Thanks, yet again, Kyoma...Seriously, a whole book, all about you in my credits, you've been infinitely helpful.. :))
User avatar
Tyler F
 
Posts: 3420
Joined: Mon Aug 27, 2007 8:07 pm

Post » Mon May 02, 2011 10:48 pm

(And only surviving if returned..)
This is not the entire truth. What's also important to know that a string_var does not equal a string. A user function returns a string, not a string_var (if one is used then its content is returned). Kinda complicated I know, reason is that string_vars were introduced a long time ago before all these new fancy enhancements.
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Mon May 02, 2011 8:05 pm

This is not the entire truth. What's also important to know that a string_var does not equal a string. A user function returns a string, not a string_var (if one is used then its content is returned). Kinda complicated I know, reason is that string_vars were introduced a long time ago before all these new fancy enhancements.


I would love to see a local_string or something, so I don't have to worry about them.. (I don't have anything that requires strings to stick around..)
User avatar
des lynam
 
Posts: 3444
Joined: Thu Jul 19, 2007 4:07 pm

Post » Mon May 02, 2011 10:08 pm

This is not the entire truth. What's also important to know that a string_var does not equal a string. A user function returns a string, not a string_var (if one is used then its content is returned). Kinda complicated I know, reason is that string_vars were introduced a long time ago before all these new fancy enhancements.

^ Yeah this. Function scripts release their array_vars automatically when they return; ideally they would do the same for string_vars but this would break in a situation like:
scn someQuestScriptstring_var strbegin gamemode  set str to "some string"  call SomeFunction  print str ; uh-ohendscn SomeFunctionstring_var varbegin Function {  }  set var to someQuest.str  ; do stuffend

var and str share a single string ID. If SomeFunction automatically destroyed var before returning, str would refer to a destroyed string when it returned. So in the interest of backwards-compatibility, you have to do it manually.
User avatar
Lucky Girl
 
Posts: 3486
Joined: Wed Jun 06, 2007 4:14 pm

Post » Tue May 03, 2011 6:32 am

^ Yeah this. Function scripts release their array_vars automatically when they return; ideally they would do the same for string_vars but this would break in a situation like:
scn someQuestScriptstring_var strbegin gamemode  set str to "some string"  call SomeFunction  print str ; uh-ohendscn SomeFunctionstring_var varbegin Function {  }  set var to someQuest.str  ; do stuffend

var and str share a single string ID. If SomeFunction automatically destroyed var before returning, str would refer to a destroyed string when it returned. So in the interest of backwards-compatibility, you have to do it manually.


I see, are there any plans for a new string type that behaves more like strings in other languages?

Or even better, true local support?

Begin Function {}
string Test := "Some text"
; Do something with the string here..
End
User avatar
Kayla Keizer
 
Posts: 3357
Joined: Tue Dec 12, 2006 4:31 pm

Post » Mon May 02, 2011 9:51 pm

I see, are there any plans for a new string type that behaves more like strings in other languages?

Nope, not really. I can possibly allow you to flag a function to specify that its string_vars should be automatically destroyed - in almost all cases this is what you'd want anyway.
For the time being I would simply structure your functions like:
scn Fnstring_var str1string_var str2...etcbegin function { ... }  ; do stuff  if whatever    do other stuff  else    stuff more stuff  endif  sv_destruct str1 str2 ...end

Sticking the sv_destruct at the end of the function block and avoiding return statements will guarantee correct cleanup regardless of how the function script is modified down the road.
EDIT@EDIT: Definitely not going to see block-level variable scope.
User avatar
Marcin Tomkow
 
Posts: 3399
Joined: Sun Aug 05, 2007 12:31 pm

Post » Tue May 03, 2011 6:58 am

Nope, not really. I can possibly allow you to flag a function to specify that its string_vars should be automatically destroyed - in almost all cases this is what you'd want anyway.
For the time being I would simply structure your functions like:
scn Fnstring_var str1string_var str2...etcbegin function { ... }  ; do stuff  if whatever    do other stuff  else    stuff more stuff  endif  sv_destruct str1 str2 ...end

Sticking the sv_destruct at the end of the function block and avoiding return statements will guarantee correct cleanup regardless of how the function script is modified down the road.


Can you clarify the return bit?

Edit: Oh, and a flag would be nice. :) (Though, thinking about it, not sure how that would work, and how it would compare to just doing it myself, though, in cases with tons of strings, it would be invaluable..)
User avatar
Rachael
 
Posts: 3412
Joined: Sat Feb 17, 2007 2:10 pm

Post » Tue May 03, 2011 10:28 am

Can you clarify the return bit?

If you call return -> end of script not reached -> sv_destruct not called -> co-save expodes.
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

PreviousNext

Return to IV - Oblivion