home » builders » builder's lessons » room programs
Room programs
Like mobiles and objects, rooms can have programs in them. More information on writing programs is available in the section of the lessons devoted to programs. For a list of program triggers that will work in rooms, see the list of mobprogs.
The following is a sample of the usage of a program in a room. Note that the S in the room information comes AFTER the program's pipe. There are two programs in the room below. The rirst one is one that triggers 30% of the time. It places food in and out of the dungeon. The second one prevents players from using supplicate in this room.
#8115 Waterdeep Dungeon~ In the corner is a pile of straw for you to sleep on. It is none too clean and it looks to be rather damp. There is no windows and you are somewhat below sea level as the walls are very damp. You see some intriguing scratchings on the wall. ~ 0 ROOM_DARK|ROOM_INDOORS|ROOM_NO_ASTRAL|ROOM_NO_MAGIC|ROOM_NO_SUMMON|ROOM_NO_RECALL SECT_INSIDE 0 0 0 DDIR_UP ~ iron door~ EX_ISDOOR|EX_CLOSED|EX_LOCKED 8076 8114 0 E scratch scratchings~ Darrak was here first! ~ >rand_prog 30~ if quest(16,5,$r) < 14 if quest(16,5,$r) > 0 mpmadd $r quest 16 5 1 if rand(20) mpecho You hear the rustle of a rat in dark corner. else if rand(20) mpecho Someone shoves a plate of gruel though a flap in the door. mpoload 8286 drop i8286 else if rand(20) mpecho Someone shoves a battered tin cup of water through a flap in the door. mpoload 8287 drop i8287 else if rand(20) if ovnumroom(8286) > 0 mppurge i8286 mpecho Someone reaches in through a flap and takes the old gruel away. endif else if ovnumroom(8287) > 0 mppurge i8287 mpecho Someone reaches in through a flap and takes the old tin cup away. endif endif endif endif endif endif else mpechoat $r A guard comes and tells you that you have served your time. mpechoat $r He escorts you to the gates of the city. mpechoaround $r A guard comes and tells $r $e has served $s time and takes $m away. mpmset $r quest 16 5 0 mptransfer $r 8001 pet mpat 8001 mpforce $r look mpat 8001 mpechoaround $r $r is shoved out the gates of the city by a guard. endif ~ >intercept_prog supplicate~ mpechoat $n OOC: We have disabled this function for the dungeon. mpechoat $n If you wish to supplicate and use favour to get out of the dungeon, mpechoat $n then it is our feeling that you should roleplay it with your mpechoat $n deity rather than using the automatic function. ~ | S