Back to main page
''''''''''''''''''''''''''''''''''''''''''''''''''''
' tForum Mod Installer (tMI) '
' (© 2003 tForumDevTeam) '
' '
' Version: 0.1.3 (alpha) '
' Author: Chris "Toxic" Hellings '
' Date: August, 23rd, 2005 '
' Homepage: http://tforum.hellings.info/tmi '
' Support: http://tforum.hellings.info/forum '
' '
' WARNING: Always backup your files before using '
' tForum Mod Installer! '
' '
''''''''''''''''''''''''''''''''''''''''''''''''''''
0. Disclaimer:
This is alpha software. If you want to use it, use it on your one risk.
1. Introduction:
tForum Mod Installer (tMI) can install a mod into your tForum. It needs a
mod data file with the mod information in a special format. If some
instructions of the mod data file can't be done automatically, a file called
like the mod data file, only with a manual before the name, will be created
in which you can find all instructions you have to do manually.
2. Installing a mod:
Backup your tForum files. Run tmi.vbs by doubleclicking it and the path to
your tforum. After that enter the name of the mod data file. If tMI has
created a manual file, open that file and do the instructions manually.
3. Mod Data File Format:
All lines beginning with a # will be considered as a command, all the other
lines will be considered as data.
Note: I had no time to write an example file for all the new commands. Only
some of the new commands can be found in the example.txt I included.
This version understands the following commands:
#COMMENT
data
COMMENT doesn't do anything. All data between COMMENT and the next command
is simply ignored.
#TITLE
data
Sets the title of the mod which will be installed. TITLE accepts only one
data line, if too many lines are given, they will be ignored.
#INFO
data
Shows the specified data in a message box to the user. INFO accepts 255
characters of data, if too many characters are given, they will be ignored.
#IF
path/file.ext
data
commands & data (then-part)
#ELSE
commands & data (else-part)
#ENDIF
#IFNOT
path/file.ext
data
commands & data (then-part)
#ELSE
commands & data (else-part)
#ENDIF
IF/IFNOT accept any number of data lines. The first line has to be a
filename.
IF checks if the file exists and if the specified data can be found in
the file. If yes, the commands directly after IF (then-part) will be
executed, if not the commands after ELSE (else-part) will be executed.
IFNOT does it exactly the other way round.
ELSE is optional, if you don't need an else-part, just don't write ELSE.
ENDIF is necessary.
BE CAREFUL!!! by contrast to programming languages you can not put
another IF/IFNOT/IFFILE/IFNOTFILE inside a then-part or else-part!!!
#IFFILE
path/file.ext
#IFNOTFILE
path/file.ext
IFFILE/IFNOTFILE work exactly like IF/IFNOT but they don't check for
any content. They only check if the given file exists. IFFILE/IFNOTFILE
accept one line of data which is a filename.
BE CAREFUL!!! by contrast to programming languages you can not put
another IF/IFNOT/IFFILE/IFNOTFILE inside a then-part or else-part!!!
#CONDITION (deprecated!)
path/file.ext
data
CONDITION accepts any number of data lines. The first line has to be a
filename. CONDITION checks if the file exists and if the specified data
can be found in the file. If not the installation will be canceled with
an error message.
BE CAREFUL!!! Condition is deprecated. It is only in this version for
compatible to old mod data files. In future versions it will perhaps no
longer exist, so please use the following code instead:
#IFNOT
path/file.ext
data
#INFO
data, e.g. Condition not fullfilled. etc.
#CANCEL
#ENDIF
#QUESTION
data
Shows the specified data in a message box to the user and give the user the
possibility to answer with yes or no. QUESTION works like IF, if the user
chose "yes", the then-part will be executed, if the user chose "no", the
else part will be executed. QUESTION accepts 255 characters of data,
if too many characters are given, they will be ignored.
BE CAREFUL!!! the QUESTION command has been changed in 0.1.0. to use an old
style question you now have to type:
#QUESTION
data
#ELSE
#CANCEL
#ENDIF
#OPEN
path/file.ext
All the following instructions are done in the specified filename. OPEN
accepts only one data line, if too many lines are given, they will be
ignored.
#FIND
data
Finds the specified data in the file. FIND accepts any number of data lines.
The found text can then be manipulated with other commands. If FIND is
followed by another FIND command, the second search will start at the
position of the found string of the first search.
#REPLACE
data
Replaces the result of the last FIND command with the specified data.
REPLACE can be used only after a FIND command. REPLACE accepts any number of
data lines.
#ADDAFTER
data
Adds the specified data lines after the result of the last FIND command.
ADDAFTER can be used only after a FIND command. ADDAFTER accepts any number
of data lines.
#ADDBEFORE
data
Adds the specified data lines after the result of the last FIND command.
ADDBEFORE can be used only after a FIND command. ADDBEFORE accepts any
number of data lines.
#ADD
data
Adds the specified data lines at the end of the opened file (before ?>)
ADD doesn't need a a FIND command. ADD accepts any number of data lines.
#DELETE
Deletes the lines found with the previous FIND command. DELETE can be used
only after a FIND command. DELETE doesn't need any data lines (they will be
ignored).
#CREATE
path/file.ext
data
CREATE accepts any number of data lines. The first line has to be a
filename. CREATE the specified file and writes the specified data into it.
If the file already exists, tMI will do nothing and add the whole CREATE
block to the action file.
#CREATEREPLACE
Just like CREATE but existing files will be replaced without a promt.
#COPY
path/file.ext
COPY accepts one data line which has to be a filename. The specified file
will be copied from the directory of the mod data file to the forum dir.
If the file already exists in the forum directory, tMI will do nothing
and add the whole COPY block to the action file.
#COPYREPLACE
Just like COPY but existing files will be replaced without a promt.
#SQL
data
SQL accepts any number of data lines. The data has to be sql queries
seperated by semicolons. tMI will create a php file which can be uploaded
to the server and which will run the sql queries specified in data when it
is executed.
#MANUAL
data
#ENDMANUAL
Accepts any number of data lines. Data is copied directly to the manual
file.
#END
Stops the installation showing a success message. It can e.g. be added at
the end of the mod data file but it is optional. It can also be usefull in
combination with IF, IFNOT or QUESTION
#CANCEL
Stops the installation showing a cancel message. Can be usefull in
combination with IF, IFNOT or QUESTION.
4. Changelog
Changes in 0.1.3:
- changed the SQL command to fit for latest tForum version
- updated the URLs of homepage and support forum
Changes in 0.1.2:
- changed the SQL command to keep the ' in '.$sql->tbl_prefix.' untouched
- fixed a bug which let tMI search for parts of a line
- changed tmi to automatically asume .tmi if modfile extension is missing
- added command: #DELETE,#CREATEREPLACE,#COPYREPLACE
Changes in 0.1.1:
- fixed some essential bugs when tMI runs from another directory than the
forum dir
- added command: #COPY
Changes in 0.1.0:
- made it possible to run tMI from another directory than the forum dir
- better user interface (at least a bit)
- fixed a display bug when the install condition was not fulfilled
- changed the extension of the manual file to .txt even if the mod data
file has another extension
- added commands: #IF,#IFNOT,#ELSE,#ENDIF,#IFFILE,#IFNOTFILE,#CREATE,
#MANUAL,#ENDMANUAL,#SQL
- changed the #QUESTION command to work like #IF instead of only allowing
to cancel with the question
- marked the command #CONDITION as deprecated
Changes in 0.0.3:
- changed the script to work with mod data files in windows and unix format
- changed the script to use \# at the beginning of a line as # data
Changes in 0.0.2:
- fixed a problem with blank lines being ignored
- added commands: #COMMENT,#TITLE,#INFO,#QUESTION,#CONDITION,#ADD,#END,
#CANCEL
- added some msgboxes to tell the user what's happening
- added if check if the mod data file exists
- added a message telling the user that the script has been finished and
how (normal,created manual file,canceled)
- changed the code to make it write commands it doesn't understand into the
manual file
- changed the file name of the manual file to origname_manual.txt
- moved some code into functions to simplify the script code
5. Known Issues and TODO List:
- A bit more error handling has to be added
- User interface still needs improvements
- Write ignored data (e.g. too many lines after OPEN) into manual file
- Replace only if the searched data can be found only once in the file
- Auto backup: Backup each file before changing anything
- Improve Version Checking
|