|
Back to Tips Page Using Wildcards Wildcards Mud Master uses up to 10 "wildcards" (in actions, aliases can use only one). Wildcards are a way of saying "some text is here, but exactly what it is isn't important (for now, later it might be looked at via scripted routines). Wildcards are numbers 0 to 9, preceeded by a percent sign, or dollar sign, depending on where you're using them. %0 to %9 are only used in the trigger portion of the action. example: /action {trigger} {commands} {group} /action {%0 says, '%1'.} {do....} {} The dollar sign denotes a variable, so to retrieve the value of a wildcard, in the action's commands, call it with $0 to $9. Example: /action {%0 says, '%1'.} {/var WhoSaid $0;/var SaidWhat $1} {} The limit of ten wildcards might be a little restrictive, but overall it's more than enough for most actions. Use @Word(), in particular for aliases, to help pick apart wildcard strings. See below... Aliases' Wildcard An alias can only have one wildcard. /alias {xyz %0} {do stuff..} {group} Now, you might want an alias to use multiple perameters in the call. You can do this by using the @Word() proc. For example, say we want an alias to add two values, and multiply that by a third value, "domath x y z". It's quite simple. /alias {domath %0} {/var Word1 @Word($0,1);/var Word2 @Word($0,2);/var Word3 @Word($0,3);/var Result @Math($Word1 + $Word2);/var Result @Math($Result * $Word3);say The result is $Result} {group} Doing "domath 3 6 9" would result in 81. Simple! |