Sunday, June 19, 2005

Bloody hellfire!

It is absolutely amazing how one little search can open up one great huuuuge whopping door that changes your project (and possibly the next few months of your life)... the ol saying "looking for one thing may lead you to another” is quite appropriate here methinks.

Ok, basically last night, having gone through the entire Morrowind mod maker's bible AND the customisation guide AND scripting for dummies (some 1000+ pages of reading between the lot of em), I finally got round to facing up to my fear about compiled scripts & whether Morrowind needed them or not.

My plan all along has been to use an external program (Python, C++ exe whatever) to edit a plug in ESP file that Morrowind would load up. The external program would edit particular parts of the esp plug in file to reflect whatever data was gathered by the badge part of this project. In particular, it was most likely that the external program would have to edit some of the scripts contained in the esp file (as in change variables that are used in scripts that are embedded in the Morrowind program- these scripts would be launched internally in the game and would change the players stats or whatever in game )... it'd work like this:

1) Data from hardware is read into external program
2) External program makes decisions based on data
3) External program edits a plug in esp file (most likely through hex)
4) The parts of the esp file that are edited are internal Morrowind game scripts (the external program changes some of the values of the variables used in the scripts)
5) The game launches, opens the esp file, runs the scripts contained in the esp file and the now altered variables get fed into the game engine

It's kinda like using the embedded scripts in the esp files as a Trojan horse to get the external data directly into the game.... the game doesn’t allow reading of external files from game scripts sooo there's no other choice really!!!

Anyway, the main concern with this approach was the way that the esp files stored their internal game scripts. They seemed to store them twice- as in, if the esp file contained a single script, it was stored in the esp file once, in plain English that a person can read, BUT!!! more importantly, it also stores a compiled version of the script which is written in computer language...

SO!! The problem- if the game script in the esp file needed to be edited, exactly which one in the esp file needs to be edited? As in do you edit the plain English version or edit the compiled version.

Well, last night, after a little bit of investigation, my hopes were completely crushed when I found out that the game only cared about the compiled (computer language) version of the script- you could edit the English version of the script contained in the esp file to your heart’s content but, when the game reads in the esp file, it will completely ignore the English version and go straight to the compiled version.... see here for details.

In plain English: If I wanted my external program to edit a script contained in an esp file, I would have to edit it's compiled version in the esp file... through hex....

Just to get this across: Here's a sample Morrowind game script that would be contained in an esp file:




Here's it compiled in hex




Needless to say I retired to bed at that point and had a big cry at the thought of the bashing that my brain was going to get trying to mess with compiled scripts through hex.

ANYWAY!!!! Today I decided to check up on this stuff and, thank the gods, there are plenty of genius' out there who have been messing with .esp files for ages (such as the almighty Dave Humphrey) who have painstakingly put together a list of compiled script functions... i.e., a way of translating compiled script to english and visa versa... which takes about 1 years work off the project. (See the end of this page for details)

SOO!! chancing my arm, I checked to see whether there were any MW script compiler programs available that could take care of the whole compiling thing for me... there doesn’t seem to be any available BUT!!! the search led me to a marvellous new set of Morrowind modding pages that were created by the real hardcore modders ANNNND!!!, them happening to be computer programming genius' an all, they got bored of being restricted by the original Morrowind scripting functions. So what do they do? They go and create their own set of functions that supplement the original game... they've made their own kinda "additional" exe that has a talk with the original Morrowind game exe and informs it that it WILL understand and use these new functions that these guys created (or else it's gonna get really hurt) so it's kinda like a patch for the game that adds on butt loads of scripting power (less restrictions on what the game scripts can do)... and this was all unofficially made for free... my hat is seriously off to these guys- respect! **bo**

Anyway- what can some of these extra functions do and how do they relate to my compiling worries? Well, one of the extra functions that the additional exe allows is... READING AND WRITING FROM THE DISC!!!!

**Hallelujah chorus, fireworks etc.**

SO!! this marvellous little thing should allow me to completely bypass having to hack into and edit the esp files as I can just get the game scripts contained in the esp to read directly from the disc! As in, I'll still have to get the external program to read the hardware data but instead of overwriting the scripts in the esp files, the external program will just have to create a text files or the like that the game script will read in on it's own... no overwriting of compiled scripts in hex needed!!!

WOO HOO!!!

Ahem- needless to say I'm just a smidgen on the relieved side... I just hope that I'm not jumping the gun here- I've just been reading through the readme files quite quickly while giggling nervously so I'm ASSUMING that the extra functions can read from text files & whot not... fingers crossed!!!

Anyway, the main links to this marvellous stuff are:

Cdcooley's Page
and
Morrowind Online (amazing mod if it works- adds online multiplayer stuff to Morrowind!)

God bless the Morrowind modding community anyway- bloody genius' the lot of em!!!

0 Comments:

Post a Comment

<< Home