Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Pettifogging Legalist!
retired moderator
Original Poster
#1 Old 19th Aug 2015 at 10:30 PM
Default Tag enums in s4pe
So I PMed with two different people about this; I guess it's better to put the conversation into a forum thread instead:

Quote: Originally posted by plasticbox
I'm currently trying to fix the wacky EmotionTags display in OBJD, and when I tried to see how those fields work that have a dropdown, I came across the huge long enum in CASP that has the entirety of tags in the game listed as "CASPFlagValues". Most of these aren't supposed to be used in the context of CASP though (Func_Painting and stuff like that); is there a specific reason it's done like this? I mean with one big list instead of several small ones?

Asking because for those tags in the OBJD there are not even 20 possible values I believe -- having a dropdown in the grid view that only contains those, and not all of them, would make the dropdown a lot easier to use (and I guess that goes for CASP as well .. I hope I have the latest dll in this version).



Quote: Originally posted by CmarNYC
The reason is that's the way EA did it. The values should be filtered for the specific tags they apply to, and the tags themselves should be filtered for the item they're being applied to or like you said separated into smaller lists. I do that in CAS Tools. Unfortunately this situation hasn't come up before of EA dumping stuff that applies to CAS, objects, who knows what else, into one enum and s4pe isn't set up for it. I can see if I can find the code and do something about it - could be easy, could be very difficult. If you could give me a list of the tags that apply to objects, that would help.



Quote: Originally posted by plasticbox
Below is a list -- there is still some stuff in it that I'm not sure about, thought it was better to leave it in than remove it.

I believe the first two are probably from testing. I've never seen an "Optimism" mood in game.

--




Quote: Originally posted by CmarNYC
I'm looking at filtering the tags/values in s4pe - found the code that handles it at least. I also found it near impossible to change flag values for CASPs and TONEs in s4pe because of the sheer number of them.

[..]What I'll probably end up doing is making separate property lists for different uses: one for CASPs, one for objects, etc. and filter the master list of values from there. And then update when they add more in each patch. *sigh*



Quote: Originally posted by plasticbox
Hmm would there be a way to read those tags directly from the tag list? So that one doesn't need to update every time? Probably not I guess, since that's buried in the combined tuning resource .. but for a simpler updating procedure, maybe one could plunk just that one (extracted) XML resource into the s4pe folder and have it read everything from there? I don't know how you are sorting your lists in CASTools but if it goes by the prefix, it might be simpler to just feed it a new combined list with every patch and letting it do its thing, rather than having to add on to each of the small lists individually ..



Quote: Originally posted by CmarNYC
I had thought of a separate list for s4pe but not for Tools for some reason. Actually it ought to be possible to read it directly from the game combined tuning and I'll take a look at Scumbumbo's code at some point to see how hard it would be. I guess an updated enum list people could pop into their folders would be better than updating the dll. Or maybe a separate tool that pulls the list from the game files. I already have the code to take the XML and convert to enum format. Lots to think about!



Quote: Originally posted by plasticbox
Hm, a separate tool might also make it a bit complex .. I mean, anyone who does XML tuning will have the updated XML very soon after they patch, so hopefully someone would always be able to post that list (I mean the exported XML) somewhere for the non-tuning folks to download. And when Kuree gets around to release a new s4pe version, shouldn't be a problem to provide him with the current XML either that he can stick into the folder.



Coincidentially, @scumbumbo updated the extractor yesterday with a version that does read directly from the game files (as I understand it; I haven't used it yet) so that might be one less thing to worry about =)


Inge's version of CatalogCommon.cs also contains that tag list (which I promptly forgot to update -- didn't check but I'm quite sure it can't be current any more), separate from the abovementioned CASPFlagValues I mean, which taken together seems a bit redundant. The Catalog stuff in the current relase (0.3c) does not seem to have labelled tags at all.


Soooo, I dunno .. discuss?

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Advertisement
Deceased
#2 Old 20th Aug 2015 at 2:28 AM
As far as updating the tags goes it seems like the best way to go would be to just make it an XML file that users can update if and when they want to. Reading the binary tuning just for that would be pretty slow, and dependent on EA never changing how they store that again. The time to get that out could be cut down dramatically since you don't actually need to completely convert it to XML and write it back out to disk again. Maybe you could figure a way to get quickly at just what you need as well, which should load quite fast. Is it worth that kind of effort though?
One horse disagreer of the Apocalypse
#3 Old 20th Aug 2015 at 8:15 AM Last edited by Inge Jones : 20th Aug 2015 at 8:25 AM.
I was always asking Peter to have these things in xmls and he never got round to it.

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Deceased
#4 Old 23rd Aug 2015 at 12:14 AM
Quote: Originally posted by Inge Jones
I was always asking Peter to have these things in xmls and he never got round to it.

