IsharaMeradin Posted February 7, 2019 Share Posted February 7, 2019 Actually, as you have both versions right now, neither one would compile in the CK. In version one it would complain that variable a_01 within the OnPageReset event and draw_a function were undefined. This because the declaration String a_01 = "whatever" resides within the OnConfigInit event. In version two it would complain because you declared the a_01 variable as a string in the empty state but are trying to declare it again within the OnConfigInit() event. And both versions would also complain that you are trying to assign the value of a_01 to Pages[0] array entry prior to a_01 getting any sort of value assigned to it. Corrected variation with additional tweaks: string a_01 event OnConfigInit() ;a_01 = "hello world" ; old version a_01 = "goodbye world" ; new version Pages = new string[2] Pages[0] = a_01 Pages[1] = "Page 2" EndEvent event OnPageReset(string page) if(page == Pages[0]) ;take advantage of the array and check for it rather than specific string draw_a() elseIf(page == Pages[1]) addHeaderOption(a_01) endIf endEvent function draw_a addHeaderOption(a_01) endFunction Link to comment Share on other sites More sharing options...
3aq Posted February 7, 2019 Author Share Posted February 7, 2019 thank you Ishera, and appreciate the corrections/tweaks greatly. apologies, in my haste and as I don't really have a working compiler atm it seems I have mistaken declaring with assignment.. :facepalm:note on array to check, I forgot to mention I used strings to check to demonstrate whether the MCM will properly show version 1 string or version 2 string if a_01 did or did not get assigned between the two versions. Link to comment Share on other sites More sharing options...
3aq Posted February 17, 2019 Author Share Posted February 17, 2019 (edited) Sadly looks like I am back. I've attempted my best at implementing additional pages to MCM updating via Ishara's method unfortunately it doesn't seem to work. It doesn't work even when resetting SKI through console commands. Test starts with Pages, pages, function set at new string[2]. Save. Increase to string[4], Recompile. MCM does not update index.I seriously have no idea how to go about doing this. Help? =( GetVersioning test (not) in actionsource, script, esp, translation in its respective archive.FRUITS v1 - https://ufile.io/axlui Scriptname FRUITS extends SKI_ConfigBase int function GetVersion() return 3 endfunction event OnConfigInit() Pages = new string[2] Pages[0] = "$p_01" Pages[1] = "$p_02" endevent event OnPageReset(string page) If (page == Pages[0]) draw_1() elseIf (page == Pages[1]) draw_2() endIf endEvent event OnVersionUpdate(int a_version) if (a_version > 1) Debug.Trace(self + ": Updating script to version " + a_version) OnConfigInit() endIf endEvent function draw_1() AddHeaderOption("$p_01") endfunction function draw_2() AddHeaderOption("$p_02") endfunction FRUITS v2 - https://ufile.io/z0ywd Scriptname FRUITS extends SKI_ConfigBase int function GetVersion() return 3 endfunction event OnConfigInit() Pages = new string[4] Pages[0] = "$p_01" Pages[1] = "$p_02" Pages[2] = "$p_03" Pages[3] = "$p_04" endevent event OnPageReset(string page) If (page == Pages[0]) draw_1() elseIf (page == Pages[1]) draw_2() elseIf (page == Pages[2]) draw_3() elseIf (page == Pages[3]) draw_4() endIf endEvent event OnVersionUpdate(int a_version) if (a_version > 1) Debug.Trace(self + ": Updating script to version " + a_version) OnConfigInit() endIf endEvent function draw_1() AddHeaderOption("$p_01") endfunction function draw_2() AddHeaderOption("$p_02") endfunction function draw_3() AddHeaderOption("$p_03") endfunction function draw_4() AddHeaderOption("$p_04") endfunction Edited February 17, 2019 by 3aq Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 17, 2019 Share Posted February 17, 2019 If you are going from your example 1 to example 2, the problem is that you have not changed the return value in the GetVersion function. If your first script says that it is version 3, there will be no need to update if you say your second script is also 3. You have to advance that number EVERY time you want the script to be considered an update. Change it to a 4 on the second script and see what happens. Link to comment Share on other sites More sharing options...
3aq Posted February 19, 2019 Author Share Posted February 19, 2019 ahh, here I thought the GetVersion has to be at return 3 as it seems to be the case on all the mods I checked.. on that note would you need to change the number in a_version > 1 ? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 19, 2019 Share Posted February 19, 2019 Not necessarily. After all any newer version will still have a higher value than your initial version. Thus a_version > 1 would still be accurate for the 3rd, 5th or even 100th update. Link to comment Share on other sites More sharing options...
3aq Posted February 20, 2019 Author Share Posted February 20, 2019 gotcha, thanks Ishara =] Link to comment Share on other sites More sharing options...
Recommended Posts