Difference between revisions of "Scripting(Builder)"
Jump to navigation
Jump to search
(9 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Articles on General Concepts== | ==Articles on General Concepts== | ||
+ | * [[BasicScript|A Very Simple Script]] - This is a very simple, basic script. | ||
* [[ScriptingIntro|Scripting Intro]] - An introduction to making your Mobs come alive | * [[ScriptingIntro|Scripting Intro]] - An introduction to making your Mobs come alive | ||
* [[ScriptableTags|Scripting Tags]] - Useful markup to make your output more grammatically correct. | * [[ScriptableTags|Scripting Tags]] - Useful markup to make your output more grammatically correct. | ||
==Specific Scripting Solutions== | ==Specific Scripting Solutions== | ||
+ | * [[GiveOrDrop(Script)|Questgiver Give solution]] - A script which will help avoid lost quest rewards because the Quest Giver can't detect the person turning in the quest, or the person can't receive the reward for some reason, then the Quest Giver will leave the reward on the ground. | ||
* [[SteppingStone(Script)|Step Stone]] - A script which loads in a GenPortal item to enable players to step on the stone to go through a portal. | * [[SteppingStone(Script)|Step Stone]] - A script which loads in a GenPortal item to enable players to step on the stone to go through a portal. | ||
* [[LeverPull(Script)|Level Pull]] - A simple lever script for opening doors. | * [[LeverPull(Script)|Level Pull]] - A simple lever script for opening doors. | ||
Line 17: | Line 19: | ||
* [[ItemSkill(Script)|Skill Use on an Item]] - A solution for a mob to charge for using an ability on an item. | * [[ItemSkill(Script)|Skill Use on an Item]] - A solution for a mob to charge for using an ability on an item. | ||
* [[ManaBoost(Script)|Mana boosting]] - A script for adding mana to a MOB, such as recharging their mana pool. | * [[ManaBoost(Script)|Mana boosting]] - A script for adding mana to a MOB, such as recharging their mana pool. | ||
+ | * [[NonResettableInstance(Script)|Non-resettable Instance]] - A script to prevent players from having the option to reset an autogen instance. | ||
+ | * [[PlaySound(Script)|Play a sound from file]] - A simple example of how to play a sound from an available file. | ||
+ | * [[Uurdin_ARedBearTest(Script)|Display Word Switch]] - A complex script for changing a word in the display text of a MOB and maintaining participles. | ||
=Scripting Do's and Dont's= | =Scripting Do's and Dont's= | ||
Line 31: | Line 36: | ||
*<I>if has($n red sword)</I> - will fail if there is also a red sword in the room. To properly check if a player has a red sword, use <I>if wornon($n inventory 'a red sword')</I> to make it work. | *<I>if has($n red sword)</I> - will fail if there is also a red sword in the room. To properly check if a player has a red sword, use <I>if wornon($n inventory 'a red sword')</I> to make it work. | ||
*When working with hitpoints (or mana or movement), HITS=current hit points, BASEHITS=maximum unmodified hit points, MAXHITS=modified maximum hit points. | *When working with hitpoints (or mana or movement), HITS=current hit points, BASEHITS=maximum unmodified hit points, MAXHITS=modified maximum hit points. | ||
+ | *For MPDAMAGE, each variable needs to have single quotes around them and everything works. | ||
+ | **mpdamage $t '$<$i FINALDAMAGE>' '$<$i FINALDAMAGE>' KILL | ||
+ | |||
===Notes=== | ===Notes=== | ||
− | . | + | *MPOLOAD will work fine if the item is not in the same area as the script. |
+ | **Archon-only items may not be loaded with MPOLOAD, and must be manually created to avoid scripting abuse. | ||
+ | *Some progs (like cast_prog) may fire multiple times when called. If this is an undesired effect, you may use: mpnotrigger [trigger name] [time in miliseconds] to limit the rate of action. |
Latest revision as of 13:06, 17 September 2024
CoffeeMUD |
---|
Administrator Builder Player |
=CoffeeMUD Builder Information= | |||
---|---|---|---|
Basics | Praetor Player Support Commands Zapper Masks | Advanced | Races Classes Abilities Socials Scripting |
Building | Behaviors Properties Areas Rooms Exits Items Mobs | Systems | Achievements Crafting Help Info Ships Planes of Existence Quests Triumphs |
CoffeeMUD has enormous flexibility outside of pre-built behaviors and properties with the Scriptable and ScriptableEverymob behaviors.
Contents
Official Scripting Docs
Articles on General Concepts
- A Very Simple Script - This is a very simple, basic script.
- Scripting Intro - An introduction to making your Mobs come alive
- Scripting Tags - Useful markup to make your output more grammatically correct.
Specific Scripting Solutions
- Questgiver Give solution - A script which will help avoid lost quest rewards because the Quest Giver can't detect the person turning in the quest, or the person can't receive the reward for some reason, then the Quest Giver will leave the reward on the ground.
- Step Stone - A script which loads in a GenPortal item to enable players to step on the stone to go through a portal.
- Level Pull - A simple lever script for opening doors.
- Button Push - A simple script for pushing a button.
- Starting Zone - A script to provide players with some information about the world, and change the player's beacon based on responses.
- Changing a Player's Beacon - A solution for resetting a player's RECALL location.
- Skill Use on an Item - A solution for a mob to charge for using an ability on an item.
- Mana boosting - A script for adding mana to a MOB, such as recharging their mana pool.
- Non-resettable Instance - A script to prevent players from having the option to reset an autogen instance.
- Play a sound from file - A simple example of how to play a sound from an available file.
- Display Word Switch - A complex script for changing a word in the display text of a MOB and maintaining participles.
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.
- When working with hitpoints (or mana or movement), HITS=current hit points, BASEHITS=maximum unmodified hit points, MAXHITS=modified maximum hit points.
- For MPDAMAGE, each variable needs to have single quotes around them and everything works.
- mpdamage $t '$<$i FINALDAMAGE>' '$<$i FINALDAMAGE>' KILL
Notes
- MPOLOAD will work fine if the item is not in the same area as the script.
- Archon-only items may not be loaded with MPOLOAD, and must be manually created to avoid scripting abuse.
- Some progs (like cast_prog) may fire multiple times when called. If this is an undesired effect, you may use: mpnotrigger [trigger name] [time in miliseconds] to limit the rate of action.