If someone's going to do some XML hacking on this, make it where I can add some custom folders to the Open File list. Bookmarking a package is okay, but being able to bookmark some folders would be immensely useful.

Is there an official thread or forum somewhere for this tool to make suggestions like this?
Screenshots
Pettifogging Legalist!
retired moderator
Original Poster
#5 Old 23rd Aug 2015 at 12:27 AM
I think this thread is a good place =). @Buzzler and I wanted to look into this tomorrow (well actually yesterday, but you know how it goes =P), I'll post if we get somewhere interesting! I have no idea how to do that bookmark thing but perhaps he does.

(The "official" forum might be the Issues department at github but there is not much activity over there .. https://github.com/Kuree/Sims4Tools/issues and I believe one needs to sell their soul make a github account to post, as well)

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
1978 gallons of pancake batter
#6 Old 23rd Aug 2015 at 8:05 PM
@scumbumbo, I'm not sure why you thought of bookmarks in the context of tags, but I can have a look at some point. pbox will probably remind me if I forget about it. *When* I forget about it, because I totally will.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Ms. Byte (Deceased)
#7 Old 23rd Aug 2015 at 11:22 PM
I've been thinking about this issue and maybe a separate wrapper/dll would be a good way to handle it, with all the resouces that use the tags referring to it. (So far CASP, TONE, and OBJD, maybe someone knows of more?) It could either read an external XML or be easy to update and drop into the s4pe folder, at least as a start. Also I want to look further into a selective dropdown for selecting tag values in the Grid, as soon as I get done with what I'm working on now.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
Pettifogging Legalist!
retired moderator
Original Poster
#8 Old 23rd Aug 2015 at 11:45 PM
We looked at it today (but not for very long since it was already late) and what it's doing right now is read an external XML that resides in the same folder as the rest -- personally I thought that would be easiest to update, particularly since users can also update themselves simply by plunking a current XML in there .. they don't need to go pester someone with coding skills to update for them, I mean. It's parsing that into a dictionary (reads all tags first, then splits them into groups by prefix) but right now isn't yet doing anything with that dictionary. That is all in a separate wrapper IIRC.

By "selective drodown" you mean the way it works in CASTools? Yeah that's the best way of dealing with these lists that I've seen so far .. that way the actual tags are less than five miles to scroll through and it also prevents nonsense tag/category combinations.

The tag lists are used all over the place -- in the CatalogResource version I have (based on Inge's) the enum is in CatalogCommon.cs; that is used for all sorts of buy/build items (columns and fences and so on, not just COBJ/OBJD) .. right now they're all using the same mega list as CasParts, so you could theoretically tag a column with AgeAppropriate_Elder =P

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Ms. Byte (Deceased)
#9 Old 24th Aug 2015 at 2:41 AM
Sounds good!

In CAS Tools I just populate a temporary value list by filtering on the prefix - no need for separate lists. Not sure which way is better. I still need separate tag lists to separate tags that pertain to CASPs from ones that pertain to objects, etc. Can't think of any better way.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
1978 gallons of pancake batter
#10 Old 24th Aug 2015 at 6:45 AM
Quote: Originally posted by plasticbox
That is all in a separate wrapper IIRC.
It is in a separate "project", but yes. That way the other stuffez can be retro-fitted to use it without having to deal with any nasty cross references or anything like that. I would add getters next and then start rewriting the other stuff to not use the enums, but tag classes/structs.

Also on the way I might aggressively refactor, e.g. extract lotsa classes (one frigging type per file, darnit!)... maybe. I might go completely nuts and add test harnesses, but maybe not.

PS: The dictionary thing is not written in stone at any rate. Is just the internal implementation that consumers won't see anyway. We'll see how it goes when we start to actually use it.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Pettifogging Legalist!
retired moderator
Original Poster
#11 Old 29th Aug 2015 at 12:10 AM Last edited by plasticbox : 29th Aug 2015 at 4:39 AM.
OK, we're done \o/ (For the most part)

Current status is in https://github.com/pboxx/Sims4Tools

  • Reads the current tag list from S4_03B33DDF_00000000_D89CB9186B79ACB7.xml
  • Tags in COBJ and its relatives are now displayed in a two-tiered dropdown in Grid View (categories in the primary list, tags in the secondary list)
  • Tag dropdown is still editable (so one can paste any tag into it without having to scroll through the menu) and also supports autocomplete o.O



CASP and OBJD (Emotion tags) are not making use of it yet; we're probably going to look at that on the weekend. @CmarNYC were you about to edit CASP as well? We weren't sure whether we should change that right now.

Also, the entire list of tags is accessible from anywhere right now -- i.e. there is no filtering for "correct" categories per resource type (which means one can still tag a column as Fabric_Silk if one is so inclined). Not sure whether such a filter wouldn't perhaps get in the way of future updates to the XML .. ?

We're probably going to upload an updated release build in this forum (the changes aren't only in the dlls so just uploading wrapper updates wouldn't work for this).


(Oh and I should remind @Buzzler about the bookmark thing .. wot scumbumbo said in post #4)
Screenshots

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Ms. Byte (Deceased)
#12 Old 29th Aug 2015 at 1:42 AM
Show me an example and I'll revise the CASP and TONE.

I'll take a look before having an opinion on filtering. However, I think filtering on the tag value prefix should be pretty robust. That's what I do in CAS Tools and all I do with each update is paste the new list in and it just works.

Will look at it tomorrow - I've spent the last two days struggling with the FTPT wrapper which gave me the weirdest problems you ever saw.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
1978 gallons of pancake batter
#13 Old 29th Aug 2015 at 9:28 PM
It is incorporated into the CatalogTag class in the CatalogResource.Common.CatalogCommon file. Basically the private enum field tag is now a s4pi.Resource.Commons.CatalogTags.Tag. Tag is implicitly convertible to ushort, so it should almost be a drop-in replacement. IIRC, the only code I had to change beyond the field type was in the Parse and Unparse methods. Implicit conversion from ushort to Tag could be done too, but I wasn't sure if that would help more than obfuscate things.

Code:
// Parse
this.tag = CatalogTagRegistry.FetchTag(br.ReadUInt16());

// Unparse
bw.Write(this.Tag); // <- implicit conversion to ushort in action


For editing I wrote a custom editor which is declared in the Editor attribute on the Tag class.

Quote:
Will look at it tomorrow - I've spent the last two days struggling with the FTPT wrapper which gave me the weirdest problems you ever saw.
I kinda doubt that. The last couple days at work I was in constant fear that my WTF face would stick.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
1978 gallons of pancake batter
#14 Old 30th Aug 2015 at 1:34 PM Last edited by Buzzler : 30th Aug 2015 at 1:45 PM.
I just incorporated the shtuff into ObjectDefinitionResource, i.e. the EnvironmentScoreEmotionTags. Was a little more complicated than for CatalogCommon, but not that much.

I changed the types of EnvironmentScoreEmotionTags and the respective field into CatalogTagList (extracted CatalogTagList and CatalogTag into separates class files in CatalogResource.Commons).

Changed the related branches of Parse and Unparse like that:
Code:
// Parse
case PropertyID.EnvironmentScoreEmotionTags:
	count = r.ReadInt32();

	var tags = new ushort[count];
	for (int m = 0; m < count; m++)
	{
		tags[m] = r.ReadUInt16();
	}

	var catalogTags = tags.Select(CatalogTagRegistry.FetchTag)
						  .Select(t => new CatalogTag(CatalogCommon.kRecommendedApiVersion, this.OnResourceChanged, t));

	this.environmentScoreEmotionTags = new CatalogTagList(this.OnResourceChanged, catalogTags);

	break;

// Unparse
case PropertyID.EnvironmentScoreEmotionTags:
	ushort[] tags = this.environmentScoreEmotionTags.Select(t => t.Tag.Index).ToArray();
	w.Write(tags.Length);
	foreach (var value in tags)
	{
		w.Write(value);
	}
	break;


I'll probably write extensions for BinaryWriter and BinaryReader for the parse/unparse part next if we need that in more places.

PS and ETA: It doesn't seem like Kuree has any inclination to accept my changes or even discuss them. I on the other hand am not sure if I feel like dealing with someone who seems to have strong opinions but at the same time keeps those opinions to himself.

Bottom of the line is that I apparently make those changes just for myself right now. Which seems kinda pointless, because I don't even use s4pe. Feels a little unsatisfying.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
1978 gallons of pancake batter
#15 Old 30th Aug 2015 at 7:10 PM
I've just pushed a new folder bookmark functionality (available via the Settings menu) to pbox's repo. I - or someone else - can upload a testing version once we have that all in one place with cmar's changes.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Ms. Byte (Deceased)
#16 Old 31st Aug 2015 at 12:30 AM
Sorry to be taking so long - RL interferes. I should be able to sit down and spend some time on this tomorrow.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
Ms. Byte (Deceased)
#17 Old 31st Aug 2015 at 3:42 PM Last edited by CmarNYC : 31st Aug 2015 at 4:08 PM.
Well, I feel dreadfully stupid but I figure I might as well ask rather than spend hours figuring this out.

s4pe/s4pi is the only project I've ever downloaded and tried to build like this. With Kuree's branch I've just worked with one wrapper at a time and set the references to the dlls in the download of s4pe. With this branch there's no compiled version, and when I try to compile it I get almost 200 errors because it can't find the references.

How am I supposed to be doing this?

Edit: Never mind - after some blundering around I managed to build s4pi.Resource.Commons.dll, put it where the other projects expected to find it, and building the whole project Just Worked.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
Pettifogging Legalist!
retired moderator
Original Poster
#18 Old 31st Aug 2015 at 4:12 PM
Which "this branch" do you mean now? And are you working off my repo or our own or the master or .. ? (I’ve pulled/merged your most recent commits into mine yesterday, so that should be up to date -- the “three commits behind master” are just the ones where Kuree merged yours, so no actual difference)

You might need to build more than once to get all the references to work properly, I’ve had the same phenomenon but all I needed to do was 2 or 3 builds in a row (you’ll see that the error messages are much fewer the second time around). Not Re-Build, just Build one more time. Perhaps “Clean Solution” could also help.


Ah OK, didn’t see your edit in time. Good to hear that it worked now!

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Ms. Byte (Deceased)
#19 Old 31st Aug 2015 at 6:37 PM
Ah, I think the repeated builds are what fixed it. Good to know for the future. And I think my problems with the prebuild events not working in my previous work were because I was opening and building individual wrappers instead of opening the whole humongous project. Also good to know.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
Ms. Byte (Deceased)
#20 Old 31st Aug 2015 at 10:04 PM Last edited by CmarNYC : 31st Aug 2015 at 11:02 PM.
I deleted everything and started over to make sure I didn't mess anything up, and after repeated builds the reference to s4pi.Resource.Commons didn't resolve. I again had to go into the s4pi.Resource.Commons folder and open and compile that project separately and then reference it from CatalogResource. Is that the way it's supposed to work?

A bigger issue - it looks to me like the catalog tags consist of only the UInt16 tag value?? Is that right? The CASP, TONE, and StyledLook resources have a tag list consisting of a UInt16 category and a UInt16 tag value, and the CatalogTagList class is not working correctly in them.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
1978 gallons of pancake batter
#21 Old 1st Sep 2015 at 6:52 AM
Quote: Originally posted by CmarNYC
I deleted everything and started over to make sure I didn't mess anything up, and after repeated builds the reference to s4pi.Resource.Commons didn't resolve. I again had to go into the
s4pi.Resource.Commons folder and open and compile that project separately and then reference it from CatalogResource. Is that the way it's supposed to work?
Most definitely not. With the second attempt the whole solution should compile. And it only takes two times because the project references are messed up; some are pointing at the compiled assemblies instead of the projects.

Quote:
A bigger issue - it looks to me like the catalog tags consist of only the UInt16 tag value?? Is that right? The CASP, TONE, and StyledLook resources have a tag list consisting of a UInt16 category and a UInt16 tag value, and the CatalogTagList class is not working correctly in them.
Right now it's only a ushort tag value wrapped in a Tag class, yes. That's what I saw in CatalogCommon and OBJD, so that's how I implemented it. Are you saying that two flags are actually stored in CASP and TONE etc?

If so, I'll need to extend the functionality somewhat. The CatalogTagRegistry knows of catalog tags already. Expose some functionality in CatalogTagRegistry, extract a superclass from Tag and write a new custom editor.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Ms. Byte (Deceased)
#22 Old 1st Sep 2015 at 12:46 PM
Quote: Originally posted by Buzzler
Right now it's only a ushort tag value wrapped in a Tag class, yes. That's what I saw in CatalogCommon and OBJD, so that's how I implemented it. Are you saying that two flags are actually stored in CASP and TONE etc?


Yes, in the CASP-family resources there are ushort pairs: category (i.e. Color) and value (i.e. Color_red). A bit redundant actually, and maybe they dropped the category when setting up object resources.

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
1978 gallons of pancake batter
#23 Old 6th Sep 2015 at 6:56 PM
Heya, short heads up: I'm working crazy hours right now, so I don't have much time to put into this. None, actually. I just made a little something anyway. A CompoundTag class with Converter and Editor that I incorporated into the CASPartResource. It's very much a WIP, as it is completely untested and not yet refactored. I pushed it to pbox's repo to feature/compound_tag_for_casp. I also refactored CASPartResource somewhat and extracted all those millions of nested classes. Sorry if that hurts your attempts to merge.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
1978 gallons of pancake batter
#24 Old 14th Sep 2015 at 6:53 PM
Ok, and now it's tested and worky. It's in the new develop branch on pbox's github repo.

If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
Pettifogging Legalist!
retired moderator
Original Poster
#25 Old 14th Sep 2015 at 8:28 PM
I just published a beta that should contain all of the recent updates ( @CmarNYC ’s as well). @scumbumbo your folder bookmark thing is also in there!

See this post / Download on github.

Stuff for TS2 · TS3 · TS4 | Please do not PM me with technical questions – we have Create forums for that.

In the kingdom of the blind, do as the Romans do.
Page 1 of 2
Back to top