[BETA] Oblivion Script Extender (OBSE) 0020

Post » Tue May 03, 2011 1:36 am

Just wanted to mention, that sporadic inventory issue happened again. (Using the code suggested by GuruSR..)

A thought, create a token (clothing), uncheck all of it's slots (so it's not equipped to anywhere). Set it Quest item and make sure it is not playable. Add the item before the While loop, after the loop, equip it and remove it. I've seen the menu update after an equip/unequip. Maybe that'll help things out. Or look for an item thats equipped, then silently unequip it before the while and silently re-equip it after. The downside with that is, it could be a quest item that could cause a quest to break, but perhaps using the tail slot and getting it's item (if one), equipping a hidden item you make onto the tail, before the while, then put back (or just unequip) the token, then remove it. That should update your inventory. To make it nicer, use the Silent version of Add, Equip and Remove.

GuruSR.
User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Tue May 03, 2011 10:20 am

A thought, create a token (clothing), uncheck all of it's slots (so it's not equipped to anywhere). Set it Quest item and make sure it is not playable. Add the item before the While loop, after the loop, equip it and remove it. I've seen the menu update after an equip/unequip. Maybe that'll help things out. Or look for an item thats equipped, then silently unequip it before the while and silently re-equip it after. The downside with that is, it could be a quest item that could cause a quest to break, but perhaps using the tail slot and getting it's item (if one), equipping a hidden item you make onto the tail, before the while, then put back (or just unequip) the token, then remove it. That should update your inventory. To make it nicer, use the Silent version of Add, Equip and Remove.

GuruSR.


Perhaps, but this indicates a serious flaw in the menu code, I hope the OBSE team can simply refresh it from the actual array of items...

I'll give that a whirl though, see if it can do the same without all the bad side effects..

Thanks. :)
User avatar
RObert loVes MOmmy
 
Posts: 3432
Joined: Fri Dec 08, 2006 10:12 am

Post » Tue May 03, 2011 7:11 am

Perhaps, but this indicates a serious flaw in the menu code, I hope the OBSE team can simply refresh it from the actual array of items...

I'll give that a whirl though, see if it can do the same without all the bad side effects..

Actually, the only way I've seen the inventory update is when something is equipped/unequipped. Because it has to update the markers in the list, this isn't an OBSE issue, but more a method to limit the work needed to update the inventory list (doing it repeatedly would use more cpu time, so they had to come up with a method to limit it). Adding an item won't necessarily affect the list because I have mods that do that as well, and they don't update while the menu is open. Now say you have two swords of the same thing, equipping one will force the list to update (because it has to switch to the new weapon and mark it as being equipped and separate the non-equipped one in the list). The tail slot idea is probably the best bet, because equipping it to the slot and putting back the existing one (or unequipping it).

ref Item...before while:set Item to Player.GetEquippedObject 15Player.AddItemNS "mytail object set Quest and not playable." 1Player.EquipItemSilent "my tail object"while loop hereif Item  Player.EquipItemSilent Itemelse  Player.UnEquipItemSilent "my tail object"endifPlayer.RemoveItemNS "my tail object"


