Exit
From Tapestries MUCK
An action is something that can be invoked by players as a command by typing the name of that action.
Creating an Action
You can create an action using the @act command. Now lets say you have a room with a dbref of #1234 that you want to be able to easily change the wall color in. Although you can do much much more with actions than this, everyone needs to start with something simple and understandable. A simple action that does lets you do that is created below.
@act wallcolor=#1234=wallcolor «- Here we create the action and attach it to the room @link wallcolor=$nothing «- You need to do this for it to work @succ wallcolor={Exec!:_cmds/{&cmd}} «- Here we tell the action to execute this command for success @osucc wallcolor={Exec!:_cmds/o{&cmd}} «- This tells the action to print something to everyone else @set wallcolor=_cmds/wallcolor:You change the wall color to {store:{&arg},_wallcolor,#1234} @set wallcolor=_cmds/owallcolor:changes the wall color to {&arg}
Now you just include something like "The walls are {prop:_wallcolor}" and it would show whatever was last set when someone typed wallcolor somecolor.
Multiple Commands on one Action
While changing the wall color is just grand, you might want to change the floor color as well. Since you have big plans, you don't want to use up too much of your quota doing this. You can take the action just made and add to it like this:
@name wallcolor=wallcolor;floorcolor «- Changes wallcolor to answer to wallcolor and floorcolor @set wallcolor=_cmds/floorcolor:You change the floor color to {store:{&arg},_floorcolor,#1234} @set wallcolor=_cmds/ofloorcolor:changes the floor color to {&arg}
Now you just include something like "The floors are {prop:_floorcolor}" and it would show whatever was last set. The wallcolor somecolor command would still exist for changing the wall colors, but now you also have a floorcolor somecolor for changing the floors.