[Mods] Rehash Mods Button

Discussion in 'Suggestions' started by FaxCelestis, May 18, 2012.

  1. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Right now, you have to quit the game and reload it entirely to rehash mods into the game. I'd really appreciate a "rehash" button put on the New/Load Game page that would reload all mod files.
     
  2. OmniaNigrum

    OmniaNigrum Member

    I for one am unsure what you mean by this FaxCelestis. Could you explain what this is supposed to do? Are there mods that load and at some point unload for some reason that would require such a step?
     
  3. Daynab

    Daynab Community Moderator Staff Member

    He means installing mods and refreshing so the game knows they're installed, without quitting the game.
     
  4. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    Or making changes to one.
     
  5. Glazed

    Glazed Member

    I would like something similar, but much better. Rather than reload the mods from XML at the start screen, provide a few new command line arguments to help modders.

    Code:
    "Dungeons of Dredmor.exe" -newgame -difficulty gr -rotdg -pd -skills 1 2 3 4 10 20 "Some Named Skill" -name "Character Name"
     
    "Dungeons of Dredmor.exe" -loadgame "Character Name"
    or maybe
    "Dungeons of Dredmor.exe" -loadgame
    
    • -newgame: If specified the game immediately launches into a new game instead of showing the splash screen. None of the other options do anything if this is not present.
    • -loadgame: specifies a name of a saved game to load as an alternative to using -newgame. If it's simpler, this could just load the most recent save.
    • -difficulty: one of: ee, dm, gr to select a difficulty. Defaults to dm.
    • -rotdg: If present the new game includes RotDG.
    • -pd: If present the game is started with permadeath on.
    • -skills: a space-delimited list of skill IDs or skill names. Up to 7 can be specified. If fewer than 7 are specified then the missing ones fill in with random skills which lets you just specify the skillname or ID of the mod you're working. If it's not specified at all, you just get 7 random skills. Any skills that aren't found are just replaced by random ones.
    • -name: specifies a character name. Defaults to "Adventurer".
    Then you can just use Super-F4 to end the DoD process, tweak your mod, then run a shortcut or batch file. The turnaround time would be very short, removing a lot of the tedium of testing mods.
     
    mining, OmniNegro, Kazeto and 2 others like this.
  6. Nicholas

    Nicholas Technology Director Staff Member

    Some of this already exists. From the parse code:

    Code:
        for (int i = 1; i < argc; i++)
        {
            if (!_strnicmp(argv[i], "-docs", strlen("-docs")))
            {
                void WriteDocs(FILE* fp); // roomrw.cpp
                WriteDocs(stdout);
                exit(0);
            }
            if (!_strnicmp(argv[i], "-debug-flag", strlen("-debug-flag")))
            {
                debugFlag |= DEBUG_FLAG_ANY;
                CreateDebugConsole();
            }
            if (!_strnicmp(argv[i], "-testroom", strlen("-testroom")))
            {
                i++;
                playerRoomTestName = argv[i];
                playerRoomTest = TRUE;
            }
            if (!_strnicmp(argv[i], "-wizardroom", strlen("-wizardroom")))
            {
                i++;
                wizardRoomTestName = argv[i];
            }
            if (!_strnicmp(argv[i], "-x", strlen("-x")))
            {
                i++;
                playerRoomTestStartX = atoi(argv[i]);
            }
            if (!_strnicmp(argv[i], "-y", strlen("-y")))
            {
                i++;
                playerRoomTestStartY = atoi(argv[i]);
            }
     
            if (!_strnicmp(argv[i], "-debug-flag-loads", strlen("-debug-flag-loads")))
            {
                debugFlag |= DEBUG_FLAG_LOADS;
            }
            if (!_strnicmp(argv[i], "-debug-flag-key-bindings", strlen("-debug-flag-key-bindings")))
            {
                debugFlag |= DEBUG_FLAG_KEY_BINDINGS;
            }
            if (!_strnicmp(argv[i], "-debug-flag-room-scripts", strlen("-debug-flag-room-scripts")))
            {
                debugFlag |= DEBUG_FLAG_ROOM_SCRIPTS;
            }
            if (!_strnicmp(argv[i], "-debug-flag-audio", strlen("-debug-flag-audio")))
            {
                debugFlag |= DEBUG_FLAG_AUDIO;
            }
            if (!_strnicmp(argv[i], "-w", 2))
            {
                extern BOOL useFullscreen;
                useFullscreen = FALSE;
            }
            else if (!_strnicmp(argv[i], "-res-1024", strlen("-res-1024")))
            {
                resX = 1024;
                resY = 768;
            }
            else if (!_strnicmp(argv[i], "-no-initial-config", strlen("-no-initial-config")))
            {
                enableInitialConfig = FALSE; // don't show initial config dialog
                extern bool firstTimeRun;
                firstTimeRun = TRUE; // don't wait to show menu
            }
            else if (!_strnicmp(argv[i], "-startuptime", strlen("-startuptime")))
            {
                logLoadProgress = true; // show startuptime information
            }
    //        else if (!_strnicmp(argv[i], "-n", 2))
    //        {
    //            enableMusic = FALSE;
    //            enableSound = FALSE;
    //        }
    #if !defined(__IPHONEOS__)
            else if (!_strnicmp(argv[i], "-opengl", 7))
            {
                useOpenGLFramebuffer = TRUE;
            }
    #endif
            else if (!_strnicmp(argv[i], "-nomusic", strlen("-nomusic")))
            {
                enableMusic = FALSE;
            }
            else if (!_strnicmp(argv[i], "-nosound", strlen("-nosound")))
            {
                enableSound = FALSE;
            }
    #ifdef OS_WIN32       
            else if (!_strnicmp(argv[i], "-directx", 8))
            {
                SDL_putenv("SDL_VIDEODRIVER=directx");
            }
    #endif
     
    #ifdef STEAM_BUILD
            else if (!_strnicmp(argv[i], "-nukesteamcloud", strlen("-nukesteamcloud")))
            {
                extern BOOL nukeSteamCloud;
                nukeSteamCloud = TRUE;
            }
    #endif
     
    #if defined(STEAM_BUILD) && defined(MOD_SUPPORT)
            else if (!_strnicmp(argv[i], "-publisher", strlen("-publisher")))
            {
                runSteamworksPublisher = TRUE;
            }
    #endif
     
        }
    
    and later on - these are the ones you want:

    Code:
        for (int i = 0; i < argc; i++)
        {
            std::string arg = std::string(argv[i]);
            if (startswith(arg, "-player-male"))
                player->gender = 0;
            else if (startswith(arg, "-player-female"))
                player->gender = 1;
            else if (startswith(arg, "-player-last-build"))
            {
                player->lastChoicesBuild = TRUE;
                player->randomSkillsBuild = FALSE;
                void SelectLastSkills(std::vector<int> &selectedSkills); // skillsmenu.cpp
                SelectLastSkills(actuallyChosenSkills);
            }
            else if (startswith(arg, "-player-random-build"))
            {
                player->lastChoicesBuild = FALSE;
                player->randomSkillsBuild = TRUE;
                SelectRandomSkills(actuallyChosenSkills);
            }
            else if (startswith(arg, "-player-difficulty="))
            {
                int difficulty = atoi(arg.substr(strlen("-player-difficulty=")).c_str());
                if (0 <= difficulty && difficulty <= 2)
                    player->difficulty = difficulty;
            }
            else if (startswith(arg, "-player-permadeath="))
            {
                int permaDeath = atoi(arg.substr(strlen("-player-permadeath=")).c_str());
                if (0 <= permaDeath && permaDeath <= 1)
                    player->permaDeath = permaDeath;
            }
            else if (startswith(arg, "-player-quickie="))
            {
                int quickie = atoi(arg.substr(strlen("-player-quickie=")).c_str());
                if (0 <= quickie && quickie <= 1)
                    player->quickie = quickie;
            }
            else if (startswith(arg, "-player-name="))
            {
                player->name = arg.substr(strlen("-player-name="));
            }
            else
            {
                misses += 1;
            }
        }
     
        if (misses == argc)
        {
            // no "-player..." flags in parameters, so don't build a player from parameters
            delete player;
            return NULL;
        }
    
    I thought I documented this somewhere, but evidently not.
     
    mining, Glazed and OmniNegro like this.
  7. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    ...so -debug-flag -player-last-build -player-female would start me in debug mode with the previous build I used as a female character?
     
  8. Nicholas

    Nicholas Technology Director Staff Member

  9. Nicholas

    Nicholas Technology Director Staff Member

    ... I think. This code was left in the codebase by a previous contractor, so it's sort of lurking around because it was *his* set of debug tools. If it doesn't work, holler and I'll beat it up with a stick or something...
     
    OmniNegro likes this.
  10. FaxCelestis

    FaxCelestis Will Mod for Digglebucks

    I shall do SCIENCE!
     
  11. Glazed

    Glazed Member

    This is fantastic news!
     
  12. Glazed

    Glazed Member

    A preview of what is to come, to make all of this easier:

    snap004976.png
     
    SkyMuffin, OmniNegro, Daynab and 3 others like this.
  13. Glazed

    Glazed Member

    It could use a -player-rotdg=0 or 1 option.
     
    OmniNegro and FaxCelestis like this.
  14. Glazed

    Glazed Member