Author Topic: Fragglescript in English  (Read 2943 times)

Offline The Green Avenger

  • Sudoku Black Belt
  • Ultimus
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 561
  • Legacy Loyalist
    • Chex Brigade!
Fragglescript in English
« on: April 08, 2009, 07:06:45 AM »
From personal experience, i know how hard it is to try to learn any scripting language using most online tutorials.  This is generally because most tutorials are written for the computer savvy people on the nets anyway.  Anyway, during my time online, I have found precious few tutorials about fragglescript that help me at all, and all of them have been woefully incomplete.  This tutorial is my attempt to do something about it.

I do not claim to know everything about fragglescript, but I have reached the point that I can learn almost any technique in FS just by looking over even some of the more technical tutorials.  This tutorial is meant to get you to that point, without making you go through the one year process it took me to get this far.

Please note that I will make use of screen captures to help explain what I am trying to tell you at some points, since I plan to help you by not only giving you a basic understanding on the script syntax, but also how to get it to work in your game world.  For this reason, this tutorial may take some time to load, especially on slow internet connections.  If you are one of the people with such a connection, just go order a pizza or something.  I'll be here when you get back.

All right!  Let's get started.

Although I have found tutorials online that helped me learn how to use Fragglescript, I have found absolutely none that actually tell you that it's possible to script internally in DooM Builder.  Since this is the easiest way I have found, I guess I'm going to be the first one...  To start out, I'm going to help you get DB set up so that it will highlight text in your scripting, which is often a lifesaver for finding mistakes in your work.

This first part is a rather simple operation.  Go to DooM Builder's program files.  By default, this directory is located at C:\Program Files\Doom Builder .  On Vista machines, it is recommended that you install the program in a directory other than Program Files.  If this is the case, to find out where DB's program files are, right click on any shortcut to DooM Builder, click properties, and check the 'Start in' field.

Inside the program files folder, look for a file called FS.cfg.  Right click and run this file in Notepad.  Inside you will see something that resembles English, but with significantly different punctuation.  What we are looking for is the line that says 'casesensitive = 1;'.  Change this value to 0, so that it looks like this:

Save the file and close.

Now, make sure that you exit any active DooM Builder windows that you have open.  The program has to restart so that these changes will take effect.

Now we can start DooM Builder.  For the purposes of this tutorial, I will go ahead and assume that you already know the basics of how to use DooM Builder.  If not, I suggest checking the 'Mapping for Chex Quest - DooM Legacy Edition' topic.  Create a new map as usual, and use either the DooM Legacy or Chex Quest(R) mapping configurations.  (Note that the latter of the two is not available by default, but that it replaces all of the DooM names with their Chex Quest equivalents and so will be used during the writing of this tutorial.  The configuration file should be downloaded here and installed in the DooM Builder program files).

All right!  Now we can get started.  Before doing any scripting, I suggest at least adding the map prerequisites (2 sector, player 1 start).  Once you have done this, click on the 'Scripts' option of the top toolbar:

This should open a new window.  For the time being, just ignore the buttons at the top and click the 'Make Script' button:

You have now broken ground on a new script, congratulations!  Still, it is a little empty, isn't it?  Just a lonely 01 and a text parser.  What say we fix that?

Let's start out with the level info section of the script.  This is the first out of two parts of a usual script, as well as the least complicated.  Good place to start, any way you cut it.  Incidentally, either part of a script may be omitted without any issues.  Generally, though, a map with scripting will contain both a level info and a map script section.

Each of the sections are signaled by a predetermined header in a particular script file.  To start the level info section, we use this code:

Code: [Select]
[level info]

Not very complicated.  Just make sure it doesn't have any typos, the results might be interesting.  :D  Moving on, let's look at some of the functions of the level info section of fragglescript.  This section is mainly used to effect the starting condition of the map, as well as the information that the in-game console gives about a particular map.

All of the functions in the level info section use the format (command = value).

The following are the basic functions, along with the explanations as to what each of them does:

levelname = <name> (By replacing <name> with your name of choice for your map, you can change what displays at the bottom of the screen when you are in map mode.)

creator = <name> (By replacing <name> with your name, or the pseudonym of your choice, you can change what is displayed when a player enters the command 'creator' in the in-game console.)

partime = <value> (By replacing <value> with the suggested time it should take to complete the level in seconds, you can change the value displayed for 'Par' at the level intermission screen.)

skyname = <name> (By replacing <name> with the name of a texture, you can change the graphic that the F_SKY1 flat displays as your map's skybox.)

consolecmd = <command> (By replacing <command> with any in-game command, you can run anything as though you had typed it into the in-game console)

For example, let's say I wanted to make a map named Flemoid Homeworld, with a creator called Slime-O-Matic, a par time of 2 minutes and 20 seconds, a sky using the texture TALLSNOT, and gravity at half of its normal value, I would write this script:

Now, I do suggest waiting until you've finished the map to add a par time, but since we are dealing with this section of fragglescript anyway, I decided that there's no reason not to deal with it.

Also of note is the fact that, at any time, a note may be added to a line by simply typing // before your message.  For example, a code saying:

Code: [Select]
creator = Slime-O-Matic //That's me!

will be read by the computer as though 'That's me!' was not there.  Anything left of a // will not be read by the engine.

Another method of adding notes is using the symbol /* before the note and */ after the note.  For example, a code saying:

Code: [Select]
/*This line is a note.
And so is this one.  Hi, mom!*/

would not be read by the engine.  Be careful, though!  A code like this:

Code: [Select]
/*This line is a note
creator = Slime-O-Matic
And so is this one.  Hi, mom!*/

will also not be read by the engine.  This means that, unless you had another creator section in your script, the engine will not return the value you set.  Anything between the /* and the */ is ignored by the engine, no matter how many lines there are between.

This pretty well concludes the level info section.  Admittedly, it isn't much.  Still, it lets you do some things that you wouldn't be able to do otherwise.  Next time I write in this tutorial, though, we'll get into the real deal: The scripts section.
Visit Chex Brigade, home of Chaos on Flemoid Prime!

The art of winning an argument is not so much proving your own point as it is systematically dismantling your opponent's point, leaving yours as the logical alternative.


Web Hosting by InMotion Hosting