home » builders » builder's lessons » intercept prog

Intercept programs

Intercept programs intercept a command that is inputed into the game. They work on mobiles in the room and objects in inventory and on the ground and in rooms themselves. They are used to make up commands or change what would happen with an existing command.

>intercept_prog shape~
if inroom($n) == 15254
  mpechoat $n You carve the stick into an arrow shaft.
  mpoload 15172
  mpgive i15172 $n
  mpmset $n quest 15 4 1
  mpjunk i15167 $n
else
  mpechoat $n You really should do this with the wild elf elder's supervision.
endif
~
|

This program is on an object, that is used in the arrow making quest in Tethir Forest. With this I created the command shape. The PC would type shape into the game and if the program would activate. First it checks to see that the player is in a certain room (in this case with the wild elf elder in Tethir Forest), and then it loads up another object and gives it to the player. There is no echo saying that the PC is given the object as we do not want them to see such an echo. It sets the bit up and junks the object that the program is on. Do NOT junk objects that progs are on until the last line of the program. Junking them before the end means the program will not continue after the junk line. In this case if the PC is in the wrong room, it gives them a message saying so.

>intercept_prog sleep~
sayto $n Hey! What do you think you doing sleeping in my shop!
sayto $n Go pay for a room in an Inn.
~
|

This program intercepts a normal command in the game and makes it never happen and echos something else instead. This is one that is common to most cities in the game to stop players sleeping in the streets.

There is also the case where you want to have something happen and then execute the normal command in the game.

>intercept_prog request~
if deity($n) == Mystra
  mpunintercept
else
  sayto $n Such armour is reserved for the followers of Mystra.
endif
~
|

This program intercepts the request command. It is on the priest of Mystra in her temple in Waterdeep. We didnt want anyone getting the armour he wears, and only followers of Mystra. So this program does a check for if the PC follows Mystra, if they do the command continues as normal. This is what the mpunintercept does. If the PC does not follow Mystra the n it echos at them, and the command does not execute.