========================================================================
       CONSOLE APPLICATION : KSSC - Kaiser's Strife Script Compiler
========================================================================
email: svkaiser@gmail.com

UPDATES - 
1.0 - Initial release
1.1 - Fixed output directory. Output file will automatically be named as the input file. Output
file will be generated where the input file is located. Updated PrintTitle()
1.2 - Added token for LOG. Added display of tokens being written as it is compiling. Simplified compiler to compile only used tokens. Rewritten script structure.
1.3 - Revised compiling code, updated script format, more syntax error checks. Added a new option that will allow users to decompile a script lump. Simply type "-decompile" after you've specified the file patch. The decompiled script text will be outputed as "nameofyourfile.txt".


KSSC is a script compiler for Rogue Software's Strife with support for Vavoom, Zdoom and SvStrife. 
To compile a script, drag and drop a text file on KSSC.exe to compile it into a binary lump file.
Output file will be the named whatever your input file is.
To use the script for your wad, rename the lump to SCRIPTXX where
XX is the number of the map you want to use it on. For example if you wish to use it on Map02, then rename the script to SCRIPT02.lmp.
Simply import the lump into your wad after your done renaming.

The source code is included and you may do whatever you want with it as long you follow these rules. Provide credit that I am the oringinal creator and also do not distribute this file for profit.


*****Introduction to making Strife Scripts******
In Strife you have the ability to talk to NPC's such as Peasants, Beggars, and Acolytes,
when you talk to them you are given a a dialouge screen which displays the name of that
character, the picture of that character, the text that person says, and along with that you are
given multible choices to reply. Other NPC include merchants and shopkeepers where you
can buy items and weapons. All of this is done with Strife's scripting system, and as complex
as it is, the script itself is very simple, even when compiled.

*****Strife Script Breakdown******
In scripts, they are stored as dialog blocks for a NPC, each NPC can have multible dialog blocks, and each block sets the text, name, choices etc for that NPC.


Each dialog block is divided into two sections: NPC info and Choice info. NPC info is used for the name, voice, panel, item thats droped, and dialog text for the NPC. While the Choice info describes the various choices, items to check/buy, and used to jump to the next dialog block.

When a NPC jumps to the next block, it displays another set of text/info for the NPC.

The big change to 1.2 is that users no longer have to enter tokens that they don't use, before for example, if a NPC doesn't have an item to drop, the user still had to enter the token DROP with a value of 0. In 1.2 its automatically counted as 0 if the user doesn't add this token. This saves time and allows the user to enter only the tokens that actually get used.

Here are some of the tokens you must specify in the script.
Basic stuff:
# - Comment
&& - Quote. Note, you don't have to use quotes for strings with no spaces
To make a blank string, add "&&"

NPC INFO
------------
$MOBJ 		- Mobj ID for the NPC
DROP 		- Mobj ID of the item to drop when killed
IF_ITEM 		- Item to check
GOTO 		- Dialouge to jump to if IF_ITEM passes
NAME 		- Name of NPC (16 character limit)
VOICE 		- Voice file to play (8 character limit)
PANEL 		- Panel to display (8 character limit)
DIALOG 		- Text to display (320 character limit)


CHOICE INFO
-------------
Note when writing choices, you must start off by adding the '{' token followed by these choice options:
TEXT 		- Text for that choice (32 character limit)
GIVEMOBJ 	- The mobj ID item to give when the player selects this choice. This option is always called when the player selects the choice. To avoid this option from being called, you must specify a -1 for the value.
IF_HAS 		- Item to check when selecting the choice. Followed after the item #, you must specify how much of that item is required. To do so you must add the '*' followed by the number amount. EX - (IF_HAS 168 * 20 		-this means you must have 20 of item # 168)
YESTEXT		 - the text to display on the hud when choosing the choice. NOTE: if not specified the text will default to "You got the %!" To leave it blank, you must add "_". Don't use && (80 character limit)
LINK 		- Dialog block to jump after selecting the choice
LOG 		- Log lump file to display in hud (example: LOGXXXX.lmp, XXXX is the number to enter - 4 digit limit)
NOTEXT 		- Text to display on hud if IF_HAS fails. Not specifying this will default to "No you don't have what I want for the %!" (80 character limit)

When done with the choice block, add the '}' token to end it. You may add up to 5 Choice infos

When done with the entire block, add the token $END

Basic rule is when making a block, you must always begin with $MOBJ and end it with $END. Otherwise the compiler will not compile the script.

----------------------------------------------------------
NOTE ABOUT IF_ITEM, AND IF_HAS
----------------------------------------------------------
You may use up to three of these per block. For IF_ITEM, you may specify three different items that can be checked. If one of them is in the player's inventory, then the script will move on to the next block specified as normal.

IF_HAS is treated differently and can get confusing if not used properly. When using IF_HAS, it will display the text "for %" where % is the item amount. If you wish to NOT have the "for %" text shown, create two IF_HAS, but leave the first option blank (IF_HAS 0 * 0) and acually use the second option. It is unknown what the third one is used for.

Information about MOBJ ID
For those who want to know why you must use MOBJ IDs in the scripts, the oringinal Strife game was of course based on the oringinal C source of Doom2. There is a source file called info.c and info.h which contains a HUGE array of the things. Well, Strife used that array to identify what thing is scripted.

You can actually view the MOBJ ID for Doom if you use Dehacked (don't get this confused with DoomEDNum).


More infomation about the Strife script:
Its very strict, meaning you have to keep everthing in order, when you make a NPC with more than 1 dialog block, they all must follow each other, you can't have lets say a block for NPC#1 then a block for NPC#2 then another block for NPC#1 again. They all must follow like this NPC#1, NPC#1, NPC2 etc.

Each dialog block is EXACTLY 1.48kb, if the size varied, then the script won't work. 
Please read HARRIS.TXT for an example of how the NPC Harris (from Strife map02) works.
Also check out the sample script for more examples.

Understanding Strife scripting is not hard at all and does not require learning unlike ACS. This version (1.3) has attempted to make the format as simple to use as possible. I really suggest taking a look at the example scripts and see how it is done. For any questions or problems, please feel free to email me.

-kaiser


***Source Code Info******

KSSC.dsp
    This file (the project file) contains information at the project level and
    is used to build a single project or subproject. Other users can share the
    project (.dsp) file, but they should export the makefiles locally.

KSSC.cpp
    This is the main application source file.

KSSC.h

File.cpp
    Functions used to search for tokens. These functions are borrowed from the Hexen source

File.h

Other standard files:

StdAfx.h, StdAfx.cpp
    These files are used to build a precompiled header (PCH) file
    named KSSC.pch and a precompiled types file named StdAfx.obj.
