Replies: 11 (Who?), Viewed: 914 times.
Instructor
Original Poster
#1 Old 16th Oct 2021 at 9:53 PM Last edited by Battery : 20th Nov 2021 at 8:50 PM.
Default C# Script Utility Overview
Mod Page:


What is the C# Script Utility ?



Please do not answer on this thread, since it is work in Progress (and unsorted at the moment)
If you Have questions or you want to discuss something about the mod:






Table of Content

Other Tutorials and References


Installation


Sims 3 Script Extender Overview (S3SE)


Auto Menu


Artificial Neural Network Application (ANNA)


Saving/loading Settings


Adding Interactions


SimTools
Screenshots
Download - please read all instructions before downloading any files!
File Type: 7z ScriptUtility serializing Objects Example.7z (16.0 KB, 6 downloads)
File Type: 7z ScriptUtility deserializing Objects Example.7z (17.3 KB, 3 downloads)
Advertisement
Instructor
Original Poster
#2 Old 16th Oct 2021 at 9:57 PM Last edited by Battery : 24th Oct 2021 at 6:38 PM.
Attachments:
Screenshots
Download - please read all instructions before downloading any files!
File Type: 7z ScriptUtility using the Auto Menu.7z (11.5 KB, 1 downloads)
File Type: 7z ScriptUtility Serialization Menu Example.7z (6.8 KB, 2 downloads)
Instructor
Original Poster
#3 Old 16th Oct 2021 at 10:23 PM Last edited by Battery : 22nd Oct 2021 at 9:53 PM.
Installation:

Step 1


Step 2


Step 3


Step 4
Instructor
Original Poster
#4 Old 16th Oct 2021 at 11:40 PM Last edited by Battery : 24th Oct 2021 at 6:39 PM.
Auto Menu

Example Solution and package File

Usage: Lets Players set values which were exposed by you (similar to NRaas retuner) Does NOT require the C# Utility to be referenced (so it is optional)




Change the Assembly Name Sharp Develop:

Change the Assembly Name Visual Studio:


Example:


Note: If you expose a static field that holds an class instance you can change all the cointained settings
Instructor
Original Poster
#5 Old 16th Oct 2021 at 11:48 PM Last edited by Battery : 23rd Oct 2021 at 8:43 PM.
Anna

Post Reserved
Instructor
Original Poster
#6 Old 16th Oct 2021 at 11:50 PM Last edited by Battery : 24th Oct 2021 at 12:43 PM.
Export_Import
(Creating a simple menu that lets the player Load / Save your custom Objects)

Example Solution and package File

Battery.Export_Import

0 Create a method to handle the imported string

1 Create a method to export our object

2. Creating the Menu


3. Adding the Menu options


4. Opening our Menu
Instructor
Original Poster
#7 Old 17th Oct 2021 at 6:20 PM Last edited by Battery : 23rd Oct 2021 at 10:40 PM.
Export_Import
(Serializing Objects)

Battery.Export_Import


string ToExportString<T>(this T objecttoexport)


interface ICustomSerializer
Instructor
Original Poster
#8 Old 22nd Oct 2021 at 9:44 PM Last edited by Battery : 23rd Oct 2021 at 10:40 PM.
(Example: Serializing Objects)

Example Solution and package File

Simple Example



Simple Example(only serialize some fields)



Advanced Example(using custom Serializing instructions)
Instructor
Original Poster
#9 Old 22nd Oct 2021 at 9:50 PM Last edited by Battery : 23rd Oct 2021 at 10:41 PM.
Export_Import
(Deserializing Saved Objects)

Battery.Export_Import


T Deserialize<T>(string ExportString)
Instructor
Original Poster
#10 Old 23rd Oct 2021 at 10:41 PM
(Example: Deserializing Saved Objects)

Example Solution and package File

Simple Example



Advanced Example
Instructor
Original Poster
#11 Old 1st Nov 2021 at 11:57 AM Last edited by Battery : 1st Nov 2021 at 12:14 PM.
InteractionsUtility
(Adding Interactions)

Battery.Interactions.InteractionsUtility


void AddInteraction(GameObject o, InteractionDefinition Singleton)


void AddinteractionToObjectsOfType<type>(InteractionDefinition Singleton)


void AddTerrainnteraction(InteractionDefinition Singleton)
Instructor
Original Poster
#12 Old 20th Nov 2021 at 8:08 PM Last edited by Battery : 20th Nov 2021 at 10:23 PM.
SimTools
(Converting the Age of a sim to real world years)

Battery.SimTools

float GetAgeInRealYears(Sim s,float MaxBabyAge=1f, float MaxToddlerAge=4f, float MaxChildAge=13f, float MaxTeenAge=19f, float MaxYoungAdultAge=35f, float MaxAdultAge=60f, float NormalLifeTime=86f)


float GetPetAgeInRealYears(Sim s, float MaxChildCatAge = 1f, float MaxAdultCatAge = 7f, float MaxNormalCatLifeTime = 12f, float MaxChildDogAge = 1f, float MaxAdultDogAge = 9f, float MaxNormalDogLifeTime = 12f, float MaxChildHorseAge = 3f, float MaxAdultHorseAge = 15f, float MaxNormalHorseLifeTime = 20f)




(Modifying a sims facial/body sliders)

Battery.SimTools.Slider

float Get_Value(Sim sim, Sliders slider)


bool mod_Value(Sim sim, float ModifyBy, Sliders slider)


bool Set_Value(Sim sim, Sliders slider, float value)
Back to top