loading.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 :: Load and Extract
  8. </div>
  9. <!-- content starts here -->
  10. <div class="content-wrap"><div class="content-body-wrap"><div class="content">
  11. <div class="head">Extracting</div>
  12. <div class="info">
  13. Objects and mobiles are typically loaded when zones are reset. They can be
  14. extracted for various reasons (e.g., a player quitting the game, dying, an
  15. object being junked). Scripts have access to this functionality as well. To
  16. extract a mobile or object, simply call the extract function on it. Information
  17. about loading is discussed next.
  18. </div>
  19. <div class="head">Loading</div>
  20. <div class="info">
  21. Objects are loaded with the load_obj function. An object prototype must be
  22. specified, as well as a destination for the object.
  23. <pre class="code">
  24. # load a candle into the room this trigger is attached to,
  25. # and into the inventory of every mob in the room
  26. load_obj("candle@basic_items", me)
  27. for ch in me.chars:
  28. load_obj("candle@basic_items", ch)
  29. </pre>
  30. When objects are loaded onto a character, they are loaded into the character's
  31. inventory by default. Objects can also be equipped onto a character by
  32. specifying which bodyparts the object is to occupy:
  33. <pre class="code">
  34. # load a glove onto the character's left hand
  35. load_obj("white_glove@basic_items", me, "left hand")
  36. # now load the character's jacket
  37. load_obj("leather_jacket@basic_items", me, "left arm, right arm, torso")
  38. # now, load a belt to the default location instead of the inventory
  39. load_obj("leather_belt@basic_items", me, "")
  40. </pre>
  41. To load a mobile, the load_mob function is called. It works exactly like
  42. load_obj except the destination must always be a room, and of course does not
  43. take an optional third argument. Both load_obj and load_mob return the thing
  44. they have loaded.
  45. <pre class="code">
  46. # when a character enters the arena, give them a sword
  47. obj = load_obj(ch, "gladius@weapons")
  48. message(ch, None, obj, None, True, "to_char",
  49. "You have been given $o. Prepare to fight!")
  50. </pre>
  51. </div>
  52. <!-- content ends here-->
  53. </div></div></div>
  54. <!-- navigation starts here -->
  55. <div class="nav-wrap"><div class="nav">
  56. <iframe src="nav.html" height="100%" width="100%" scrolling=no frameborder=0>
  57. </iframe>
  58. <!-- navigation ends here -->
  59. </div></div>
  60. <!--div class="footer">Edit Date: Nov 15, 2008. By Geoff Hollis</div-->
  61. </body>
  62. </html>