Also:
Label replacement
Rating: easy enough to do the replacement, but may make code slightly more complicated
If you're using a built-in label a lot (for example, if you have a lot of :touch labels and #zap touch commands), you can save some space by replacing it with a shorter label. Example:
Code: Select all
#end
:touch
#send t
#end
:t
1
#zap t
#end
:t
2
#zap t
#end
:t
3
#zap t
#end
:t
4
#zap t
#end
'etc...
I used #send t instead of #t because #t will cause an error if all the labels have been #zapped.
#end replacement
Rating: easy
If you're really intent on saving space, you can shave a few bytes off your program size by replacing certain commands with #[send]s and labels. For example, if you use a lot of #ends, you can replace every #end with #x and put :x at the end of your program:
Code: Select all
@counter
#x
:a
#char 48
#x
:b
#char 49
#x
:c
#char 50
#x
'snip snip...
:j
#char 57
:x
This saves you 2 bytes per #end (after the first #end, which costs 1 byte to replace). The savings isn't that much, so it probably isn't that useful unless you're really,
really close to the board size limit, and you've got an abnormally large number of #ends in your program.
A similar thing can be done for #restart.
Stuff under objects
Rating: medium if you've never edited stats, easy otherwise
This is a trick that I've found really useful lately. You know how you can place objects on top of fakes, such that when the object moves, there's fake wall where it once was? Well, the file format allows pretty much any terrain to be underneath an object. In KevEdit, press Ctrl-T to edit the stats of a tile. Change the fields Under Type and Under Color, and now there's something different under the object! The effect is that you can have objects "sit on top of" walls.