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!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 1st Jul 2015 at 8:22 AM
Default Elixir Consignment Register for Basegame
I extract the elixir shop from EP7 Supernatural for Basegame. It almost done. I can consign items from inventory. But the shop just sell Potions, nothing else.

How can I make it sells items which defines from Register XML. I modify it as below but none show up in shopping list

Thanks for help.
Advertisement
Field Researcher
#2 Old 1st Jul 2015 at 9:52 AM
According to the code the PotionShopConsignment data in the Register XML is read into the game ONLY if you have a Supernatural installed and is completely ignored if you don't.
Test Subject
Original Poster
#3 Old 1st Jul 2015 at 2:07 PM
Quote: Originally posted by icarus_allsorts
According to the code the PotionShopConsignment data in the Register XML is read into the game ONLY if you have a Supernatural installed and is completely ignored if you don't.

I don't know how data is read into the game.
why it still ignore the XML tag
<ProductVersion>BaseGame</ProductVersion>
<RequiredProductVersion>BaseGame</RequiredProductVersion>
Field Researcher
#4 Old 1st Jul 2015 at 3:59 PM
It's just how the developers coded the game, if you don't have Supernatural installed, the game code is written such that anything in between any of the <PotionShopConsignment> and </PotionShopConsignment> in that XML is automatically skipped no matter what is written there. You'd need a script mod to manually load that data into the game without Supernatural installed.
Test Subject
Original Poster
#5 Old 2nd Jul 2015 at 2:51 AM
Quote: Originally posted by icarus_allsorts
It's just how the developers coded the game, if you don't have Supernatural installed, the game code is written such that anything in between any of the <PotionShopConsignment> and </PotionShopConsignment> in that XML is automatically skipped no matter what is written there. You'd need a script mod to manually load that data into the game without Supernatural installed.


Is that the code that read PotionShopConsignmentRegisterData?
I don't know C# but as far as my PHP knowledge, that if function will let read <RequiredProductVersion>.
Please correct me if I'm wrong.
Field Researcher
#6 Old 2nd Jul 2015 at 7:21 AM
You're right that that is the code that reads the data labelled as PotionShopConsignment in the Register XML. The problem is where this code is called to run which can be seen in the ShoppingRegister class:

Code:
// Sims3.Gameplay.Objects.Register.ShoppingRegister
public static void ParseData()
{
	XmlDbData xmlDbData = XmlDbData.ReadData("Register");

	... 

	if (GameUtils.IsInstalled(ProductVersion.EP7) && xmlDbData.Tables.TryGetValue("PotionShopConsignment", out xmlDbTable))
	{
		PotionShopConsignmentRegister.ParseData(xmlDbTable); <- If the underlined code above is not true, this line of code is not run
	}

	...

}


So the ParseData in your screenshot is only run if EP7, i.e. Supernatural is installed.
Test Subject
Original Poster
#7 Old 2nd Jul 2015 at 1:21 PM
thanks for your help.
Test Subject
Original Poster
#8 Old 4th Jul 2015 at 9:06 AM
for testing purpose, I rewrite the code but it doesn't read data from Register XML
Code:
// Sims3.Gameplay.Objects.Register.MyShoppingRegister
public static void ParseData()
{
            XmlDbData data = XmlDbData.ReadData("Register");
            if (data != null)
            {
                Dictionary<string, XmlDbTable> tables = data.Tables;
            }
            XmlDbTable table = null;
            data.Tables.TryGetValue("PotionShopConsignment", out table);
            MyPotionShopConsignmentRegister.ParseData(table);
}


Code:
// Sims3.Gameplay.Objects.Register.MyPotionShopConsignmentRegister
        public static void ParseData(XmlDbTable shopListData)
        {
            foreach (XmlDbRow row in shopListData.Rows)
            {
                    sData.Add(new PotionShopRegisterData(row));
            }
            InitializeData();
        }

so. where does developers get data from?
Field Researcher
#9 Old 4th Jul 2015 at 12:13 PM
The data has to be added to "PotionShopConsignmentRegister.sData" at the start of the game (it's not obvious from what you've written what your "sData" refers to).
Test Subject
Original Poster
#10 Old 4th Jul 2015 at 12:35 PM
Quote: Originally posted by icarus_allsorts
The data has to be added to "PotionShopConsignmentRegister.sData" at the start of the game (it's not obvious from what you've written what your "sData" refers to).