That should work for what you want. The inventory will have to refresh when you equip your tail item to rechain the list so that restacking can occur, now whether or not it will do so for the entire inventory (think so), I don't know for sure, as I'm not sure if the inventory is separated by type, but I kind of doubt it is (as it'd be cumbersome to work with).

Give that a try.

GuruSR.
User avatar
JD bernal
 
Posts: 3450
Joined: Sun Sep 02, 2007 8:10 am

Post » Tue May 03, 2011 10:23 am

Actually, the only way I've seen the inventory update is when something is equipped/unequipped. Because it has to update the markers in the list, this isn't an OBSE issue, but more a method to limit the work needed to update the inventory list (doing it repeatedly would use more cpu time, so they had to come up with a method to limit it). Adding an item won't necessarily affect the list because I have mods that do that as well, and they don't update while the menu is open. Now say you have two swords of the same thing, equipping one will force the list to update (because it has to switch to the new weapon and mark it as being equipped and separate the non-equipped one in the list). The tail slot idea is probably the best bet, because equipping it to the slot and putting back the existing one (or unequipping it).

ref Item...before while:set Item to Player.GetEquippedObject 15Player.AddItemNS "mytail object set Quest and not playable." 1Player.EquipItemSilent "my tail object"while loop hereif Item  Player.EquipItemSilent Itemelse  Player.UnEquipItemSilent "my tail object"endifPlayer.RemoveItemNS "my tail object"


That should work for what you want. The inventory will have to refresh when you equip your tail item to rechain the list so that restacking can occur, now whether or not it will do so for the entire inventory (think so), I don't know for sure, as I'm not sure if the inventory is separated by type, but I kind of doubt it is (as it'd be cumbersome to work with).

Give that a try.

GuruSR.


I wasn't accusing OBSE of being responsible, I'm saying, the menu isn't updating, they can force it to update from the underlying array every time it opens, bypassing Beths code.. (And hopefully squashing this bug..)

Anyways, thanks, I'll give this a try, it looks fairly easy to implement.. :)

-----

Nope, it didn't work..

-----

I just want to add, my mod has had a recycle function for years now, and I've never seen this issue before, and trust me, I've done exactly what you see in the video a thousand times with this mod in the past. Something is going on... Whether something quirky in my new code is causing it, whether the new OBSE has issues, whether it's MenuQue, I can't say for sure, but something is causing it to act up, in a way I've never experienced..

This is the unreleased version seen in the video.. (It requires MenuQue v9)
http://rapidshare.com/files/451907376/Advanced_Magecraft.rar

Anyone is welcome to try this, and see if they can reproduce the behavior.. Aside from the buttons being too small, and this issue, and a few readme updates it needs, it's ready for release.. (ie, it's very stable, and everything works but what you see above..)

Also note, that if you had a "single" item of the types in the video, it also works fine.. (ie, 1 Daedric Dagger, recycles fine..)

It also works fine for almost every other object in the game..
User avatar
NIloufar Emporio
 
Posts: 3366
Joined: Tue Dec 19, 2006 6:18 pm

Post » Mon May 02, 2011 8:29 pm

Look at HudStatusBars, I believe it's reading strings from the .ini, and using only OBSE.. (I could be mistaken, but that's what it looked like anyways.. I remember seeing sv_Construct used quite a bit in the .ini file...)

ie,..

Set aaaSomeQST.StringVar to sv_Construct "Some text.."

Thanks, Claviticus. I'm totally surprised since 'Let' didn't work, but this construct does. Looks a little awkward for the mod user though.

My thanks also to QQuix and Andalaybay for their solutions, but first I will try with OBSE only. Maybe I come back.
User avatar
Zualett
 
Posts: 3567
Joined: Mon Aug 20, 2007 6:36 pm

Post » Tue May 03, 2011 12:24 am

Thanks, Claviticus. I'm totally surprised since 'Let' didn't work, but this construct does. Looks a little awkward for the mod user though.

My thanks also to QQuix and Andalaybay for their solutions, but first I will try with OBSE only. Maybe I come back.


No problem, glad to help. :)

And happy modding. :D
User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm

Post » Mon May 02, 2011 10:41 pm

It looks good to me, though I would rewrite
if eval ! ( $(NewName) == "" )
to
if eval NewName != "" 
as I find the second quite a bit simpler to read

Alternatively, this section
	if (NewName)	 ; variable contains something                if eval ! ( $(NewName) == "" )
can be shortended to
	if eval (sv_Length NewName) > 0	; variable contains at least one character

Yeah, I haven't worked with strings very much and didn't want to take the time to scan the docs or test anything as I was writing that snippet; so I played it safe and assumed that anything that I wasn't 100% sure of would catastrophically fail and embarrass me. ;)
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Tue May 03, 2011 9:34 am

@Tejon, yeah, that's never fun.. :)

