MUDL:send msgs for play

From SlothMUD Wiki
Jump to: navigation, search


Summary

Function Name send_msgs_for_play
Settable No
Returns Boolean


This function sends the appropriate messages for playing a song. It is most likely to be used inside the intercept_play 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 playing the song.
Integer Id of the song being played.
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 play <Song>.

You play another verse of <Song>.

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

<Actor> plays another verse of <Song>.


Example

addproc <mobile> mudl
setproc <mobile> 0 intercept_play_ib

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

if (false = %2,
(
    # Allow the initial play to run as normal.
    cmd(%a, 'play ~`lion chorus~` ' + concatenate(%s)),
    cmd(%c, 'say What a lovely song.')
),
(
    # Show the replay messages.
    send_msgs_for_play(%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