MUDL:send msgs for sing

From SlothMUD Wiki
Jump to: navigation, search


Summary

Function Name send_msgs_for_sing
Settable No
Returns Boolean


This function sends the appropriate messages for singing a song. It is most likely to be used inside the intercept_sing 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 singing the song.
Integer Id of the song being sung.
Boolean FALSE if this is the start of a song or TRUE if another verse of a song is being played.


Output

Person Message Sent
Actor You begin to sing <Song>.

You sing another verse of <Song>.

Others in Room <Actor> begins to sing <Song>.

<Actor> sings another verse of <Song>.


Example

addproc <mobile> mudl
setproc <mobile> 0 intercept_sing_ib

if (spell_name(%1) != 'lion chorus',
(
    # Wrong song.
    return(false)
)),

if (false = %2,
(
    # Allow the initial play to run as normal.
    cmd(%a, 'sing ~`lion chorus~` ' + concatenate(%s)),
    cmd(%c, 'say What a lovely song.')
),
(
    # Show the replay messages.
    send_msgs_for_sing(%a, %1, %2),
    cmd(%c, 'say It keeps getting better!')
)),

# Mark song 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