Gold Value Function for Containers

Post » Wed Dec 07, 2011 9:12 pm

Hi everyone.

Basically what I need is a script or script function that will calculate the gold value of an item/items (the former would be easier) in a container. I've looked through the wiki and found the GetGoldValue OBSE function, but I'm not sure how to get it to run on the contents of a container. Or is this the wrong function completely? Any help or advice would be greatly appreciated.

Thanks in advance :)
User avatar
Kirsty Collins
 
Posts: 3441
Joined: Tue Sep 19, 2006 11:54 pm

Post » Wed Dec 07, 2011 9:05 pm

Hi everyone.

Basically what I need is a script or script function that will calculate the gold value of an item/items (the former would be easier) in a container. I've looked through the wiki and found the GetGoldValue OBSE function, but I'm not sure how to get it to run on the contents of a container. Or is this the wrong function completely? Any help or advice would be greatly appreciated.

GetFullGoldValue is probably the function you want to use. GetGoldValue returns the value disregarding any value added by enchantments, while GetFullGoldValue returns the base value + the enchantment value.

To use it on an item in a container, you must remember that items in containers are base objects, not references, so you must use "GetFullGoldValue item", not "item.GetFullGoldValue".
User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Thu Dec 08, 2011 1:37 am

Great, thanks, will give it a try, as soon as I get my CS working again :P It's decided it doesn't like OBSE anymore...

Much appreciated :)

EDIT: Okay, I can't seem to get through to the OBSE guys, so can anyone here perhaps help me with this crash? The CS crashes on loading with obse_loader -editor, here is the problem signature from the crash:

Specs: CPU: Core i5 660 3.33GHzRAM: 12GB DDR3-1333GPU: Gigabyte GeForce GT 240 1GBM/B: Gigabyte GA-H67-UD2HWindows 7 Ultimate 64-bit


Problem signature:  Problem Event Name:    BEX  Application Name:    TESConstructionSet.exe  Application Version:    1.2.0.404  Application Timestamp:    461430cf  Fault Module Name:    obse_editor_1_2.dll  Fault Module Version:    0.0.20.6  Fault Module Timestamp:    4d9f0f89  Exception Offset:    000154f6  Exception Code:    c000000d  Exception Data:    00000000  OS Version:    6.1.7601.2.1.0.256.1  Locale ID:    7177  Additional Information 1:    b54a  Additional Information 2:    b54a90fa0d93f2f9399d5d1fc1c6f49e  Additional Information 3:    1851  Additional Information 4:    1851a751d4ce17174c8d505756de012c

User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Thu Dec 08, 2011 7:04 am

Oh, and to answer your sig: You'd say me and my body, since "me" (your sense of self) is an aspect of your personality, and therefore originates in the brain (according to contemporary psychology and neuroscience).
User avatar
Kortniie Dumont
 
Posts: 3428
Joined: Wed Jan 10, 2007 7:50 pm

Post » Thu Dec 08, 2011 2:14 am

[DELETED] Sorry, double post.
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Thu Dec 08, 2011 5:05 am

Try reinstalling OBSE.
User avatar
Matt Bee
 
Posts: 3441
Joined: Tue Jul 10, 2007 5:32 am

Post » Thu Dec 08, 2011 3:47 am

Okay, thanks, figured it out, was a rogue plugin in the Data/obse folder... All working now :)

But to return to my original question - I've got the function now, but how do I run it on the items in the container? What do I use as the reference of all the objects currently in the container?
User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Wed Dec 07, 2011 11:12 pm

Okay, thanks, figured it out, was a rogue plugin in the Data/obse folder... All working now :)

But to return to my original question - I've got the function now, but how do I run it on the items in the container? What do I use as the reference of all the objects currently in the container?

Is something like this what you're looking for? This iterates through all items in a container and tell you their name, number and price:
ref containerref itemshort ishort countlong price...; at this point, container should be a valid container/actor referencelet i := 0 While i < container.GetNumItems	let item := container.GetInventoryObject i	let count := container.GetItemCount item	let price := GetFullGoldValue item	PrintC "%n contains %.0f %n with value %.0f", container, count, item, price		let i += 1Loop

User avatar
Alex [AK]
 
Posts: 3436
Joined: Fri Jun 15, 2007 10:01 pm

Post » Thu Dec 08, 2011 12:00 am

Ahh, that's great, exactly what I need :) Thank you very much!
User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am


Return to IV - Oblivion