Can someone tell me what is wrong with this code? (Mod for the most recent vanilla fnf version) #3132
Answered
by
Geokureli
Super0Teah
asked this question in
Q&A
-
Im trying to add an option to enable a 3 seconds delay everytime i pause the game, i first tried to make the option without any other functionality but i couldn't do anything. im new to this coding language import funkin.modding.module.Module;
import Std;
import funkin.ui.options.OptionsState;
import funkin.ui.options.PageName;
import flixel.util.FlxSave;
import flixel.FlxG;
import funkin.play.PlayState;
import funkin.util.Constants;
class DelayedPauseModule extends Module
{
var save = Null;
var pause:Bool = true;
function bindSave(){
save = new FlxSave();
save.bind("delayedpauseoptions", "Pause3S");
}
function closeSave(){
if(save != null)save.close();
save = null;
}
function new(){
super("Delayed Pause", 1);
bindSave();
if(save.data.pause == null)
save.data.pause = true;
pause = save.data.pause;
closeSave();
}
var inOptions:Bool = false;
override function onStateChangeEnd(event){
super.onStateChangeEnd(event);
inOptions = false;
if(Std.isOfType(event.targetState, OptionsState)){
var prefs = event.targetState.pages.get(PageName.Preferences);
inOptions = true;
bindSave();
prefs.createPrefItemCheckbox("Delayed Pause", "", function(value) {
save.data.enabled = value;
enabled = value;
}, save.data.pause);
}else if(inOptions)
closeSave();
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
Geokureli
May 6, 2024
Replies: 1 comment 1 reply
-
Few things:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Super0Teah
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Few things: