Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 05.11.2023]

The role-playing games (I-X) that started it all and the various spin-offs (including Dark Messiah).
eilacomeva
Pixie
Pixie
Posts: 119
Joined: 20 Jun 2019

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby eilacomeva » 14 Feb 2020, 18:06

SpectralDragon wrote:Pals, when it comes to Templayer, https://youtu.be/8SzKH5JZIk4

Might take a while for him to show up, so for now, we gotta do what we have.
Oh fook... thank you for the warning.

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 14 Feb 2020, 21:35

eilacomeva wrote:
SpectralDragon wrote:Pals, when it comes to Templayer, https://youtu.be/8SzKH5JZIk4

Might take a while for him to show up, so for now, we gotta do what we have.
Oh fook... thank you for the warning.
Nah. I'm fine. I hope. Just lazy.

Just don't expect anything technical from me.

I'm currently "stuck" on the post from LadySoulCrystal » Feb 12 2020, 14:17
And I will go through the posts that need to be made into Issues / added to the Tracker later. Same for reading a lot of Issue comments. Etc.

On the other hand, I just got 32 GB of RAM (total).

Also I made these two photographs (had to set the exposition manually to be able to catch these. It kept trying to adjust to capture the ground, but I wanted the sky instead :) ):
Image
Image
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
LadySoulCrystal
Leprechaun
Leprechaun
Posts: 13
Joined: 11 Feb 2020
Location: Luminous stone

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby LadySoulCrystal » 15 Feb 2020, 02:26

Templayer wrote: Nah. I'm fine. I hope. Just lazy.

Just don't expect anything technical from me.

I'm currently "stuck" on the post from LadySoulCrystal » Feb 12 2020, 14:17
And I will go through the posts that need to be made into Issues / added to the Tracker later. Same for reading a lot of Issue comments. Etc. ...
Is the post regarding my error code I posted? I don't have the save anymore, (sorry about that) but i can say that before i had the issue I had used several Decks of Fate on my Master Archer who had already happened to be at 255 for her accuracy (just wanted to get them out of my inventory). Its possible i caused an overflow that only triggered when the game attempted to reload. However I can see in the code that it mentioned NPCMercenaries, which at the time i had no followers. Unless Mercenaries refers to anyone in your party, in which case I have a group of five.

I do have some saves before I dropped my Enroth items off and warped to Antigarich, so if you want me to test my Deck of Fate theory I can (same with Magic Lamp, i have some of those too)

User avatar
BMJedi
Conscript
Conscript
Posts: 241
Joined: 06 Jan 2006
Location: Chattanooga, TN

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby BMJedi » 15 Feb 2020, 15:40

Hello, I have a game going where I've started in Enroth, and I'll soon be trying to promote my druid to Archdruid with the Temple of the Moon quest, which requires you to click on the altar inside the Free Haven Temple of the Moon at exactly midnight on a full moon.

I can't see any way to tell the phases of the moon in the MM8 interface. Does anyone know how I can know when to click on the altar in the Temple of the Moon? I'm wondering if I'm going to have to clear the dungeon and then rest in there over and over for a whole month, until I find the night of the full moon through trial and error.
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke, "Clarke's Third Law".

User avatar
LadySoulCrystal
Leprechaun
Leprechaun
Posts: 13
Joined: 11 Feb 2020
Location: Luminous stone

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby LadySoulCrystal » 15 Feb 2020, 17:01

BMJedi wrote:Hello, I have a game going where I've started in Enroth, and I'll soon be trying to promote my druid to Archdruid with the Temple of the Moon quest, which requires you to click on the altar inside the Free Haven Temple of the Moon at exactly midnight on a full moon.

I can't see any way to tell the phases of the moon in the MM8 interface. Does anyone know how I can know when to click on the altar in the Temple of the Moon? I'm wondering if I'm going to have to clear the dungeon and then rest in there over and over for a whole month, until I find the night of the full moon through trial and error.
didn't have any druids but ran through the quest real quick, looks like the Full Moon isn't a requirement. Just clear the dungeon and activate the altar right at 12am, you'll be contacted.

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 18:18

LadySoulCrystal wrote:Per BugTracker:

