Script Execution #1

Filed under: Bytecode, Crusaders of Khazan, Tunnels & Trolls — denormative @ 12:51

Inbuilt into the game are a series of event scripts. Every time you move to a new square, the game checks a flag within the map details data (for both inside and outside) to see if the square is set as “triggerable”. If this is the case, it then references the event data for the relevant indoor/outdoor map, checks if there’s any events setup for both that (x,y) position and the current facing of the party, and if so executes the compiled bytecode associated with the script.

Essentially everything in the game is controlled by triggers. Of note:

  • Starting fights (including I believe random combat encounters)
  • Visiting shopkeepers (they’re one of the main users of “facing specific” triggers)
  • Random “talking” encounters (such as the beggars in Gull, or the wandering wizard who identifies your items also in Gull)
  • Large pre-programmed encounters (such as the “Temple of the Blue Beetle” event, or the Orcs in the Abandoned House in the same area as the Blue Beetle temple where you’re moved around and get into a series of combats)
  • Notice Boards (such as the one in the Adventure Guild)

I’ve decoded most of the basic elements of the bytecode, at least enough to wander around Gull and trigger most of the events, (though exactly how it triggers a combat encounter is still unknown, even if the opcodes are known), and have started implementing it.

Though as I still haven’t worked out the rendering of the indoor areas, I’m currently testing it via a “debug” icon shown in the screenshot below. This is triggering the first message you see when you start a new game in Gull.

New Start Game Message

Original Start Game Message


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: