Replies: 18 (Who?), Viewed: 4353 times.
Field Researcher
Original Poster
#1 Old 9th Dec 2006 at 9:33 AM
Default How to use Manage Inventory
- opcode = 0x33; operands = access, id, action, guid, category, index, count

- access (int8): This combines the storage, type, visibility, and subtype into one collection of bits. Simply add the values together to achieve the access mode you want.

storage: global = 0, lot = 1, family = 2, neighbor = 3 (This identifies which inventory to use.)
type: singular = 0, counted = 4 (Singular = use a unique item, Counted = use one of any number of items in this inventory.)
visibility: hidden = 0, visible = 8
subtype: non-memory = 0, memory = 0x10

- id (int24): This identifies the general part of the inventory desired by object or neighbor ID used (data owner, data value).

- action (int8): This is the action performed. Its value depends on whether the access type is singular or counted. Note that specific actions use index and/or count.

Singular actions:

Add token = 0
Remove token at = 1 (index)
Remove at tokens = 2
Set To Next = 3 (index)
Push Property at = 4 (index, count)
Pop Property at = 5 (index, count)
Read to Temp at = 6 (index)
Get Property from Temp at = 7 (index, count)
Store Temp = 9 (store back to wherever it was loaded from)
Store Count = 0x0A (count)
Set To Next using visibility & subtype = 0x0C (index)
Store Count using visibility & subtype = 0x0D (count)

Counted actions:

Add token = 0 (count)
Add to token at = 1 (index, count)
Remove token = 2 (count)
Remove to token at = 3 (index, count)
Remove all tokens = 4
Remove all tokens at = 5 (index)
Find token = 6 (count)
Read token = 7 (into Temp Token)
Read token at = 8 (into Temp Token, index)
Set To Next = 9 (index)
Store count = 0x0A (count)

- guid (int32): This identifies the specific part of the inventory desired. If the guid = 0, the stack object is used for the guid.

- category (int8): This varies from 0 to 12 and appears to refine identification of specific items in the inventory.

- index (int24): Specifies the point in the inventory or property stack (starting at 0) to use (data owner, data value).

- count (int24): The token count or property value, depending on the action (data owner, data value).

---

The above was posted to the Variousimmers Forum (September 4th, 2005)

Some of this information presented has changed since OfB, so it may be a good idea to start thinking about using Lua for tokens.
Advertisement
Don't ask me, I just code
#2 Old 14th Feb 2007 at 8:18 PM Last edited by pljones : 14th Feb 2007 at 8:27 PM.
Can anyone clarify the following for me, please (from in-game testing if possible):

GUID-based actions (e.g. Add token) - do these pay any attention to the visible / memory / shopping bits? Or are these taken from the object defined by the GUID somehow?

Set To Next Token - does this search by GUID (not mentioned above, dizzy)? We're pretty sure it does from one of Inge's objects but does that then mean it always searches for a specific GUID (or the stack object)? If not, how do you choose to use the GUID or not?
Lab Assistant
#3 Old 14th Feb 2007 at 8:40 PM Last edited by linolino : 14th Feb 2007 at 10:07 PM.
pljones, i have tested the "Set To Next Token" on objects i'm making and i only managed to make it work after i put the GUID of the token i was looking for.

Strangely, every reference i find about it, just don't mention this. I've told this to Inge and Peter, since they are developing a PJSE wizard for the Manage Inventory.

However, maybe it works withou GUID too.

If you do especify a GUID it will look for that GUID. But maybe, if you don't, it will just look for the next token available.
One horse disagreer of the Apocalypse
#4 Old 14th Feb 2007 at 8:49 PM
pljones is Peter. He's posting here in the hopes of getting other opinions I think you're right about the GUID though.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#5 Old 14th Feb 2007 at 10:04 PM Last edited by linolino : 14th Feb 2007 at 10:18 PM.
OOOHH hahahaha...
thats redundant then! i just told peter i sent a message to peter...
duh!
well even though i tested these, i havent told you how. So...
About the "add token" command:
I added a token with the guid from a gnome (as i tested) with the visible flag turned on, and a gnome was succefully added to my sims inventory and i could see it and drag it out with the mouse.
If I turn off the "visible" bit, a gnome was still added to my sim inventory, since the game returned true to a "find token command", however I couldn't see it in the sims's backpack.

It would be good if someone could also test this. I made a little test object when i tested this stuff. if someone is interested in checking its codes, i'll attach it here later!
Field Researcher
#6 Old 15th Feb 2007 at 5:17 AM
In my experience, the GUID based actions do take into account the inventory type and the set to next token will only work with a GUID (using the GUID of the stack object if no guid is given in the operands). This makes sense since the tokens are stored by GUID in the inventory. There isn't any other way to find them.

