Jump to content

Mod Installer


Recommended Posts

I saw that some members posted some mods for the vanilla WPI.

But with the release of the new version which is not compatible with the older themes, I had to redo all my modifications... and they were not few ...

So I came up with the idea of making a mod installer. I'm only going to do this if you people are requesting it because there are at least 2 days of work for that.

So, if anybody finds this useful, post here and I'll get to work :thumbup

Edited by sadicq
Link to comment
Share on other sites


WPI Mod Installer [bETA]

Important: Works with absolutely any (text) file, no WPI paths / vars being hardcoded in the source. Download the source and modify it to suit your own needs.

[06.16 00:20] Code rewritten from scratch.

This script will read all the info it needs from a text file located in the same directory with it and modify the WPI source accordingly. The modification file must have the .mod extension.

Basically, it can be use for any other file to be edited.

Let's get to the instructions:

Put the script in a folder named "MOD Installer" under the WPI root. (If you don't like the name you can use another one).

Put in the same folder all your mods you want to install (the .mod files). Run the script.

In the upper side of its GUI, you will the list of the mods. Choose one and click Process.

If anything goes fine, you will see a line like this in the right side of its GUI:

Success | Completed editing file ...

for each file that was modified.

Then press Overwrite.

If this actions is ok, the installation was succesful and in the right side you will see a line like this one:

Completed | The program finished copying your files

If something goes wrong along the install of a mod, you will see an error message and the install will be stopped:

Error | File could not be found: ...

Note that this program is not directly modifying your files, but modifying a copy of each one and then overwriting the orginal ones only if the install was successful and the user wants to do that.

That's it with the installation.

Now, here comes the interesting part about writing mods.

Any mod must be an .mod file.

Any mod must start with a template header:

[WPI5 MOD NAME]
The name of your mod.
[DESCRIPTION]
blah ... about the mod of course
[VERSION]
1.0
[AUTHOR]
whoever wrote it

Next, each operation must be declared as a section of the ini. Including the header sections, the accepted sections are:

[WPI5 MOD NAME] A line containing the name of the mod

[DESCRIPTION] A line containing the description of the mod

[VERSION] A line containing the version of the mod

[AUTHOR] A line containing the author's name

[FIND] A line/group of lines that can be searched for and then replaced/modified ..

[FINDLINE] A bunch of text / a single line that can be searched for

[ADDBEFORE] A line/group of lines to add before a previously found text/line

[ADDAFTER] A line/group of lines to add after a previously found text/line

[REPLACE] A line/group of lines to replace a previously found text/line

[MODEND] A line that marks the end of the mod

[OPEN] A line that marks the beggining of a new file

Examples:

[WPI5 MOD NAME]
The name of your mod.
[DESCRIPTION]
blah ... about the mod of course
[VERSION]
1.0
[AUTHOR]
whoever wrote it

[OPEN]
Themes\Glossy\wpi.htm
[FIND]
<head>
[ADDBEFORE]
<beforetest>
[FIND]
<head>
[ADDAFTER]
<aftertest>
[FIND]
<body
[REPLACE]
<booody
[FIND]
<script type="text/javascript">
sizer();
</script>
[REPLACE]
<script type="text/javascript">
sizer();
</script>
[FINDLINE]
<body
[REPLACE]
<body>
[MODEND]

Let's explain each statement (I'll skip the header):

[OPEN]
Themes\Glossy\wpi.htm

It tells the program where to execute the following actions (once a new [OPEN] statement is found, all further statements will be executed on that file).

[FIND]
<head>

Finds all the occurances of the <head> text in the file.

[ADDBEFORE]
<beforetest>

Adds before each of the previous found strings the <beforetest> text.

[FIND]
<head>

Finds all the occurances of the <head> text in the file.

[ADDAFTER]
<aftertest>

Adds before each of the previous found strings the <aftertest> text.

[FIND]
<body

Find all the <body strings in the document (the exact match, case insensitive).

[REPLACE]
<booody

Replaces all the previous found results with this: <booody

[FIND]
<script type="text/javascript">
sizer();
</script>

Find all exact matches for the text (even the tabs, spaces, end-lines etc)

[REPLACE]
<script type="text/javascript">
sizer();
</script>

Replaces all the previous found results with this text ...

[FINDLINE]
<body

Find the line(s) that contain(s) the text <body .So, you can't use multi-line text with this one.

[REPLACE]
<body>

Replaces the whole line previously found with the text.

[MODEND]

The end of the mod.

I hope that's enough and I did not forget anything.

This is beta software, so use it at your own risk.

WPI_mod.au3

WPI_mod.exe

Edited by sadicq
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...