jarr3 Posted February 21, 2025 Posted February 21, 2025 (edited) I have posted this question on VPF and an issue on github as well... Currently it is "meant" that you change your local "vpmkeys.vbs" file to change certain defaults. (keyStagedFlipperL, toggleKeyCoinDoor among others) A serious problem with this is that it gets more and more complicated to do updates of the components, and that you easily can overwrite your local changes to these files on each update. I am thinking on how to allow storing settings to certain variables in a local vbs file, which is only loaded when it exists. Could it be possible? This is what I finally ended up with doing: (in WPC.vbs, Bally.vbs and so on) Private Sub LoadCore On Error Resume Next If VPBuildVersion < 0 Or Err Then Dim fso : Set fso = CreateObject("Scripting.FileSystemObject") : Err.Clear ExecuteGlobal fso.OpenTextFile("core.vbs", 1).ReadAll : If Err Then MsgBox "Can't open ""core.vbs""" : Exit Sub ExecuteGlobal fso.OpenTextFile("VPMKeysCustom.vbs", 1).ReadAll : If Err and Err.Number <> 53 Then MsgBox "Error loading your custom ""VPMKeysCustom.vbs"": " & Err.Number ExecuteGlobal fso.OpenTextFile("VPMKeys.vbs", 1).ReadAll : If Err Then MsgBox "Can't open ""VPMKeys.vbs"":" & Err.Number: Exit Sub Else ExecuteGlobal GetTextFile("core.vbs") : If Err Then MsgBox "Can't open ""core.vbs""" : Exit Sub ExecuteGlobal GetTextFile("VPMKeysCustom.vbs") : If Err and Err.Number > 0 Then MsgBox "Error loading your custom ""VPMKeysCustom.vbs"":" & Err.Number ExecuteGlobal GetTextFile("VPMKeys.vbs") : If Err Then MsgBox "Can't open ""VPMKeys.vbs"":" & Err.Number: Exit Sub End If End Sub And then in VPMKeysCustom.vbs ' Changing the defaults from VPMKeys.vbs Const toggleKeyCoinDoor = False Const inverseKeyCoinDoor = True What happens here is that before loading VPMKeys, it will load VPMKeysCustom and here you can define the values to your constants. In VPMKeys there is an "On Error Resume Next" statement, so that any exception regarding already defined values is ignored... You can find these tests in my fork on GitHub What do you think? Edited February 21, 2025 by jarr3 Added link to github
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now