MUDL:send msgs for cast
From SlothMUD Wiki
Contents
Summary
Function Name | send_msgs_for_cast |
---|---|
Settable | No |
Returns | Boolean |
This function sends the appropriate messages for casting a spell. It is most likely to be used inside the intercept_cast function but could be used in other places. The function returns TRUE if all the parameters are valid and FALSE otherwise.
Parameters
Arguments | |
---|---|
Character | Actor performing the cast. |
Integer | Id of the spell being cast. |
Output
Person | Message Sent |
---|---|
Actor | OK. |
Others in Room | <Actor> utters the words '<Spell Name>'. |
Example
addproc <mobile> mudl setproc <mobile> 0 intercept_cast_i # Is this a spell we care about? if (spell_name(%1) != 'fireball', ( # Wrong spell. return(false) )), # Is this targeted at us? if ((length(%s) < 1) OR !(char_in_room(%a, %s[1]) = %c), ( # Not targeting us. Use normal processing. return(false) )), send_msgs_for_cast(%a, %1), cmd(%c, 'say Your fire is no match for me!'), # Mark spell as successful - full mana drain. set(flag(%f, 'procedure-flags', 'success'), true), # Stop future processing of this command set(flag(%f, 'procedure-flags', 'overrode-command'), true), return(true) @ setproc <mobile> 0 PROC_ENABLED 1 compile