message.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <html>
  2. <head>
  3. <link href="../tutorial.css" rel="stylesheet" type="text/css">
  4. </head>
  5. <body>
  6. <div class="header">
  7. The NakedMud Tutorial :: Messages and Newstyle Messages
  8. </div>
  9. <!-- content starts here -->
  10. <div class="content-wrap"><div class="content-body-wrap"><div class="content">
  11. <div class="head">Message</div>
  12. <div class="info">
  13. mud.message is a wrapper for the C message function of the same name. It takes
  14. roughly the same variables, and uses macro expansions for quick inclusion on
  15. character, target, and object information. It takes the form:
  16. <pre class="code">
  17. message(ch, vict, obj, vobj, show_invis, range, mssg)
  18. </pre>
  19. A reference manual for message() can be found in the reference section.
  20. </div>
  21. <div class="head">Newstyle Messages</div>
  22. <div class="info">
  23. As of version 3.8, NakedMud implements newstyle messages that extend
  24. char.Char.send . As of version 3.9, NakedMud also implements newstyle messages
  25. to multiple people with char.Char.sendaround and mud.send . These work by
  26. allowing users to embed Python statements within sent messages, in the same way
  27. that they can be embedded in game contents' descriptions.
  28. </div>
  29. <div class="head" style="text-transform: none;">ch.send(mssg, dict=None, newline=True)</div>
  30. <div class="info">
  31. Characters have a method, send, that outputs a string of text to their socket.
  32. If a dictionary is provided, text between [ and ] are expanded out as Python
  33. statements. When statements are expanded, the variable 'me' references the
  34. character being sent the message.
  35. <pre class="mud">
  36. > exec ch.send("Hello, [me.name]!")
  37. Hello, [me.name]!
  38. > exec ch.send("Hello, [me.name]!", dict={})
  39. Hello, Alister!
  40. > exec ch.send("Hello, [me.name]. You are in [me.room.name]. foo=[foo].",
  41. dict={ "foo" : "bar" })
  42. Hello, Alister. You are in Some Room Name Here. foo=bar.
  43. > exec ch.send("You are wearing [if head==None]nothing[else][head.name][/if] on your head.",
  44. dict = { "head" : ch.get_equip("head") })
  45. You are wearing a red fez on your head.
  46. </pre>
  47. </div>
  48. <div class="head" style="text-transform: none;">ch.sendaround(mssg, dict=None, cansee_only=False, newline=True)</div>
  49. <div class="info">
  50. The sendaround method works similar to send, except it sends the message to
  51. everyone in the character's room, besides the person sendaround is called for.
  52. When Python statements are expanded, the variable 'me' references the person
  53. sendaround is called for. The variable 'ch' references characters messages are
  54. being sent to.
  55. <pre class="mud">
  56. > exec ch.sendaround("Hello, [ch.name]. [me.name] is sending you a message!", dict={})
  57. (Seen by OtherPerson1) Hello, OtherPerson1. Alister is sending you a message!
  58. (Seen by OtherPerson2) Hello, OtherPerson2. Alister is sending you a message!
  59. </pre>
  60. </div>
  61. <div class="head" style="text-transform: none;">mud.send(list, mssg, dict=None, newline=True)</div>
  62. <div class="info">
  63. This function works much the same as ch.send, except it sends a message to
  64. each person in a list of characters. The variable 'ch' references the character
  65. being sent a message.
  66. </div>
  67. <!-- content ends here-->
  68. </div></div></div>
  69. <!-- navigation starts here -->
  70. <div class="nav-wrap"><div class="nav">
  71. <iframe src="nav.html" height="100%" width="100%" scrolling=no frameborder=0>
  72. </iframe>
  73. <!-- navigation ends here -->
  74. </div></div>
  75. <!--div class="footer">Edit Date: Nov 15, 2008. By Geoff Hollis</div-->
  76. </body>
  77. </html>