Chip, on 31 July 2014 - 06:24 AM, said:
I've decided to have a little play with Mapster32 scripting, or more accurately, tweaking a few things.
Basically I want to do the following,
1. Set the colour of the 2D mode tags for my custom sprites to match the official ones. (So white for new Sector Effector members, Orange for Enemies etc.. )
2. Place my custom sprites into the special tile listings.
Quote
For example, I had to use the search feature to find the Mapster32 scripting section, as there doesn't seem to be any links to it on the main page.
The few pages of M32Script documentation I did back then are linked are
linked from the top navigation block in the
Level editing page, among others. They are a bit sparse since I basically only wrote down the calling conventions for the commands but left it to the user to guess (by analogy with CON) their meaning.
Quote
In addition to that, it says that scripting is done in 2 ways, both of which require manual input though the console. Does this mean Mapster32 can't auto-load files? If it can, what are the extensions it supports or was the lone mention of .M32 (said for use with the "include" command within the console) the only file extension supported?
M32Script code can be entered (=begin to be executed) by either
- entering snippets in the console with the "do" OSD command, or
- from an event, which is a certain point in Mapster32 execution.
Loading an .m32 file means to compile definitions of events and "states" (subroutines) into bytecode which can then be executed on the proper occasion. Events additionally feature a disable mechanism to prevent erroneous executions from spamming everything. An invocation of the "include" OSD command can be placed in an m32_autoexec.cfg file to be executed on startup.
Quote
But while also typing things in the search engine, I did find a command that looks like it could solve my first issue: "spritecol" but where do I use this? I tried creating an external .M32 file and loading it manually through the console, but it just gave me an error.
Spritecol is a
DEF language token that only takes effect in the editor.
Quote
I also came across a page about the special tile listings, but it didn't say how to change it.
Special tile listings are stored in yet another kind of file, tiles.cfg. Note that it's an entirely different kind of "cfg" than the autoexec one above. Fortunately, you don't need to edit that file manually. There's a convenience feature in the tile selector mode using (Ctrl+)SPACE to select some tiles and Ctrl-G to create a new group from them. See the entry for "T" in the
keyboard listing.
When starting out, the various kinds of scripting/definition/configuration files can indeed be intimidating. Roughly, they can be classified as follows:
- Files that are merely sequence of OSD commands. Examples are the generated settings.cfg and the user-provided *autoexec.cfg.
- Windows INI-like configuration files. For instance, eduke32.cfg.
- Resource definition files. Mainly DEF, but the underlying framework is used a couple of other places such as for parsing tiles.cfg.
- Proper scripting. CON, M32Script (derived from CON) and Lua fall into this category. However, besides allowing "real" code these languages also feature what I call
directives -- keywords that have an effect at compilation time, some of them rather similar to resource definition commands.