Getting started

This module doesn't try to do 'everything'. You aren't going to be able to create a map from scratch with it. Many sections of the chk file (uncompressed starcraft map) are simply passed through untouched.. this means that all your terrain etc. needs to come from somewhere else eg, staredit.

Get a map that would like to use, remember the name. I'm going to use my_map.chk.
Here's your first program using the module.

#!/usr/bin/perl -w
use strict;
use SCUMC;

my $map = SCUMC::Map->new('my_map.chk');

# Now the $map variable is representing my_map.chk in memory, ready for you to manipulate to your hearts content.
# To make sure everything is working, let's output some information about my_map

print "my_map's dimensions are ", $map->get_width(), " x ", $map->get_height(), "\n";
If you run this program it should spit out a single line, something like:
$ perl my_program.pl
my_maps's dimensions are 128 x 128
Don't go any further until you get this working.

Now that we have a map we want to work off of, let's add a trigger, and write a new map.

#!/usr/bin/perl -w
use strict;
use SCUMC;

my $map = SCUMC::Map->new('my_map.chk');
new_trigger(PLAYER_1);
	Always;
	TextMessage("Hello world");
write_map('my_map_out.chk');
Running this should leave a second chk file in the directory my_map_out.chk. If you open it with staredit you should see the trigger for player 1.

that's all (documentation), so far.