Replies: 3 (Who?), Viewed: 160 times.
Test Subject
Original Poster
#1 Old 7th Jul 2022 at 1:23 AM
Default Tutorial for making script tunable?
Is there a tutorial for making a script mod tunable on the site or wiki? I'm having trouble finding one.
Advertisement
Instructor
#2 Old 7th Jul 2022 at 9:16 PM
I dont know of a specific tutorial just for tuning but it really is not complicated epecially if you already created your first script mods.

you just need to make all the variable you want to be tunable static and decorate them with [Tunable] in the code then create/or modify an xml resource in your package file with the instance Id being the fnv64 hash of your Namespace.Classname

in there you just write a list of the variables you want to tune
lets say you got a tunables in your cs file with the name and type

[Tunable] static int Duration;
[Tunable] static float SomeFloatVariable;
[Tunable] static string SomeName;


Code:
<?xml version="1.0" encoding="utf-8"?>
<base>
  <Current_Tuning>
    <Duration value="25"/>
    <SomeFloatVariable value="0.1357"/>
    <SomeName value="Anna"/>
  </Current_Tuning>
</base>
Test Subject
Original Poster
#3 Old 30th Jul 2022 at 7:12 PM
Quote:
Originally Posted by Battery
I dont know of a specific tutorial just for tuning but it really is not complicated epecially if you already created your first script mods.

you just need to make all the variable you want to be tunable static and decorate them with [Tunable] in the code then create/or modify an xml resource in your package file with the instance Id being the fnv64 hash of your Namespace.Classname

in there you just write a list of the variables you want to tune
lets say you got a tunables in your cs file with the name and type

[Tunable] static int Duration;
[Tunable] static float SomeFloatVariable;
[Tunable] static string SomeName;


Code:
<?xml version="1.0" encoding="utf-8"?>
<base>
  <Current_Tuning>
    <Duration value="25"/>
    <SomeFloatVariable value="0.1357"/>
    <SomeName value="Anna"/>
  </Current_Tuning>
</base>


Okay, sorry I've taken so long to come back to this. What are the rules? Can variables still be public/private?
Field Researcher
#4 Old 30th Jul 2022 at 8:07 PM
Quote:
Originally Posted by YolkSims
Okay, sorry I've taken so long to come back to this. What are the rules? Can variables still be public/private?


They can be public or private, but they must be static and they must have the [Tunable] attribute.

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Back to top