Welcome to
Mod The Sims
Online: 1337
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 5 (Who?), Viewed: 371 times.
Search this Thread
Old 22nd Nov 2020, 8:47 PM Default[Testers Wanted] Script mod for Discuss Kelp Recipes #1
echoweaver
Original Poster

Instructor

Join Date: Jun 2011
Posts: 507
Thanks: 409 in 13 Posts
6 Achievements


I wrote a little script mod as a companion to my kelp recipes (here) to make the Discuss Kelp Recipes interaction do something. This is my first script mod, so I'm biting off a small task.

This script gives a tunable 1-in-4 chance of learning a kelp recipe when you use the Discuss Kelp Recipes interaction IF:
  • You are the non-Mermaid in the interaction
  • You are a Mermaid who initiated the interaction with another Mermaid

So Mermaids can learn from each other, but BOTH Mermaids can't learn a recipe from the same interaction.

The script checks to make sure that each of my kelp recipes is pleasant, so it won't crash itself if only some are installed. "Discuss Kelp Recipes" is actually a different interaction on land and in the water, but both should work.

My big question so far is about internationalization. How do I use STBL strings in my notification messages? Right now, the notifications are just hard-coded English. In a perfect world, I'd be able to just access the string the game already uses ("Jane Doe just learned how to make Melon Pizza! Delish!")

This is a simple enough script that I could just post the source code in a comment. Is there a "Spoiler" tag in MTS markup?
Download - please read all instructions before downloading any files!
File Type: zip Echoweaver_DiscussKelp.package.zip (3.6 KB, 6 downloads)

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Old 23rd Nov 2020, 12:29 AM #2
lizcandor
Lab Assistant

Join Date: Jan 2012
Posts: 140
Thanks: 317 in 2 Posts
5 Achievements

View My Journal


I have some mermaids who could try this out! Will report back

Here's how I've been localizing notifications:
Code:
target.ShowTNSIfSelectable(target.FullName + LocalizeNotificationString("AddOpenMinded", null), StyledNotification.NotificationStyle.kSimTalking);
And then my LocalizeNotificationString method is this:
Code:
public static string LocalizeNotificationString(string name, params object[] parameters)
{
     return Localization.LocalizeString("lizcandor/Localization/Notification:" + name, parameters); // Using the Localization class from Sims3.Gameplay.Utilities
}
And "lizcandor/Localization/Notification:AddOpenMinded" is the key for the string " gained the Open-Minded trait." (It occurs to me looking at this now, I should probably be more organized with my localization keys, like specify what mod they're for or something.)
Old 23rd Nov 2020, 3:30 AM #3
echoweaver
Original Poster

Instructor

Join Date: Jun 2011
Posts: 507
Thanks: 409 in 13 Posts
6 Achievements


I see, and then the STBL will have a string for lizcandor/Localization/Notification:AddOpenMinded?

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Old 23rd Nov 2020, 3:55 AM #4
lizcandor
Lab Assistant

Join Date: Jan 2012
Posts: 140
Thanks: 317 in 2 Posts
5 Achievements

View My Journal


That's right!

[Edit] Also, a testing update - I had a mermaid spam their human housemate with "Discuss Kelp Recipes" for a few sim-hours; the notice I got when the human learned a recipe always said the one they learned was seaweed salad, I think like 3 times? I didn't think to confirm before quitting that they actually had only learned that recipe, though. I used MasterController to make the mermaid learn all the recipes, so they definitely were all in the game as recipes that could be learned.

If you haven't already, I think you could add something like this to check whether a sim knows the recipe that was chosen for them to learn:
Code:
Cooking cooking = sim.SkillManager.GetElement(SkillNames.Cooking) as Cooking;
bool knowsRecipe=cooking.KnownRecipes.Contains(recipe.Key);
I've never actually tried anything like that though.
Last edited by lizcandor : 23rd Nov 2020 at 4:37 AM.
Old 23rd Nov 2020, 5:13 AM #5
echoweaver
Original Poster

Instructor

Join Date: Jun 2011
Posts: 507
Thanks: 409 in 13 Posts
6 Achievements


Quote:
Originally Posted by lizcandor
That's right!

If you haven't already, I think you could add something like this to check whether a sim knows the recipe that was chosen for them to learn:


Thanks so much for the testing!

It is supposed to be checking to be sure the recipe is not already known, but that sounds like it's not working. I shall investigate.

ETA: I think I see why the test is failing when it shouldn't. Thanks so much for the report.

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Last edited by echoweaver : 23rd Nov 2020 at 7:27 PM.
Old 24th Nov 2020, 9:23 PM #6
echoweaver
Original Poster

Instructor

Join Date: Jun 2011
Posts: 507
Thanks: 409 in 13 Posts
6 Achievements


OK, after a few false starts, I found what was causing the KnownRecipes test to fail. I also added localization. Woot!
Download - please read all instructions before downloading any files!
File Type: zip Echoweaver_DiscussKelp.package.zip (4.2 KB, 1 downloads)

Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.