Jump to content

Using mcm ModSettings


Crosstieger

Recommended Posts

I don't know what's going on.

 

I want to save the value of a mcm slider via the mcm ModSettings.

 

This is my slider:

{
	"id": "fGameTimer:Timer",
	"text": "Daytime Timer",
	"type": "slider",
	"help": "Determins how many hours need to pass in order to loose weight.",
	"valueOptions": {
		"min": 1,
		"max": 23,
		"step": 1,
		"sourceType": "ModSettingFloat"
	}
},

and I'm accessing the value like this:

Scriptname AAA_WTFGameTimer extends Quest

import mcm

AAA_WTFCoreScript Property WTFCoreScript Auto Const mandatory

;===================
;= Magic Functions =
;===================

int TimerID = 6
;float fGameTimer = 6.0

float fGameTimer = mcm.GetModSettingFloat("WTTF", "fGameTimer:Timer")

Function WTFGameTimer()
	StartTimerGameTime(fGameTimer, TimerID)
EndFunction

But the compile doesn't like me apperently. It spits out the following error:

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright (C) ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "AAA_WTFGameTimer.psc"...
D:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\AAA_WTFGameTimer.psc(14,19): no viable alternative at input 'mcm'
D:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\AAA_WTFGameTimer.psc(14,22): required (...)+ loop did not match anything at input '.'
D:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\AAA_WTFGameTimer.psc(14,6): Unknown user flag mcm
No output generated for AAA_WTFGameTimer.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on AAA_WTFGameTimer.psc

I don't know what the issue is. I accessed mcm settings before with exactly this method. I basically copy and pasted the code over from a different script of mine that works just fine...

Link to comment
Share on other sites

Id say right away that the MCM documentation does not show mcm.GetModSettingFloat as a valid method. It shows GetModSettingFloat - as you can see in your error, it doesnt know what MCM is...

 

https://github.com/Neanka/MCM_0.1_AS3/wiki/Setting-Types,-Storage-and-Persistence

 

I realize you have an import MCM, but is there actually a source file in your USER folder called MCM.psc with function definitions? Because if that is missing, this could be the problem.

Edited by joerqc
Link to comment
Share on other sites

Id say right away that the MCM documentation does not show mcm.GetModSettingFloat as a valid method. It shows GetModSettingFloat - as you can see in your error, it doesnt know what MCM is...

 

https://github.com/Neanka/MCM_0.1_AS3/wiki/Setting-Types,-Storage-and-Persistence

 

I realize you have an import MCM, but is there actually a source file in your USER folder called MCM.psc with function definitions? Because if that is missing, this could be the problem.

 

The mcm.psc does exist inside Scripts\Source\User. I somehow have to tell the script that the function GetModSettingFloat is part of the mcm.psc and not my own script? If I remove the mcm.*** would the compiler not think that this is a function of my own script and not from a different one?

 

Either way, removing the mcm.** result in the exact same error. Unknow user flag GetModSettingFloat etc..

Edited by Crosstieger
Link to comment
Share on other sites

 

Id say right away that the MCM documentation does not show mcm.GetModSettingFloat as a valid method. It shows GetModSettingFloat - as you can see in your error, it doesnt know what MCM is...

 

https://github.com/Neanka/MCM_0.1_AS3/wiki/Setting-Types,-Storage-and-Persistence

 

I realize you have an import MCM, but is there actually a source file in your USER folder called MCM.psc with function definitions? Because if that is missing, this could be the problem.

 

The mcm.psc does exist inside Scripts\Source\User. I somehow have to tell the script that the function GetModSettingFloat is part of the mcm.psc and not my own script? If I remove the mcm.*** would the compiler not think that this is a function of my own script and not from a different one?

 

Do this:

 

Take out the import... when i used KOframework to reference a function, my scrip looked as this:

 

Function KnockOutActor(Actor akVictim, Actor akAggressor)

If Game.IsPluginInstalled("Knockout Framework.esm")

Bool KoResult = KoFrameworkFunctions.KnockOutActor(akVictim, akAggressor)

If (KoResult)

Debug.Trace(akVictim + " has been K.O.'d !")

EndIf

Endif

EndFunction

 

And at no point did I 'import' the KoFrameworkFunctions.psc file.

 

So perhaps your float declaration on its own is enough without the 'import mcm' at the top of your script.

Edited by joerqc
Link to comment
Share on other sites

Out of curiosity, Crosstieger, now that you have that sorted out, slightly OT but related - have you ever gotten hotkeys in the MCM to actually work in the game? other peoples mods for me work, Ive cloned EVERY step of their setups and yet, though MCM remembers my hotkey setup between game sessions, it never registers the keypress on the formid the sendevent is using. Gotten zero traction asking reg2k for help here, PM and on the wiki site... hopefully you might have some insight.

Link to comment
Share on other sites

Out of curiosity, Crosstieger, now that you have that sorted out, slightly OT but related - have you ever gotten hotkeys in the MCM to actually work in the game? other peoples mods for me work, Ive cloned EVERY step of their setups and yet, though MCM remembers my hotkey setup between game sessions, it never registers the keypress on the formid the sendevent is using. Gotten zero traction asking reg2k for help here, PM and on the wiki site... hopefully you might have some insight.

 

I used hotkey only once now but they always worked for me. I'll PM you my code since it's ot.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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