Jump to content

How do I make my mod remember what variables I last used instead of resetting each time I reload the game?


Recommended Posts

Hi, I have a journeyman's question today.

 

I've made a mod with one variable that cycles through 3 states. How do I make it so that the game remembers which variable I used last time instead of resetting to 0 each time I load the game?

 

I've noticed that mods that save their variables tend to have $id and swimsuit1 and swimsuit2 in their code, so I assume it has something to do with that.

 

Thanks for your help.

Link to comment

I'm just now getting into outfit swapping with 3dmigoto.. but noticed my mod works as you've described.
Shout out to TEDDY for his code... as I learned from his mods. Make sure you have the [Constants] and [Present] block in your mod like this:

 

[Constants]
global persist $var1 = 0   
global persist $var2 = 0
global persist $var3 = 0
global $active = 0

 

[Present]
post $active = 0

Link to comment
5 hours ago, xenofactor07 said:

 

F10 will reload the mod to the game as it was last saved... but his issue is that his mod is reverting back to its original state regardless of his toggled choices.

At least that's how I read his post.

If the mod support it, and when you select desire variables F10 will save it (not just reload)

Link to comment
5 hours ago, xenofactor07 said:

I'm just now getting into outfit swapping with 3dmigoto.. but noticed my mod works as you've described.
Shout out to TEDDY for his code... as I learned from his mods. Make sure you have the [Constants] and [Present] block in your mod like this:

 

[Constants]
global persist $var1 = 0   
global persist $var2 = 0
global persist $var3 = 0
global $active = 0

 

[Present]
post $active = 0

and if you want to lock your mod so as not to change the selected variant by accidentally pressing the key responsible for it (because, for example, another mod also uses it), then add this:

 

[Constants]
global persist $var1 = 0
global persist $var2 = 0
global persist $var3 = 0
global $mod_active = 0
global $slot_active = 0
global $id = 0000000 - your uniqe number

 

[Present]
post $mod_active = 0


[KeySwitchSlot1]
condition = $\mods\_id\id.ini\swimsuit1 == $id && $mod_active == 1
key = ctrl no_shift no_alt 1
type = cycle
$slot_active = 1, 0
run = CommandListSlot1, CommandListSlot0
[KeySwitchSlot2]
condition = $\mods\_id\id.ini\swimsuit2 == $id && $mod_active == 1
key = ctrl no_shift no_alt 2
type = cycle
$slot_active = 1, 0
run = CommandListSlot1, CommandListSlot0


[CommandListSlot1]
Resource\ShaderFixes\help.ini\Notification = ref ResourceSlot1
run = CustomShader\ShaderFixes\help.ini\FormatText
$\ShaderFixes\help.ini\notification_timeout = time + 2.0
[CommandListSlot0]
Resource\ShaderFixes\help.ini\Notification = ref ResourceSlot0
run = CustomShader\ShaderFixes\help.ini\FormatText
$\ShaderFixes\help.ini\notification_timeout = time + 2.0


[ResourceSlot0]
type = Buffer
data = "NAME OF MOD: OFF"
[ResourceSlot1]
type = Buffer
data = "NAME OF MOD: On"

 

[CommandListID]
$\mods\_id\id.ini\swimsuit2 = $\mods\_id\id.ini\swimsuit1
$\mods\_id\id.ini\swimsuit1 = $id

 

 

and for each TextureOverride this:

 

[TextureOverrideBody]
if $\mods\_id\id.ini\swimsuit1 != $id && $\mods\_id\id.ini\swimsuit2 != $id
    run = CommandListID
endif

match_priority = 0
hash = 98fbb3d5

.........

drawindexed = auto
$mod_active = 1

 

now whenever you want to change something in a mod first you have to open it with CTRL + 1/2

and you will need that ID.ini to work

Edited by Yorom
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use