HATPC Reborn events are lines at the end of the level file (or inserted via a text box in CaveGen) defining various actions that the game will take.
There are 2 main types of events: Events with conditions, and unconditional events.
There are currently four conditional events you can define:
To add these events to a level, add a line to the end of the level code that begins with the $ character, followed by the code for the event:
The "ID" parameter is a non-negative integer that identifies this event. It does not need to be unique, and it is ignored unless you make use of the "multi()" or "id()" parameters which I'll explain later.
The "message" parameter for the $msg and $msgp events is the text to be displayed on the screen. Note that any # characters in this message will be replaced with newlines, but the game will also automatically insert line breaks as needed. It can be entered with or without quotes around it.
Once you've created your event, you'll want to control when the event goes off. To control that, you have access to a bunch of conditions, defined by adding them onto the line your event is defined on. These conditions must all be true for the event to occur, so you can imagine they are joined by a logical AND gate. An event with no conditions is automatically triggered when the level starts. The game automatically generates a checkpoint event with no conditions at the start of every level, so until any more checkpoints are triggered, dying or restarting restores to that point.
Here are the conditions you can set:
In addition to those conditions, there are two special parameters which you can add to modify event behavior:
And here are some tips for using conditions:
The x and y coordinates used count up from the top left of the level, and start at one. To find the coordinates of a position in your cave, you can put the cave file minus the header lines in Notepad++ and put your cursor to the left of the spot you want the coords of. The "Col:" number will be the x coord, and the "Ln:" number will be the y coord.
The "in()" condition ignores the order in which you enter the x and y values, so don't worry about sorting them, just enter your two points in whatever order you want.
The char in the "tile()" condition is the character you would use to code for that tile in a level file. The "tile()" condition is also triggered by objects falling past the given location.
The "id()" condition has four types:
"skip" is the opposite of "prereq" and "exact" is the opposite of "not". Once a "not" or "skip" condition becomes false, it actually deletes the event entirely since there is no way for those conditions to become true again.
There are three unconditional events that trigger at the start of the level and ignore all conditions set for them. These act more like flags you can set in the level file than actual events.
Here are their codes:
The URL parameter in $next is the URL of the level file for the next level encoded with URL encoding. If you need to URL-encode a URL, you can use this encoder.
If the level you want to enqueue is in CaveGen, you can grab the URL-encoded URL by clicking on the play link and then copying everything after the "?cave=" from the address bar.
If the level is on The Interguild, the URL of the level file will be http://www.interguild.org/levels/levels/#####.txt but with the ##### replaced with the numerical level ID (found in its Interguild page URL).