- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Tunable Menu
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Tunable Menu
Replies: 14 (Who?), Viewed: 1755 times.
#1
10th Nov 2010 at 5:19 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
Tunable Menu
I want to be able to add/change the menu options for my object from a list in a XML. How would I do this? I looked at the way the Stereo does it, but that is way more complex than what I need, and I couldn't simplify it enough to work for me.
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Advertisement
#2
10th Nov 2010 at 7:19 PM
Quote: Originally posted by cmomoney
I want to be able to add/change the menu options for my object from a list in a XML. How would I do this? |
If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#3
10th Nov 2010 at 9:52 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
I understand how to make a script tunable and such. My problem is how to make a list in the xml, and how to use that list as strings for my menu choices.
Great tutorial, btw.
Great tutorial, btw.
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
#4
10th Nov 2010 at 10:42 PM
Posts: 1,728
EA formatted XML Tables are pretty simple to implement.
You create a unique named XML file, and then use the XmlDbData.ReadData() function to retrieve the information.
XmlDbData data = XmlDbData.ReadData("MyUniquelyNameXMLFile");
Retrieve the XmlDbTable you are interested in (there could be multiple in the file. ie: The "Careers" file has a table for each individual career).
if (!data.Tables.TryGetValue("MyTable", out table)) return false;
From there, you run through each row in the table:
foreach(XmlDbRow row in table.Rows)
{
...
}
Finally, read the field you are looking for into a structure for later use.
string myfield = row.GetString("MyField", "");
sMyFields.Add(myfield);
When you want to use those values in your menu interaction, read the values from sMyFields and go from there.
----
Various examples of XML Table usage can be found in the Core, search for functions that start with the word "Parse" (ie: Career::ParseCareerData)
Cheers.
NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
You create a unique named XML file, and then use the XmlDbData.ReadData() function to retrieve the information.
XmlDbData data = XmlDbData.ReadData("MyUniquelyNameXMLFile");
Retrieve the XmlDbTable you are interested in (there could be multiple in the file. ie: The "Careers" file has a table for each individual career).
if (!data.Tables.TryGetValue("MyTable", out table)) return false;
From there, you run through each row in the table:
foreach(XmlDbRow row in table.Rows)
{
...
}
Finally, read the field you are looking for into a structure for later use.
string myfield = row.GetString("MyField", "");
sMyFields.Add(myfield);
When you want to use those values in your menu interaction, read the values from sMyFields and go from there.
----
Various examples of XML Table usage can be found in the Core, search for functions that start with the word "Parse" (ie: Career::ParseCareerData)
Cheers.
NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
#5
10th Nov 2010 at 11:03 PM
Quote: Originally posted by cmomoney
I understand how to make a script tunable and such. My problem is how to make a list in the xml, and how to use that list as strings for my menu choices. |
If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#6
11th Nov 2010 at 9:24 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
twallan: Thanks. That's actually how I had been trying to do it, but I couldn't get it to work. And I still can't get it to work, even after you've explained it. I think I'm losing it at the "sMyFields.Add(myfield);" part. Either that or I'm not reading the values right. Can you explain that a little further? The EA examples use a Dictionary to store a bunch of stuff, which is confusing me because I only need one or two lists of strings.
Buzzler: That sounds like a good idea(and yes, it's for the pose box), but I can't even get the regular menu to work. I wouldn't know where to start with that.
Buzzler: That sounds like a good idea(and yes, it's for the pose box), but I can't even get the regular menu to work. I wouldn't know where to start with that.
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
#7
11th Nov 2010 at 10:23 PM
Posts: 1,728
Quote: Originally posted by cmomoney
I think I'm losing it at the "sMyFields.Add(myfield);" part. Either that or I'm not reading the values right. Can you explain that a little further? |
The simplest method is to define sMyFields as follows:
public static List<string> sMyFields = new List<string>();
Place that line in one of your classes.
NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
#8
11th Nov 2010 at 10:47 PM
Posts: 902
Thanks: 32134 in 20 Posts
If you want a simple string list, you could add a tunable (or two) like this example from S3_0333406C_00000000_4D02F4BA2106FDD1_VenueAmbienceManager_0x4d02f4ba2106fdd1%%+_XML.xml:
This should then make the strings "bar_amb_lounge_lo", "bar_amb_lounge_med" and "bar_amb_lounge_high" available in the variable kCocktailLoungeAmbienceSoundStrings. In the class it looks like this:
Once you have the strings, you could add your interactions based on whether or not something is in the list.
If you want to use a single interaction function to handle similar interactions that are only different depending on one or two variables, take a look at:
Sims3.Gameplay.Abstracts.Door+DEBUG_OpenClose
I found it quite helpful as an example to create interactions that take arguments and can handle them.
Code:
<kCocktailLoungeAmbienceSoundStrings value="bar_amb_lounge_lo, bar_amb_lounge_med, bar_amb_lounge_high"> <!--Ambience sounds for Cocktail Lounge. From left to right is {low, medium, high} population ambiences.--> </kCocktailLoungeAmbienceSoundStrings>
This should then make the strings "bar_amb_lounge_lo", "bar_amb_lounge_med" and "bar_amb_lounge_high" available in the variable kCocktailLoungeAmbienceSoundStrings. In the class it looks like this:
Code:
[TunableComment("Ambience sounds for Cocktail Lounge. From left to right is {low, medium, high} population ambiences."), Tunable] public static string[] kCocktailLoungeAmbienceSoundStrings;
Once you have the strings, you could add your interactions based on whether or not something is in the list.
If you want to use a single interaction function to handle similar interactions that are only different depending on one or two variables, take a look at:
Sims3.Gameplay.Abstracts.Door+DEBUG_OpenClose
I found it quite helpful as an example to create interactions that take arguments and can handle them.
#9
15th Nov 2010 at 3:05 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
Thanks everybody. I still was not able to get the XMLTable to work, I was able to get the menu to work using velocitygrass's suggestion(although XMLTables seem like the more efficient way).
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
#10
15th Nov 2010 at 5:56 PM
Quote: Originally posted by cmomoney
Thanks everybody. I still was not able to get the XMLTable to work, I was able to get the menu to work using velocitygrass's suggestion(although XMLTables seem like the more efficient way). |
If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#11
15th Nov 2010 at 10:05 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
The 'not working' or the 'working' one? Because I don't have the 'not working' one, I would have to try then FAIL again, lol.
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
#12
16th Nov 2010 at 3:09 PM
Quote: Originally posted by cmomoney
The 'not working' or the 'working' one? Because I don't have the 'not working' one, I would have to try then FAIL again, lol. |
If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#13
16th Nov 2010 at 5:10 PM
Posts: 1,740
Thanks: 107822 in 53 Posts
Oh yeah, I would much rather use the XMLTable and the ObjectPickerDialog. I just don't have the broken code anymore, so to post it I'll have to write it wrong again. But I will if I have to(to get it working the way I want).
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
#14
16th Nov 2010 at 7:59 PM
Quote: Originally posted by cmomoney
Oh yeah, I would much rather use the XMLTable and the ObjectPickerDialog. |
If gotcha is all you’ve got, then you’ve got nothing. - Paul Krugman
#15
30th Nov 2010 at 12:06 AM
Posts: 1,740
Thanks: 107822 in 53 Posts
The XML format I would like to use is this:
For testing, I was just using a ShowTNS message to see if it worked.
Code:
<CmoPoseBox> <Pose> <AnimationName></AnimationName> <ClipName></ClipName> <PathName></PathName> </Pose> <Pose> <AnimationName>animName</AnimationName> <ClipName>a_clipName_x</ClipName> <PathName>pathName</PathName> </Pose> </CmoPoseBox>
For testing, I was just using a ShowTNS message to see if it worked.
"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Who Posted
|