Also to add to dizzy's list, in the Singular Actions, the missing opcode 8 is to Store Property to Temp at = 8 (index, count). This is used to update a token property once loaded into the temp token. Then use opcode 9 to store it back to inventory.

My mods for The Sims 2 can now be downloaded from this site.
Don't ask me, I just code
#7 Old 15th Feb 2007 at 6:53 PM
Thanks both. I'll update the parsing code and the wizard to match.
Don't ask me, I just code
#8 Old 17th Feb 2007 at 1:48 PM
More info required on Singular 0x07 and 0x08, please.

For the singular inventory, "count" doesn't really make sense. It usually means "property number", I think, going by the other opcodes.

Does it have the same meaning in 0x07 and 0x08?

If I understand correctly, "index" usually identifies a token within an inventory. Here we're dealing with My Temp Token. So what does "index" actually mean?

I'm going to guess they work like operations 0x0e and 0x0f.
Don't ask me, I just code
#9 Old 17th Feb 2007 at 4:06 PM
Oh yes - here are more Singular Inventory ops AFAIK them:
0E : Get (on token still in inventory)
0F : Set Property (on token still in inventory)
10 : Add Token And Instance Info of Stack Object (include contained objects)
11 : Create Object from Token
12 : Copy token
13 : Add Token And Instance Info of Stack Object (exclude contained objects)
Quote:
(September 4th, 2005)
Given the age of the info, I'll leave the "Counted" actions alone until someone comes up with something better than what's currently in place.
Retired Duck
retired moderator
#10 Old 17th Feb 2007 at 11:32 PM
For singular tokens, the count returns the number of singular tokens in the specified inventory, so it's definitely still a count. You've probably already got it somewhere, but if not, I've temporarily attached the "Manage Inventory" section of the sims2differences doc.
Download - please read all instructions before downloading any files!
File Type: zip differences-inventory.zip (5.8 KB, 49 downloads) - View custom content
Don't ask me, I just code
#11 Old 18th Feb 2007 at 8:46 AM
Quote:
Originally Posted by Echo
For singular tokens, the count returns the number of singular tokens in the specified inventory
For operations 0x07 and 0x08? I'm confused. Those ops don't appear to be trying to count anything..?
Don't ask me, I just code
#12 Old 18th Feb 2007 at 8:51 AM
Quote:
Originally Posted by Echo
I've temporarily attached the "Manage Inventory" section of the sims2differences doc.

Thanks.

I'll have to go back and fix stuff again now .

The doc doesn't cover changes made for Node Versions 1 and 2 (the latter being Open For Business).
Don't ask me, I just code
#13 Old 18th Feb 2007 at 1:49 PM
For the purposes of parsing and the Wizard, I've assumed that a specific token is identified by

the Inventory it's in (counted/instance; Global, Lot, etc.)

AND EITHER
1) The index into the inventory
OR
2) A GUID and Category

I've also updated PJSE to use the operation names from the sims2differences doc (more or less).

There may be a test version available shortly...
Field Researcher
Original Poster
#14 Old 20th Feb 2007 at 1:53 AM
It's a big nasty mess.

Any chance of seeing that SVN (or updated CVS) any time soon?
One horse disagreer of the Apocalypse
#15 Old 20th Feb 2007 at 9:30 AM
I can let you have the source in a zip file? The CVS is at the Sourceforge address I gave you before - that's where he always updates.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
One horse disagreer of the Apocalypse
#16 Old 20th Feb 2007 at 9:44 AM
Anyway here is the link http://www.simlogical.com/PJSE/PJSE...070218-1342.zip to the version with the wizard fixed as above, if anyone would be so good as to test it.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Don't ask me, I just code
#17 Old 22nd Feb 2007 at 5:45 PM
Yes, CVS gets updated pretty much as I get a compilable version . HEAD only gets updated once a version has shipped, though (as I wait to see it on the website before doing all my CVS tagging and so on). There's PreRelease and branches off that sometimes, too.
One horse disagreer of the Apocalypse
#18 Old 22nd Feb 2007 at 6:06 PM
Well did anyone take this for a test run yet? If it doesn't get tested, then it goes out live with bugs in

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#19 Old 22nd Feb 2007 at 7:47 PM Last edited by linolino : 22nd Feb 2007 at 7:53 PM.
Hi people. I've been pretty busy these days and out of town, and missed the updates on this forum. Inge, I haven't been able yet to fully test the new features in the game, only on the SimPE itself, but it seems like everything I pointed out was fixed in the 20-Feb-2007 01:39 338k version.
I should be able to test it in the game by friday though.

Oh by the way, i found something out in the animate sim wizards that i should show you. I'll send a screenshot later.
Back to top