"Reported by: Piottor » Mar 10 2019, 1:53
Side note: After completing Tomb of Varn, going inside of Control Room, then outside sky textures in many cities started to be...distroted of sorts...usually helped to just sleep in an inn and they gone away...first time I encountered "buggy" graphics so far...idk if it is even related to the VARN or ConRoom..."

Just wanted to let you all know i experienced this skybox glitch after completing Castle Darkmoor and getting the Memory Crystal as well as destroying the Book of Liches. Could just be issues with the game pulling the skybox texture after the player has been in a dungeon for so long. I had to save and exit before my skybox would fix itself (tried saving and reloading but the texture was still skewed).

EDIT:

Unrelated, went to go boot up my game this morning and was hit with this script and then an infinite death cutscene. Earlier save loaded fine, wasn't sure if this needed to be reported as i can't make too much of the script. Looks like something is out of bounds, but what?

Code: Select all

Scripts/Core/RSMem.lua:1383: array index (0) out of bounds [0, -1]

stack traceback:
	[C]: in function 'error'
	Scripts/Core/RSMem.lua:1342: in function '__index'
	Scripts/Core/RSMem.lua:1383: in function '__index'
	...mes\Might and Magic 8\Scripts\General\NPCMercenaries.lua:578: in function 'v'
	Scripts/Core/EventsList.lua:68: in function <Scripts/Core/EventsList.lua:63>

arguments of '__index':
	t = (table: 0x2566f638)
	a = 0
	v = nil

local variables of '__index':
	aorig = 0
	a1 = 0
	n = 0

