Scripting(Builder)

From CoffeeMud Wiki
Jump to: navigation, search
CoffeeMUD
Administrator                                                  Builder                                                              Player
=CoffeeMUD Builder Information=
Praetor     Player Support     Scripting     Races     Commands    Classes     Abilities     Socials     Achievements     Behaviors     Properties     Areas     Rooms     Exits     Items     Mobs     Crafting     Ships     Quests     Zapper Masks

CoffeeMUD has enormous flexibility outside of pre-built behaviors and properties with the Scriptable and ScriptableEverymob behaviors.

Official Scripting Docs

Articles on General Concepts

Scripting Do's and Dont's

  • Do not overtax your scripts for performing actions. A maximum of 25 actions may be taken by a given script per tick. This limit is there to prevent bad scripts from destroying the mud. If more than 25 actions are attempted and error will be thrown similar to:
    • Scripting Error: ...script/UNK/SYS/Attempt to que more than 25 events.
    • To fix a script taking too many actions, review the number of events the script is attempting to handle for a given item/mob/room, and see if it is possible that it is generating many of those message in rapid succession.
  • The death_prog works before the moment of death of a mob, enabling a builder to take a variety of actions, from emotes of the dying mob to protecting the mob from death. As such, this prog needs to be used with care.
    • Transferring a character away from a mob using a death_prog will result in the character being penalized for fleeing a fight.
  • MPECHOAT and MPECHOAROUND are good ways to script things to prevent nuissance messages to other players (for example, a quest giver that talks to each person entering the room).
  • VARIES is a useful command to provide alternative actions based on a criteria.
    • The way it works is you do something like <MASK22 -RACE +DWARF>Stuff for Dwarves</MASK22> The 22 part can be anything, so long as the tag starts with MASK and you use something unique. Important though, you need to use html rules for any < or > characters .. so use & l t ; and & g t ; (no spaces) inside the mask itself.'
  • MPSETINTERNAL should be placed in a once_prog. Any mpsetinternal, or any commands, outside of a trigger block are just going to cause problems.
  • It is not good to combine exit_prog and entry_prog on scripts that affect a GenSailingShip, since the ship generates both an EXIT and an ENTRY message on every room they leave/enter.
  • if has($n red sword) - will fail if there is also a red sword in the room. To properly check if a player has a red sword, use if wornon($n inventory 'a red sword') to make it work.

Notes

.