So, has anybody looked into that inventory issue I was having yet? It's kind of a major issue, so I'm holding back a release because of it... I have a few things to keep me busy, but, I really want to get that figured out before I make another release, ie, if it is an issue in my mod, I want to fix it first... (Mainly so my next release is really stable, and can hold the users for awhile, to give me time to implement a bunch of other stuff..)

(Alternatively, if my mod looks innocent, I want to be able to tell the users, hey, there is an issue, but it's not with my mod, etc,..)
User avatar
biiibi
 
Posts: 3384
Joined: Sun Apr 08, 2007 4:39 am

Post » Tue May 03, 2011 9:36 am

Nope, either I'm missing something obvious, or this function is not working properly.. (It return various values based on the input it's given, however none of it's returns are as expected, under any scenario..)

-1, 0, and 1 are normal return values.
if sv_compare str1 str2  ; the strings are not equalif sv_compare str1 str2 == 0  ; the strings are equal

-2 is returned only if the command can't perform the comparison, for instance because you passed in an uninitialized string variable.
So, has anybody looked into that inventory issue I was having yet?

Thank you for the detailed info & link. I will be looking into it shortly.
User avatar
le GraiN
 
Posts: 3436
Joined: Thu Mar 22, 2007 6:48 pm

Post » Tue May 03, 2011 12:22 am

-1, 0, and 1 are normal return values.
if sv_compare str1 str2  ; the strings are not equalif sv_compare str1 str2 == 0  ; the strings are equal

-2 is returned only if the command can't perform the comparison, for instance because you passed in an uninitialized string variable.

Thank you for the detailed info & link. I will be looking into it shortly.


Thank you very much Scruggsy, I appreciate it. :)
User avatar
R.I.p MOmmy
 
Posts: 3463
Joined: Wed Sep 06, 2006 8:40 pm

Post » Tue May 03, 2011 8:24 am

So, has anybody looked into that inventory issue I was having yet?


I believe that it is a bug with RemoveItem that's http://cs.gamesas.com/constwiki/index.php/Common_Bugs#Remove_Item_and_Selling_Stackable_Items_with_Extra_Data. In the video you posted, all the items were damaged and that's what caused the bug. Also see http://cs.gamesas.com/constwiki/index.php/Talk:RemoveItem for other related information. I'm not sure what you can do to fix it, however.

Edit: added more information.
User avatar
Lakyn Ellery
 
Posts: 3447
Joined: Sat Jan 27, 2007 1:02 pm

Post » Tue May 03, 2011 1:58 am

I believe that it is a bug with RemoveItem that's http://cs.gamesas.com/constwiki/index.php/Common_Bugs#Remove_Item_and_Selling_Stackable_Items_with_Extra_Data. In the video you posted, all the items were damaged and that's what caused the bug. Also see http://cs.gamesas.com/constwiki/index.php/Talk:RemoveItem for other related information. I'm not sure what you can do to fix it, however.

Edit: added more information.


Yeah, it certainly looks the same, as for what can be done, a whole lot..

I'm an amateur when it comes to hooking, and .exe manipulation, however, I know enough to understand you can do anything you want, given the knowledge, and time.

This should be an easy fix for Scruggsy.

You could always add..

RemoveItemEx
RemoveItemExNS

If you are worried about backwards compatibility with mods that are already accounting for this bug.

Anyways, I'll let the professionals worry about the hows, I'm just talking.. :)

===

Edit: I went ahead and released the new version of my mod, I wanted to wait, but that savegame bloating issue was bothering me, those strings pile up fast, so, yeah..
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Tue May 03, 2011 7:36 am

Feature request..

I need a version of equip items that also hides the enchanted item equip effects as well as the sound, spam, etc,.

And, a version of RemoveAllItems which takes an array, so I can remove specified items to a container(and back of course). (Unless there is a way to do this already..?)

I need these for a fix to the inventory bug I'm working on..

---

