Not logged inOpenClonk Forum
Up Topic Development / Scenario & Object Development / System.ocg script to maintain compatibility
- - By Fulgen [at] Date 2017-04-17 18:55
In the past, there have been many script changes which cause older scenarios to be broken. For example, the musket's id is now Blunderbuss, but all scenarios using Musket won't work anymore, unless they get updated. Or, the relaunch change breaks every scenario using Rule_Restart or Rule_BaseRespawn.
I propose creating a script file in System.ocg to maintain compatibility with such older scenarios. It would be sad loosing older content because of such changes; for the developer, it isn't so difficult to modify them, but for the player, this is just annoying. Often, scripts to maintain compatibility are not really difficult to write:

static const Rule_Restart = new Dummy {
    Construction = func() {
        GetRelaunchRule()->EnablePlayerRestart(); // Perhaps also setting the relaunch count depending on the game mode
        return RemoveObject();
        }
    }

static const Musket = Blunderbuss;
Parent - By Maikel Date 2017-04-17 19:43
Okay, could you (and everyone) also attach scenarios that don't work to this thread so that we could gather what we need scripts we need to add?
Parent - - By Sven2 [us] Date 2017-04-17 20:19
If it's that simple, I'd say go ahead and add it!

We can always remove old compatibility wrappers after some time.
Parent - By K-Pone [de] Date 2017-04-17 21:27
Then I'd say add a warning (for using deprecated stuff) to compatibility wrappers so the scenario's devs know there's a change in one of the next updates.
Parent - - By Maikel Date 2017-04-18 17:52
var Rule_BaseRespawn001 = CreateObject(Rule_BaseRespawn, 110, 106);
Rule_BaseRespawn001->SetFreeCrew(true);
Rule_BaseRespawn001->SetInventoryTransfer(true);


Does not work with this method.

Also there is no way to warn in the Musket case.
Parent - - By Caesar Date 2017-04-19 13:52

> Also there is no way to warn in the Musket case.


Hm?

static EmittedWarnings = {};
static func WarnOnce(string w) {
  if (!EmittedWarnings[w]) { DebugLog(w); EmittedWarnings[w] = true; }
}


Or so?
Parent - - By Sven2 [us] Date 2017-04-19 16:11
That only solves the "warn only once" case.

The problem with the musket is that "Musket" would just be a static variable pointing to another variable. There's no place to put the warning. We don't have warnings whenever a variable is used.
Parent - By Isilkor Date 2017-04-19 20:42
Should be easy to implement into C4Compiler though, particularly for global variables.
Reply
- By Maikel Date 2017-04-19 19:19
After the discussions here and in IRC I am personally of the opinion we should abandon this effort for now, but should keep it in mind for after the 8.0 release. Then we can enforce it from the start.
Up Topic Development / Scenario & Object Development / System.ocg script to maintain compatibility

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill