This function sends text strings to the specified character(s) and other players within the same room. It is similar to calling msg_character() and msg_room() together.
The arguments passed in are used as follows:
set_attr(%c, 'Action1.Actor', 'You slap $N with $p.'), set_attr(%c, 'Action1.Room', '$n slaps $N with $p.'), set_attr(%c, 'Action1.Victim', '$n slaps you with $p.'), ... msgs_from_attr(%c, 'Action1', char_in_room(%c, 'Example'), obj_in_inventory(%c, 'food'))
Assuming a mobile "a monkey" has this script and "a banana" in its inventory and that there is a character named "Example" in the room, the actor mobile sees:
You slap Example with a banana.
The victim Example sees:
A monkey slaps you with a banana.
The rest of the room sees:
A monkey slaps Example with a banana.
The code can be made even more powerful when combining it with the random() function. The following script defines multiple actions and uses random() to choose one to perform.
set_attr(%c, 'Action1.Actor', 'You slap $N with $p.'), set_attr(%c, 'Action1.Room', '$n slaps $N with $p.'), set_attr(%c, 'Action1.Victim', '$n slaps you with $p.'), set_attr(%c, 'Action2.Actor', 'You poke $N with $p.'), set_attr(%c, 'Action2.Room', '$n pokes $N with $p.'), set_attr(%c, 'Action2.Victim', '$n pokes you with $p.'), set_attr(%c, 'Action3.Actor', 'You pretend to give $p to $N.'), set_attr(%c, 'Action3.Room', '$n pretends to give $p to $N.'), set_attr(%c, 'Action3.Victim', '$n pretends to give you $p.'), ... msgs_from_attr(%c, 'Action' + random(1, 3), char_in_room(%c, 'Example'), obj_in_inventory(%c, 'food'))