Edit: Hey Scruggsy, something interesting came up while testing this inventory bug fix, my script uses MenuQue's OnOpen event to fire, but ever since I started using it, Duskfang\Dawnfang unequip themselves when they transform(or fail to re-equip..), not sure what to make of it, but it may be worth noting.. (It's possibly causing a menu update somehow, I know I'm curious as to why this item is acting this way.. Because, technically, my script shouldn't be running, because the inventory menu wasn't open.)

The only thought I have, is I forgot about the ownership flag(RemoveAllItems), so that might have somehow caused the sword to act up.. ?
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Tue May 03, 2011 10:13 am

I have another request.

Could you make a function which allowes to change the race of an npc. I mean something like an opposite for the function GetRace.
User avatar
Queen
 
Posts: 3480
Joined: Fri Dec 29, 2006 1:00 pm

Post » Tue May 03, 2011 3:02 am

Minor Bug with Call, the unbox character * and ->:
I have an Array with several StringMap-Arrays which have (inter allia) UserFunctions stored inside.
If I use ForEach with the array I have to use Call iterator -> "Value" -> "" instead of just Call ( *iterator ) -> ""

Error Message by the CS:
Expected User Function.
Could not parse this line.

Using the -> "Value" variant works fine.


Oh, and influencing sSkillName* with SetStringGameSettingEx doesn't update the name of the Skill in the menu.
I have to use SetMenuStringValue "stat_layout\stat_background\stat_p3\stat_p3_window\stat_p3_window_pane\\stat_item_label\string|"
Not sure if this is intentional.
User avatar
Jessica Colville
 
Posts: 3349
Joined: Wed Oct 18, 2006 6:53 pm

Post » Tue May 03, 2011 4:16 am

Oh, and influencing sSkillName* with SetStringGameSettingEx doesn't update the name of the Skill in the menu.
I have to use SetMenuStringValue "stat_layout\stat_background\stat_p3\stat_p3_window\stat_p3_window_pane\\stat_item_label\string|"
Not sure if this is intentional.
Not intentional, the skill list in the stats menu only gets built once. After that it gets updated without being reconstructed.
User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Tue May 03, 2011 7:10 am

Ah, ok.
Well, since I got it working someway I think I can live with that. :)
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm

Post » Mon May 02, 2011 8:38 pm

Feature request..

I need a version of equip items that also hides the enchanted item equip effects as well as the sound, spam, etc,.

Make the item Quest Item and uncheck Playable, it won't show up in the inventory.

GuruSR.
User avatar
GabiiE Liiziiouz
 
Posts: 3360
Joined: Mon Jan 22, 2007 3:20 am

Post » Mon May 02, 2011 11:13 pm

Make the item Quest Item and uncheck Playable, it won't show up in the inventory.

GuruSR.


The problem with that, is the new solution I'm using, is calling RemoveAllItems, to move their entire inventory to a chest, (much like i used in the video..), so this won't be possible..

I can't make any other method trigger the inventory to update..
User avatar
Taylah Illies
 
Posts: 3369
Joined: Fri Feb 09, 2007 7:13 am

Post » Mon May 02, 2011 11:48 pm

Um...hey I have been making all my tokens UN-playable but not necessarily always as quest items.

What is the advantage and disadvantages of marking them a quest item? Is it that other mods and scripts will then not remove them from the NPC and player?
I normally use a little defensive scripting to replace the token if for any reason it is removed form the player/actors anyway. But if marking it a quest item will guarantee it is not removed then that would seem a more practical way to do it right?


Make the item Quest Item and uncheck Playable, it won't show up in the inventory.

GuruSR.

User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Tue May 03, 2011 8:18 am

Um...hey I have been making all my tokens UN-playable but not necessarily always as quest items.

What is the advantage and disadvantages of marking them a quest item? Is it that other mods and scripts will then not remove them from the NPC and player?
I normally use a little defensive scripting to replace the token if for any reason it is removed form the player/actors anyway. But if marking it a quest item will guarantee it is not removed then that would seem a more practical way to do it right?