upvalues of '__index':
	ptr = nil
	u4 = (table: 0x057b5e88)
	GetPtr = (function: 0x057a1a18)
	obj = (table: 0x05a8f958)
	o = 12044876
	assertnum = (function: 0x05770dc8)
	error = (function: 0x0579a080)
	type = (function: builtin#3)
	SetLen = (function: 0x05a7fde8)
	low = 0
	GetLen = (function: 0x05a88320)
	lenP = 12044896
	lenA = (table: 0x057a1ef0)
	count = 5
	size = 4
	_index = nil
	_newindex = nil
	tonumber = (function: builtin#17)
	beyondLen = nil
	f = (function: 0x05b0d1b8)
	format = (function: builtin#91)
	sOutOfBounds = "array index (%s) out of bounds [%s, %s]"
	tostring = (function: builtin#18)
	tostring2 = (function: 0x0579d8a8)
-----------------------------------------------------------------------------------
> 
LadySoulCrystal wrote:I don't have the save anymore, (sorry about that) but i can say that before i had the issue I had used several Decks of Fate on my Master Archer who had already happened to be at 255 for her accuracy (just wanted to get them out of my inventory). Its possible i caused an overflow that only triggered when the game attempted to reload. However I can see in the code that it mentioned NPCMercenaries, which at the time i had no followers. Unless Mercenaries refers to anyone in your party, in which case I have a group of five.

I do have some saves before I dropped my Enroth items off and warped to Antigarich, so if you want me to test my Deck of Fate theory I can (same with Magic Lamp, i have some of those too)
Both have been added to the Bug Tracker and made into GitLab Issues:
Distorted Skybox
Infinite Death Cutscene

Testing would be very nice. :-D :tsup:
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

Khorghakh
Leprechaun
Leprechaun
Posts: 7
Joined: 15 Feb 2020

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Khorghakh » 15 Feb 2020, 18:47

I noticed the minotaur class is restricted to Master in Axe as a Minotaur Lord (weren't they meant to get to Grandmatser?), (expert as a normal Minotaur). I never checked others. Someone made a patch at Nexus, maybe it was a fix for this? I never noticed anything else, but wasn't really looking for anything.
https://www.nexusmods.com/mightandmagicviii/mods/1

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:11

Khorghakh wrote:I noticed the minotaur class is restricted to Master in Axe as a Minotaur Lord (weren't they meant to get to Grandmatser?), (expert as a normal Minotaur). I never checked others. Someone made a patch at Nexus, maybe it was a fix for this? I never noticed anything else, but wasn't really looking for anything.
https://www.nexusmods.com/mightandmagicviii/mods/1
That mod has no description of what it does whatsoever. That guy should have just contacted us.

Also are you aware of Racial Skills? They are meant to replace racial classes (such as the Minotaur and Minotaur Lord classes).

Check the Tracker in my signature for a "manual".

But it does seem like a bug. Yep, just checked.

To hotfix it: Open the file Class Skills.txt inside your installation folder/Data/Tables via GrayFace's TxtEdit
Find the MinotaurLord column and Axe row. Modify M to G
Save & Done. The changes should take effect immediately upon loading the game.

I made a GitLab Issue for it for a proper fix (and probably for Minotaurs too, if they had M and not E in vanilla MM8):
Minotaur Lords cannot GM Axe

Also I've added you as an Bug Catcher inside the Credits Tracker.

Link to the Tracker is down here in my signature.
:down: :down: :down:
Last edited by Templayer on 15 Feb 2020, 19:24, edited 3 times in total.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:18

joanthedark wrote:
cthscr wrote:If by any chance you still have that savegame, can you please share it
Just in case you meant the savefile before unmasking the traitor, where no placeholder text is visible, here it is:

https://www.mediafire.com/file/mvq4rrl5 ... 1.dod/file

I named it 001 just in case you want to compare both savefiles.

Templayer made a backup of the savefile that has the placeholder text in both The Council and The Oracle, although that save focuses more on testing the Blaster damage so it's located in Castle Ironfist, you will have to Town Portal to Free Haven to see it.
Added to the original Bug Tracker report and to the GitLab Issue.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
BMJedi
Conscript
Conscript
Posts: 241
Joined: 06 Jan 2006
Location: Chattanooga, TN

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby BMJedi » 15 Feb 2020, 19:25

@LadySoulCrystal , Thank you very much. That will make it easy.
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke, "Clarke's Third Law".

Khorghakh
Leprechaun
Leprechaun
Posts: 7
Joined: 15 Feb 2020

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Khorghakh » 15 Feb 2020, 19:27

@Templayer aye I did that, and yeh I noticed he didn't post any info on his "patch". Next time I see something I will use your link, apologies about that. Cheers for your reply :) Oh aye, and cheers for this beautiful mod too!
Last edited by Khorghakh on 15 Feb 2020, 19:28, edited 1 time in total.

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:28

cthscr wrote:
joanthedark wrote:Templayer made a backup of the savefile that has the placeholder text in both The Council and The Oracle, although that save focuses more on testing the Blaster damage so it's located in Castle Ironfist, you will have to Town Portal to Free Haven to see it.
Well, skill description indeed says about Attack increase only.
joanthedark wrote:
cthscr wrote:Well, skill description indeed says about Attack increase only.
It might still be worth checking out its numbers, because I also did not notice any difference with its chance to hit.
Added to both the Bug Tracker report and to the GitLab Issue.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:32

joanthedark wrote:Is there any way to choose which place you want to go while changing continents? No matter how many times I reload I cannot seem to be able to teleport to Emerald Island anymore. A console command maybe?
Added to the Suggestion Tracker and as a GitLab Issue.

Choose destination for actual map during continental travel
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:33

cthscr wrote: Note for Templayer: I didn't know that command 5 minutes ago. Manuals are good thing.
Yeah, they are.

As long as you do not have to put entire code-blocks into the console that could have been made into a function. :)
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:35

joanthedark wrote:
cthscr wrote:
joanthedark wrote:Is there any way to choose which place you want to go while changing continents? No matter how many times I reload I cannot seem to be able to teleport to Emerald Island anymore. A console command maybe?

Code: Select all

evt[0].MoveToMap{0,0,0,0,0,0,0,0,"7out01.odm"}
Note for Templayer: I didn't know that command 5 minutes ago. Manuals are good thing.
Thank you for the command!

I believe it is imperative to teleport any parties who started in Enroth or Jadame continents to Emerald Island as soon as they try to Town Portal to Antagarich continent, otherwise you will have stuff like this:

Image

Lord Markham is not in his throne room in Tatalia because we never triggered (or finished) the Emerald Island quest, no idea if it's intentional.

You also miss out on Mr. Malwick's subquest which can only trigger in Emerald Island.

The good thing is that as soon as I entered the command provided by cthscr I got the second MM7 cutscene (Lord Markham speech in Emerald Island's treasure hunt) and all the fetch quests for the hunt were added to my quest log, meaning I can start MM7 as if my first continent choice was Antagarich. Hopefully this also means Lord Markham will be in Tatalia but I'll continue playing later and figure that out.

I would like to know what you guys think about it, should all parties who didn't start in Antagarich be teleported to Emerald Island as soon as they try out any MM7 content? Seems like there will be less headaches this way, otherwise you would be "forced" to always select Antagarich everytime you make a new game or you'll miss out some content.
This is all fully intended behavior, so I won't but this on the Bug Tracker or GitLab.

If not starting in Antagarich, then after spending some time in Antagarich you will get an advertisement for the Scavenger Hunt, and how to get to the Emerald Island.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:42

joanthedark wrote: I would like to know what you guys think about it, should all parties who didn't start in Antagarich be teleported to Emerald Island as soon as they try out any MM7 content? Seems like there will be less headaches this way.
raekuul wrote: Forcing the first TP for a continent to a specific map is a good idea though.
For the Community Branch for this to be toggleable (and non-default) - I am fine with it. We do have a Merge Settings configuration file, after all. But only in the Community Branch. :)

Added to the Suggestion Tracker and as a GitLab Issue.

Forcing the first teleport to a continent to lead to a specific map
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

eilacomeva
Pixie
Pixie
Posts: 119
Joined: 20 Jun 2019

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby eilacomeva » 15 Feb 2020, 19:45

Templayer wrote:
eilacomeva wrote:
SpectralDragon wrote:Pals, when it comes to Templayer, https://youtu.be/8SzKH5JZIk4

Might take a while for him to show up, so for now, we gotta do what we have.
Oh fook... thank you for the warning.
Nah. I'm fine. I hope. Just lazy.

Just don't expect anything technical from me.

I'm currently "stuck" on the post from LadySoulCrystal » Feb 12 2020, 14:17
And I will go through the posts that need to be made into Issues / added to the Tracker later. Same for reading a lot of Issue comments. Etc.

On the other hand, I just got 32 GB of RAM (total).

Also I made these two photographs (had to set the exposition manually to be able to catch these. It kept trying to adjust to capture the ground, but I wanted the sky instead :) ):
Image
Image
All that memory will come in handy with a 32 bit game, I'm sure...
But when I upgraded 4=>20 prices fell down like a couple of months later, I hear prices are better now :D

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:51

eilacomeva wrote:And btw, since some bugs seem to rely on having (or not having) some old savegame, a silly script that I've been using for that purpose:

For those with a unix shell (aka not on windows)

Code: Select all

#! /bin/sh
set -u
# Run under setlock -n or suffer.

printusage() {
        echo "Usage: $0 [-aes]"
        echo "keep snapshot of mm6/7/8 saves"
        echo " -a keeps autosaves"
        echo " -e keeps everything (even \"my first.mm6\")"
        echo " -s keeps only saveNNN"
}

readonly onlySaveNNN='saveNNN.xyz'
readonly includeAutosave='also autosave'
readonly includeEverything='allofthem'
WANTED="$onlySaveNNN"
while getopts ":aesh" Option ; do # autosave etc
        case $Option in
                (a) WANTED=$includeAutosave ;;
                (e) WANTED=$includeEverything ;;
                (s) WANTED=$onlySaveNNN ;;
                (h) printusage ; exit 0;;
                (*) echo >&2 unknown option "$OPTARG" ; exit 100;;
        esac
done
shift $((OPTIND - 1))
test $# -eq 1 || { echo>&2 "Usage: $0 \$Saves -- no autodetect"; exit 100; }
cd "$1" || exit
case "$PWD" in
        (*Saves) ;;
        (*) echo>&2 "give me the Saves directory..."; exit 100;;
esac

# stat(1) is different on BSD/linux...
if stat --help >/dev/null ; then
        timestamp() {
                # FIXME NO WAY to specify timestamp format
                # %y this one is BAD for windows
                # %Y is unreadable (seconds since the epoch)
                stat -c '%y' "$@"
        }
else
        # TODO untested
        timestamp() {
                # -f %m: print mtime
                # -t fmt is like strftime
                stat -t '%F_%T' -f '%m' "$@"
        }
fi

# Not really needed, I just like reflinks.
if cp --help|grep>/dev/null reflink ; then
        copy() {
                cp --reflink=auto -p "$@"
        }
else
        copy() { cp -p "$@" ; }
fi

want() {
        local fname="$1"
        test $WANTED = $includeEverything && return
        case "$fname" in
                (autosave.*) test "$WANTED" = "$includeAutosave" ;;
                (save[0-9][0-9][0-9].*) true ;;
                (*) false ;;
        esac
}

snapshot() {
        local i # puke
        for i in *.mm6 *.mm7 *.dod ; do
                test -e "$i" || continue
                want "$i" || continue
                local dir ts dest
                dir=timeline/"$i"
                test -d "$dir" || mkdir -p "$dir" || exit
                ts="$(timestamp "$i")" || exit
                dest="$dir/$ts $i"
                test -e "$dest" && continue
                echo "bkup $i to $dest"
                #logger "bkup $i to $dest"
                copy "$i" "$dest" || exit
        done
}

trypolling() {
        # as of 3.14-8 inotify --help exits FAILURE
        #inotifywait --help >/dev/null || return
        type inotifywait >/dev/null || return
        while : ; do
                snapshot
                # -t timeout => exit 2, but it's DOCUMENTED to be so :D
                inotifywait -q -t 2687 -e modify . && continue
                e=$?
                test $e -eq 2 && continue
                return $e
        done
}
justdoit() {
        while : ; do
                snapshot
                sleep 13
        done
}

trypolling || justdoit

# mm6 --> mm7 --> dod (of course)
For the remaining 99%, save this as "filename.js":

Code: Select all

// mm678 merge => keep a timeline of saves, to report bugs etc.
// to use a different directory, pass it as the only argument, as in:
//        cscript this-file.js "C:\path\to\game\Saves"
//
// TODO translate to powershell/jscript/whatever is nice to have on windows for non developers
// TODO on windows don't close the cmd window or something
// powershell -ExecutionPolicy Unrestricted -File nameofthisfile
// also, slow startup => jscript/vbscript?
// omg, the JScript docs are horrible!

function getenv(s) {
    var objShell = WScript.CreateObject("WScript.Shell")
    // expands "%PATH%" to $PATH, but "%FOO%" stays "%FOO%"!!!
    var tmp = "%" + s + "%"
    var ret = objShell.ExpandEnvironmentStrings(tmp)
    objShell = null
    if(ret.localeCompare(tmp) == 0)
        return null
    return ret
}
if(getenv("PATH") == null) throw "null PATH"
if(getenv("asdf") != null) throw "asdf"

// smart enough to replace echo with popups if not run with cscript;
// good, but it means we keep getting popups if we run by opening the file :D
function echo(msg) {
	var silent = true;
	if(silent) return
	WScript.Echo(msg)
}

// Modify the locations below to match your setup
// (or pass an argument to this script)
function WINEPREFIX() {
    // *nix => separate $WINEPREFIX in $HOME for each program
    return catfile(getenv("HOME"), "Might & Magic 6+7+8/drive_c/drive_c/Program Files (x86)/3DO/Might and Magic VIII/Saves");
}
function VirtualStore() {
    // windows => %LOCALAPPDATA%\VirtualStore
    return catfile(getenv("LOCALAPPDATA"), "VirtualStore/Program Files (x86)/3DO/Might and Magic VIII/Saves");
}
function savesDirectory() {
    if (getenv("HOME") != null) {
        return WINEPREFIX();
    }
    if (getenv("LOCALAPPDATA") != null) {
        return VirtualStore();
    }
    throw "Saves directory?"
}

function directoryexists(d) {
    var fso = WScript.CreateObject("Scripting.FileSystemObject")
    return fso.FolderExists(d)
}

function flock(path) {
    var fs = WScript.CreateObject("Scripting.FileSystemObject")
    if(!fileexists(path)) {
        fs.CreateTextFile(path)
    }
    var f = fs.GetFile(path)
    // puke!
    var ForReading = 1, ForWriting = 2, ForAppending = 8
    var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
    // windows locks automagically
    // If the lock is already taken, it says "permission denied" TODO catch?
    var handle = f.OpenAsTextStream(ForAppending, TristateUseDefault);
    return handle
}

function popup(msg) {
    var myMsgBox = new ActiveXObject("wscript.shell")
    myMsgBox.Popup(msg)
}

function basename(path) {
    var fso = WScript.CreateObject("Scripting.FileSystemObject")
    // basename("a/b/c.foo") is "c"!
    return fso.GetBaseName(path) + "." + fso.GetExtensionName(path)
}

// 10 => 10; 1=>"01"
function t2(t) {
    if(t < 10) return "0"+t
    if(t>99) throw t
    return t
}

function createTimeline() {
    var timelinedir = "timeline"
    var objFSO = WScript.CreateObject("Scripting.FileSystemObject")
    if (! directoryexists(timelinedir)) {
        objFSO.CreateFolder(timelinedir) // mkdir -p???
    }

    var objFolder = objFSO.GetFolder(".")
    //for(i = 0; i < files.length; i++) -- stupid javascript...
    var files = objFolder.Files // a COLLECTION, not an array...
    // Can you guess how many borked docs there are around?
    //Create an Enumerator object. 
    var myCollection = new Enumerator(files);
    for (; !myCollection.atEnd(); myCollection.moveNext()) {
        var file = myCollection.item() // ABSOLUTE PATH!
        var filename = basename(file)
        if (! wantbackup(filename)) {
            continue
        }
        if (directoryexists(filename)) {
            continue
        }
        var mydir = catfile(timelinedir, filename)
        if (! directoryexists(mydir)) {
            objFSO.CreateFolder(mydir)
        }
        var mtimenumber = objFSO.GetFile(filename).DateLastModified
        // DateLastModified PRINTS like a date, but it's just a number...
        // give me STRONG TYPING DAMMIT!!! or at least typeof()!!!
        var mtime = new Date(mtimenumber)
        var year = mtime.getFullYear()
        var month = t2(mtime.getMonth())
        var day = t2(mtime.getDay())
        var hours = t2(mtime.getHours())
        var minutes = t2(mtime.getMinutes())
        var seconds = t2(mtime.getSeconds())
        var stamp = "" + year + month + day + hours + minutes + seconds
        // XXX windows has 100ns time resolution, unix usually 1ns, FAT 2 seconds...
        var dest = catfile(mydir, stamp + " " + filename);
        if (fileexists(dest)) {
            continue
        }
        echo("bkup " + filename + " to " + dest)
        copyfile(filename, dest)
        // mtime is preserved automagically :D
    }
}

function fileexists(filename) {
    var fso = WScript.CreateObject("Scripting.FileSystemObject")
    return fso.FileExists(filename)
}

function stringEndsWith(s,t) { // don't ask
    return s.length >= t.length && s.substr(s.length - t.length).localeCompare(t) == 0
}
if(stringEndsWith("abc", "b")) throw "abc/b"
if(!stringEndsWith("abc", "c")) throw "abc/c"
function stringStartsWith(s,t) { // don't ask
    return s.length >= t.length && s.substr(0, t.length).localeCompare(t) == 0
}
if(stringStartsWith("abc", "b")) throw "start"
if(!stringStartsWith("abc", "a")) throw "!start"

// ONLY files named "save012.extension", so that eg "my first savegame" is left as is
function wantbackup(filename) {
    var keepAutosaves = true  // probably too much - unless debugging
    var keepEverything = false // backup even "my first game.dod"
    var extensions = ["mm6", "mm7", "dod"] // no "mm8"
    for(i = 0; i < extensions.length; i++) {
        e = extensions[i]
        if(e[0] == '.') {
            throw e
        }
        if (!stringEndsWith(filename, "." + e)) {
            continue
        }
        if (keepEverything) {
            return true
        }
        // regex in JScript???
        if (stringStartsWith(filename, "save")) {
            return filename.length == ("save001." + e).length
        }
        if (keepAutosaves && stringStartsWith(filename,"autosave.")) {
            return true
        }
    }
    return false
}

function catfile(a, b) {
    return a + "\\" + b // XXX
}

function copyfile(orig, bkup) {
    var fso = WScript.CreateObject("Scripting.FileSystemObject")
    fso.CopyFile(orig, bkup, true)
    fso = null
}

function chdir(dir) {
    var objShell = WScript.CreateObject ("WScript.Shell")
    //WScript.Echo("chdir '" + dir + "'")
    objShell.CurrentDirectory = dir
}
function pwd() {
    var objShell = WScript.CreateObject ("WScript.Shell")
    //WScript.Echo("chdir '" + dir + "'")
    return objShell.CurrentDirectory
}

function sleep(sec) {
    WScript.Sleep(sec*1000)
}

function main() {
    savesdir = savesDirectory();
    switch(WScript.arguments.length) {
        case 0: break
        case 1:
            savesdir = WScript.arguments(0);
            break
        default:
            throw "Usage: prog [installationdirectory/Saves]"
    }
    chdir(savesdir)
    if (!stringEndsWith(pwd(), "Saves")) {
        throw pwd()
    }
    // merge vs mm6 vs ... avoid confusion :D
    echo(savesdir)
    WScript.Echo(pwd())
    var fdlock = flock("timeline.lock")
    while(true) {
        createTimeline()
        sleep(13)
    }
}
main()
What both of them do is keep a copy of every version every time you save (assuming you don't save more than once every few seconds, or you may miss a few seconds).
The windows version is especially hideous, I'll deny having written it... if anyone wants to write a more decent version be my guest; just please write it in something that requires as little effort as possible for nontechnical people (that's why I avoided powershell or compiled languages).
Added to the Tutorials section on the Tracker and as a GitLab Issue (this could be added as a feature)

Automatic Save Backups
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 19:58

eilacomeva wrote: All that memory will come in handy with a 32 bit game, I'm sure...
But when I upgraded 4=>20 prices fell down like a couple of months later, I hear prices are better now :D
I got 16 GB (2x8) of RAM almost for free from a friend. Swapped them for 2x4.

Also it might not come in handy for a 32-bit game, but it sure does come in handy for all the billion other applications I am running simultaneously. Usually also rendering h265 13 RF videos through HandBrake by pipelining it via AVFS and a Frameserve from Magix Vegas Pro. Making a queue while having this pipeline for encoding requires a lot of RAM (about 5 GB per file).

And then having 200 tabs open in Firefox, about 4 tabs open in Waterfox (two for uploading files - one to a file sharing service, other to youtube), while running an Ultima shard, a custom WinXP compatible TeamSpeak server and client, constantly updating UO server status via Fling, and about 50 more things that trigger more sporadically.

24 GB RAM was not enough for me. :D :D :D

EDIT: You can all play together on my Ultima server, if you wish. I have coded quite a lot of features for it (that is how I have learned to code, actually). Including sleeping. And basically a "liquid-engine". I unfortunately do not have time to play games though. But it could be cool to get this community to play something together. www.Zerenxess.xf.cz (made in the style of old websites intentionally)

I also have a Patreon (just google my nickname and patreon. You will have to put my nickname into quotes, because otherwise retarded Google changes it automatically to Template and finds crap).

EDIT2: And my Zerenxess website just died. It worked moments ago. WTF? I will have to move it to my main one. :-S
EDIT3: It works again. Seems to have been a provider outage. Might happen again.
Last edited by Templayer on 15 Feb 2020, 20:24, edited 3 times in total.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF

User avatar
Templayer
Devil
Devil
Posts: 1334
Joined: 21 Jan 2013
Contact:

Re: Might and Magic 6, 7, 8 merge based on mm8 engine. [upd. 22.09.2019]

Unread postby Templayer » 15 Feb 2020, 20:13

BMJedi wrote:Hello, I have a game going where I've started in Enroth, and I'll soon be trying to promote my druid to Archdruid with the Temple of the Moon quest, which requires you to click on the altar inside the Free Haven Temple of the Moon at exactly midnight on a full moon.

I can't see any way to tell the phases of the moon in the MM8 interface. Does anyone know how I can know when to click on the altar in the Temple of the Moon? I'm wondering if I'm going to have to clear the dungeon and then rest in there over and over for a whole month, until I find the night of the full moon through trial and error.
LadySoulCrystal wrote: didn't have any druids but ran through the quest real quick, looks like the Full Moon isn't a requirement. Just clear the dungeon and activate the altar right at 12am, you'll be contacted.
Added to the Bug Tracker and as a GitLab Issue.

Archdruid Quest Parity Issues

I love that quote that you have in your signature, BMJedi.
MMMerge Tracker (= Info + Paint Tracker + Missing Features + Suggestions):
https://goo.gl/ui24Bz
Anybody can view or suggest edits.

Dedicated MMMerge Forum (Bug Tracker included): shorturl.at/lryAF


Return to “Might and Magic”

Who is online

Users browsing this forum: No registered users and 46 guests