sData prefer to variable of my class PotionShopConsignmentRegister
private static List<PotionShopRegisterData> sData = new List<PotionShopRegisterData>();
still inside a scope of class so I don't need to write it down. but for sure, i prefer to classname => still not work
thank you for your help

by the way, how do i debug C# code from Visual Studio? it's hard time to code then run game to test :-(
Field Researcher
#11 Old 4th Jul 2015 at 1:30 PM
That's the thing, you're adding the data to your own variable in your own class, but the game only reads the sData static variable from the original PotionShopConsignmentRegister class so just add the data there.
Test Subject
Original Poster
#12 Old 4th Jul 2015 at 1:55 PM Last edited by tenmang : 4th Jul 2015 at 2:08 PM.
Quote: Originally posted by icarus_allsorts
That's the thing, you're adding the data to your own variable in your own class, but the game only reads the sData static variable from the original PotionShopConsignmentRegister class so just add the data there.

ah i just rewrite the 2 new class that doesn't relate to original PotionShopConsignmentRegister or ShoppingRegister. Then edit OBJK to my script.
so i dont understand why the game only reads sData from the original class?
thank you for taking your time to help me out.
Field Researcher
#13 Old 4th Jul 2015 at 5:26 PM
When you're buying from the potion register like in your screenshot, the game reads PotionShopConsignmentRegister.sData for the information of what to display. Whatever you're doing has not changed this behavior in any way. Instead of going through the trouble of changing this to try and get it to read your sData, it's simply more straightforward to add the information you want to PotionShopConsignmentRegister.sData directly. i.e.
Code:
// Sims3.Gameplay.Objects.Register.MyPotionShopConsignmentRegister
public static void ParseData(XmlDbTable shopListData)
{
     foreach (XmlDbRow row in shopListData.Rows)
     {
            PotionShopConsignmentRegister.sData.Add(new PotionShopRegisterData(row));
     }
     PotionShopConsignmentRegister.InitializeData();
 }


and assuming you get the game to run your script correctly, that should be enough.
Test Subject
Original Poster
#14 Old 5th Jul 2015 at 3:12 AM Last edited by tenmang : 5th Jul 2015 at 3:43 AM.
Quote: Originally posted by icarus_allsorts
When you're buying from the potion register like in your screenshot, the game reads PotionShopConsignmentRegister.sData for the information of what to display. Whatever you're doing has not changed this behavior in any way. Instead of going through the trouble of changing this to try and get it to read your sData, it's simply more straightforward to add the information you want to PotionShopConsignmentRegister.sData directly. i.e.
and assuming you get the game to run your script correctly, that should be enough.

ah thanks for this idea. but it's cruel that sData is a
Code:
private static List<PotionShopConsignmentRegisterData> sData;

of PotionShopConsignmentRegister. is there any way to use it in my class?
Field Researcher
#15 Old 5th Jul 2015 at 6:47 AM
Did you unprotect the game dlls for your project? http://www.simlogical.com/ContentUp...e/uploads/1689/

That would make sData a public static variable instead of a private one so that you can have access to it from your class.
Test Subject
Original Poster
#16 Old 5th Jul 2015 at 8:24 AM
Quote: Originally posted by icarus_allsorts
Did you unprotect the game dlls for your project? http://www.simlogical.com/ContentUp...e/uploads/1689/

That would make sData a public static variable instead of a private one so that you can have access to it from your class.

great !!!
but when i drop game dlls into it says
Quote:
Could not find ildasm installation.
Press the 'ANY' key to continue...

i use VS C# 2008 portable version so it doesn't come with sdk / ildasm install
would you please upload the unprotected of those dlls, if it isn't illegal here :=D
Inventor
#17 Old 16th Jul 2015 at 9:47 PM
Can I suggest to override the OnStartup method of your class and add there
(in a block of code executed only the very first time and not each time OnStartup
is called, aka every time you select the object from the catalog - but might not be
limited to that case) a call to the parsing method using as parameter your custom
"shopping list" xml resource.

Also remember that those kind of registers can only sell items with a NGMP entry
that maps the (FNV64 hash of the) name you put in the xml for the object to the
InstanceId of its OBJD.

Take a look at my Ice Cream Stand if you need a reference. GL with your project.
Back to top