I can answer one question, my Inventory Bug Fix, seemingly has no issues removing quest items... (For example SM, is using some kind of quest item for it's magical torch spell, and my mod eats the token, causing the spell to fizzle.. Or something, because RemoveAllItems, dispels the spell.. I'll fire it up in the CS, see what he uses...)

Aside from that, I tested it against quest items in the TestingHall, and it removed those too..

See: Optional Files
http://www.tesnexus.com/downloads/file.php?id=15587

-----

Edit: Ok, seems he just adds an actual light object to the player....

That's why I need a selective RemoveItems, so I can only remove items I want, and not risk causing all these issues.. (Add\RemoveItem won't work, only RemoveAllItems, since it physically moves the items from one container to another.. The others, just modify the list, which isn't being properly updated by the game, so it's self defeating to use the bugged functions to try to defeat the bug.. :))

Edit2: Sorry, I just woke up, my brains not fully functioning yet, so, yeah,..
User avatar
Chloe Lou
 
Posts: 3476
Joined: Sat Nov 04, 2006 2:08 am

Post » Tue May 03, 2011 9:37 am

I am now testing beta 20 (fun stuff!) :biggrin:

I hold a bow in my hands, tried with just a sword as well. in all case I get -1
Why would I get -1 for the GetBoundingRadius:

set Weapon to Player.GetEquippedObject 16if (weapon) set Weapon to Player.GetEquippedObject 16  set weapon to aadpCellaadphidcellwc.placeatme weapon     if isformvalid weapon == 1        set WeaponSize to weapon.GetBoundingRadius        messagebox"radius is %.2f"weaponsize     endifendif



hey! can I use "CreateTempRef weapon" ?
User avatar
Naughty not Nice
 
Posts: 3527
Joined: Sat Nov 04, 2006 6:14 am

Post » Mon May 02, 2011 8:57 pm

That's why I need a selective RemoveItems, so I can only remove items I want, and not risk causing all these issues..


Obse has http://obse.silverlock.org/obse_command_doc.html#Inventory_Reference that might be able to do what you want. Just pass the base item to GetInvRefsForItem to get references to stacks of items in your inventory. Then you can use RemoveMeIR to move the inventory references to a different container. I think the code should look similar to this:

ref invRefref containerRefarray_var arrarray_var iter...let arr := player.GetInvRefsForItem ItemForEach ( iter <- arr )	let invRef := iter["value"]	invRef.RemoveMeIR containerRefLoop

User avatar
Beth Belcher
 
Posts: 3393
Joined: Tue Jun 13, 2006 1:39 pm

Post » Tue May 03, 2011 5:14 am

Obse has http://obse.silverlock.org/obse_command_doc.html#Inventory_Reference that might be able to do what you want. Just pass the base item to GetInvRefsForItem to get references to stacks of items in your inventory. Then you can use RemoveMeIR to move the inventory references to a different container. I think the code should look similar to this:

ref invRefref containerRefarray_var arrarray_var iter...let arr := player.GetInvRefsForItem ItemForEach ( iter <- arr )	let invRef := iter["value"]	invRef.RemoveMeIR containerRefLoop



Yeah, I seen those in the docs, but, it seemed like that was for scripts attached to the container, which in this case is the player..

So will it work like that on the player? I don't know the docs confused me a bit, so I avoided those functions..

---

What, I'm saying, is I thought that was a GetSelf, workaround method for container scripts, or some such.. (Like, I said, the docs confused me, so I avoided em'..) :)
User avatar
Damien Mulvenna
 
Posts: 3498
Joined: Wed Jun 27, 2007 3:33 pm

Post » Tue May 03, 2011 11:00 am

...

Yeah, it should work like that on the player, it doesn't need to be attached to a container. I did a quick test and it seems like it works...
User avatar
Laura Wilson
 
Posts: 3445
Joined: Thu Oct 05, 2006 3:57 pm

PreviousNext

Return to IV - Oblivion