mirror of
https://github.com/evennia/evennia.git
synced 2026-04-01 21:47:17 +02:00
Updated HTML docs.
This commit is contained in:
parent
57f411a6fa
commit
3fbd6c8647
154 changed files with 5284 additions and 4653 deletions
|
|
@ -346,7 +346,14 @@ Click here to expand a list of all Beginner-Tutorial sections (all parts).
|
|||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html">10. Creating things</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-objects">10.1. Creating Objects</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-accounts">10.2. Creating Accounts</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-rooms-characters-and-exits">10.2. Creating Rooms, Characters and Exits</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#linking-exits-and-rooms-in-code">10.2.1. Linking Exits and Rooms in code</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-accounts">10.3. Creating Accounts</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-channels">10.4. Creating Channels</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-scripts">10.5. Creating Scripts</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#conclusion">10.6. Conclusion</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html">11. Searching for things</a><ul>
|
||||
|
|
@ -368,166 +375,27 @@ Click here to expand a list of all Beginner-Tutorial sections (all parts).
|
|||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html">12. Advanced searching - Django Database queries</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#queryset-field-lookups">12.1. Queryset field lookups</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#get-that-werewolf">12.2. Get that werewolf …</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#complex-queries">12.3. Complex queries</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#lets-get-that-werewolf">12.2. Let’s get that werewolf …</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#queries-with-or-or-not">12.3. Queries with OR or NOT</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#annotations">12.4. Annotations</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#f-objects">12.5. F-objects</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#grouping-and-returning-only-certain-properties">12.6. Grouping and returning only certain properties</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#conclusions">12.7. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html">13. Building a chair you can sit on</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#make-us-not-able-to-move-while-resting">13.1. Make us not able to move while resting</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#making-the-chair-itself">13.2. Making the Chair itself</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#sitting-on-or-in">13.2.1. Sitting on or in?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#extra-credits">13.2.2. Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part1/Beginner-Tutorial-Part1-Intro.html#table-of-contents">Table of Contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html">1. Using commands and building stuff</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#getting-help">1.1. Getting help</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#looking-around">1.2. Looking around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#stepping-down-from-godhood">1.3. Stepping Down From Godhood</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#creating-an-object">1.4. Creating an Object</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#get-a-personality">1.5. Get a Personality</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#pushing-your-buttons">1.6. Pushing Your Buttons</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#making-yourself-a-house">1.7. Making Yourself a House</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#reshuffling-the-world">1.8. Reshuffling the World</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#adding-a-help-entry">1.9. Adding a Help Entry</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Building-Quickstart.html#adding-a-world">1.10. Adding a World</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#adding-commands">13.3. Adding commands</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#command-variant-1-commands-on-the-chair">13.3.1. Command variant 1: Commands on the chair</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#command-variant-2-command-on-character">13.3.2. Command variant 2: Command on Character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Tutorial-World.html">2. The Tutorial World</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Tutorial-World.html#gameplay">2.1. Gameplay</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Tutorial-World.html#gameplay-hints">2.1.1. Gameplay hints</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Tutorial-World.html#once-you-are-done-or-had-enough">2.2. Once you are done (or had enough)</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Tutorial-World.html#uninstall-the-tutorial-world">2.3. Uninstall the tutorial world</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html">3. Intro to using Python with Evennia</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#evennia-hello-world">3.1. Evennia Hello world</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#making-some-text-graphics">3.2. Making some text ‘graphics’</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#format">3.2.1. .format()</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#f-strings">3.2.2. f-strings</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#colored-text">3.2.3. Colored text</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#importing-code-from-other-modules">3.3. Importing code from other modules</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#our-first-own-function">3.3.1. Our first own function</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#sending-text-to-others">3.4. Sending text to others</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#parsing-python-errors">3.5. Parsing Python errors</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#passing-arguments-to-functions">3.6. Passing arguments to functions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#finding-others-to-send-to">3.7. Finding others to send to</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#multi-line-py">3.8. Multi-line py</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#other-ways-to-test-python-code">3.9. Other ways to test Python code</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#ipython">3.10. ipython</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-basic-introduction.html#conclusions">3.11. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html">4. Overview of your new Game Dir</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#commands">4.1. commands/</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#server">4.2. server/</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#server-logs">4.2.1. server/logs/</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#server-conf">4.2.2. server/conf/</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#typeclasses">4.2.3. typeclasses/</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#web">4.2.4. web/</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Gamedir-Overview.html#world">4.2.5. world/</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html">5. Introduction to Python classes and objects</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#importing-things">5.1. Importing things</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#on-classes-and-objects">5.2. On classes and objects</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#classes-and-instances">5.2.1. Classes and instances</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#whats-so-good-about-objects">5.2.2. What’s so good about objects?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#classes-can-have-children">5.2.3. Classes can have children</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Python-classes-and-objects.html#summary">5.3. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Evennia-Library-Overview.html">6. Overview of the Evennia library</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Evennia-Library-Overview.html#where-is-it">6.1. Where is it?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Evennia-Library-Overview.html#an-example-of-exploring-the-library">6.2. An example of exploring the library</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Evennia-Library-Overview.html#conclusions">6.3. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html">7. Making objects persistent</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#our-first-persistent-object">7.1. Our first persistent object</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#making-a-new-object-by-calling-the-class">7.1.1. Making a new object by calling the class</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#creating-using-create-object">7.1.2. Creating using create_object</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#creating-using-create-command">7.1.3. Creating using create-command</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#typeclasses">7.2. Typeclasses</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#examining-objects">7.2.1. Examining objects</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#default-typeclasses">7.2.2. Default typeclasses</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#modifying-ourselves">7.3. Modifying ourselves</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#a-method-on-ourselves">7.3.1. A method on ourselves</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#attributes">7.3.2. Attributes</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#setting-things-on-new-characters">7.3.3. Setting things on new Characters</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#updating-all-characters-in-a-loop">7.3.4. Updating all Characters in a loop</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#extra-credits">7.4. Extra Credits</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Learning-Typeclasses.html#conclusions">7.5. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Adding-Commands.html">8. Adding custom commands</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Adding-Commands.html#creating-a-custom-command">8.1. Creating a custom command</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Adding-Commands.html#making-our-cmdset-persistent">8.1.1. Making our cmdset persistent</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Adding-Commands.html#figuring-out-who-to-hit">8.1.2. Figuring out who to hit</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Adding-Commands.html#summary">8.2. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html">9. Parsing Command input</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#more-advanced-parsing">9.1. More advanced parsing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#adding-a-command-to-an-object">9.2. Adding a Command to an object</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#you-need-to-hold-the-sword">9.2.1. You need to hold the sword!</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#adding-the-command-to-a-default-cmdset">9.3. Adding the Command to a default Cmdset</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#removing-commands">9.3.1. Removing Commands</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#replace-a-default-command">9.4. Replace a default command</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-More-on-Commands.html#summary">9.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html">10. Creating things</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-objects">10.1. Creating Objects</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Creating-Things.html#creating-accounts">10.2. Creating Accounts</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html">11. Searching for things</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#main-search-functions">11.1. Main search functions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#searching-using-object-search">11.2. Searching using Object.search</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#what-can-be-searched-for">11.3. What can be searched for</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-key">11.3.1. Search by key</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-aliases">11.3.2. Search by aliases</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-location">11.3.3. Search by location</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-tags">11.3.4. Search by Tags</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-attribute">11.3.5. Search by Attribute</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-typeclass">11.3.6. Search by Typeclass</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#search-by-dbref">11.3.7. Search by dbref</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#finding-objects-relative-each-other">11.4. Finding objects relative each other</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Searching-Things.html#summary">11.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html">12. Advanced searching - Django Database queries</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#queryset-field-lookups">12.1. Queryset field lookups</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#get-that-werewolf">12.2. Get that werewolf …</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#complex-queries">12.3. Complex queries</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#annotations">12.4. Annotations</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#f-objects">12.5. F-objects</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#grouping-and-returning-only-certain-properties">12.6. Grouping and returning only certain properties</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Django-queries.html#conclusions">12.7. Conclusions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part1/Beginner-Tutorial-Making-A-Sittable-Object.html#conclusions">13.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -536,438 +404,225 @@ Click here to expand a list of all Beginner-Tutorial sections (all parts).
|
|||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Part2/Beginner-Tutorial-Part2-Intro.html">Part 2: What we want</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part2/Beginner-Tutorial-Part2-Intro.html#lessons">Lessons</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html">Where do I begin?</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-is-your-motivation-for-doing-this">What is your motivation for doing this?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-are-your-skills">What are your skills?</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#the-game-engine">The game engine</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#asset-creation">Asset creation</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html">1. Where do I begin?</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-is-your-motivation-for-doing-this">1.1. What is your motivation for doing this?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-are-your-skills">1.2. What are your skills?</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#the-game-engine">1.2.1. The game engine</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#asset-creation">1.2.2. Asset creation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#so-where-do-i-begin-then">So, where do I begin, then?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#conclusions">Conclusions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#so-where-do-i-begin-then">1.3. So, where do I begin, then?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#conclusions">1.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html">On Planning a Game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#the-steps">The steps</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning">Planning</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#administration">Administration</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#building">Building</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#systems">Systems</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#rooms">Rooms</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#objects-items">Objects / items</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#characters">Characters</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html">2. On Planning a Game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#the-steps">2.1. The steps</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning">2.2. Planning</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#administration">2.2.1. Administration</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#building">2.2.2. Building</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#systems">2.2.3. Systems</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#rooms">2.2.4. Rooms</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#objects-items">2.2.5. Objects / items</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#characters">2.2.6. Characters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#coding-and-tech-demo">Coding and Tech demo</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#world-building">World Building</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#alpha-release">Alpha Release</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#beta-release-perpetual-beta">Beta Release/Perpetual Beta</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#congratulate-yourself">Congratulate yourself!</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning-our-tutorial-game">Planning our tutorial game</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#coding-and-tech-demo">2.3. Coding and Tech demo</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#world-building">2.4. World Building</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#alpha-release">2.5. Alpha Release</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#beta-release-perpetual-beta">2.6. Beta Release/Perpetual Beta</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#congratulate-yourself">2.7. Congratulate yourself!</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning-our-tutorial-game">2.8. Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html">Planning our tutorial game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#game-concept">Game concept</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#administration">Administration</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html">3. Planning our tutorial game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#game-concept">3.1. Game concept</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#administration">3.2. Administration</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">3.2.1. Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">3.2.2. What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">3.2.3. Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#building">Building</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-will-the-world-be-built">How will the world be built?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#building">3.3. Building</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-will-the-world-be-built">3.3.1. How will the world be built?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">3.3.2. Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#systems">Systems</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-have-concepts-like-reputation-and-influence">Do you have concepts like reputation and influence?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#systems">3.4. Systems</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">3.4.1. Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">3.4.2. What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">3.4.3. Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">3.4.4. Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">3.4.5. Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-have-concepts-like-reputation-and-influence">3.4.6. Do you have concepts like reputation and influence?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">3.4.7. Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#rooms">Rooms</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-the-room-have-different-statuses">Should the room have different statuses?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#rooms">3.5. Rooms</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">3.5.1. Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-the-room-have-different-statuses">3.5.2. Should the room have different statuses?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">3.5.3. Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#objects">Objects</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-broken-can-they-be-repaired">Can objects be broken? Can they be repaired?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-characters-be-able-to-craft-new-objects">Will characters be able to craft new objects?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-mobs-npcs-have-some-sort-of-ai">Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#are-npcs-and-mobs-different-entities-how-do-they-differ">Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">_Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#objects">3.6. Objects</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">3.6.1. How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">3.6.2. Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">3.6.3. Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">3.6.4. Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-broken-can-they-be-repaired">3.6.5. Can objects be broken? Can they be repaired?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">3.6.6. Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-characters-be-able-to-craft-new-objects">3.6.7. Will characters be able to craft new objects?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-mobs-npcs-have-some-sort-of-ai">3.6.8. Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#are-npcs-and-mobs-different-entities-how-do-they-differ">3.6.9. Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">3.6.10. _Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#characters">Characters</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-does-the-character-generation-work">How does the character-generation work?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-do-you-implement-different-classes-or-races">How do you implement different “classes” or “races”?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#may-player-characters-attack-each-other-pvp">May player-characters attack each other (PvP)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#characters">3.7. Characters</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">3.7.1. Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-does-the-character-generation-work">3.7.2. How does the character-generation work?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-do-you-implement-different-classes-or-races">3.7.3. How do you implement different “classes” or “races”?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">3.7.4. If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">3.7.5. What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#may-player-characters-attack-each-other-pvp">3.7.6. May player-characters attack each other (PvP)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">3.7.7. What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#conclusions">Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part2/Beginner-Tutorial-Part2-Intro.html#table-of-contents">Table of Contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html">Where do I begin?</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-is-your-motivation-for-doing-this">What is your motivation for doing this?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-are-your-skills">What are your skills?</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#the-game-engine">The game engine</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#asset-creation">Asset creation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#so-where-do-i-begin-then">So, where do I begin, then?</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-Where-Do-I-Begin.html#conclusions">Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html">On Planning a Game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#the-steps">The steps</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning">Planning</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#administration">Administration</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#building">Building</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#systems">Systems</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#rooms">Rooms</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#objects-items">Objects / items</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#characters">Characters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#coding-and-tech-demo">Coding and Tech demo</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#world-building">World Building</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#alpha-release">Alpha Release</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#beta-release-perpetual-beta">Beta Release/Perpetual Beta</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#congratulate-yourself">Congratulate yourself!</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Game-Planning.html#planning-our-tutorial-game">Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html">Planning our tutorial game</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#game-concept">Game concept</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#administration">Administration</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#building">Building</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-will-the-world-be-built">How will the world be built?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#systems">Systems</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-have-concepts-like-reputation-and-influence">Do you have concepts like reputation and influence?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#rooms">Rooms</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-the-room-have-different-statuses">Should the room have different statuses?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#objects">Objects</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-broken-can-they-be-repaired">Can objects be broken? Can they be repaired?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-characters-be-able-to-craft-new-objects">Will characters be able to craft new objects?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-mobs-npcs-have-some-sort-of-ai">Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#are-npcs-and-mobs-different-entities-how-do-they-differ">Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">_Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#characters">Characters</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-does-the-character-generation-work">How does the character-generation work?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-do-you-implement-different-classes-or-races">How do you implement different “classes” or “races”?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#may-player-characters-attack-each-other-pvp">May player-characters attack each other (PvP)?</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#conclusions">Conclusions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html#conclusions">3.8. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Part3/Beginner-Tutorial-Part3-Intro.html">Part 3: How we get there</a><ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Part3/Beginner-Tutorial-Part3-Intro.html">Part 3: How we get there (example game)</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part3/Beginner-Tutorial-Part3-Intro.html#lessons">Lessons</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html">Code structure and Utilities</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#folder-structure">Folder structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#enums">Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#utility-module">Utility module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#running-your-test">Running your test</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html">1. Code structure and Utilities</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#folder-structure">1.1. Folder structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#enums">1.2. Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#utility-module">1.3. Utility module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#testing">1.4. Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#running-your-test">1.4.1. Running your test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#summary">Summary</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#summary">1.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html">Rules and dice rolling</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary-of-knave-rules">Summary of <em>Knave</em> rules</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#making-a-rule-module">Making a rule module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-dice">Rolling dice</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#generic-dice-roller">Generic dice roller</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-with-advantage">Rolling with advantage</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#saving-throws">Saving throws</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#opposed-saving-throw">Opposed saving throw</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#morale-check">Morale check</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-healing">Roll for Healing</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-on-a-table">Rolling on a table</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-death">Roll for death</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html">2. Rules and dice rolling</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary-of-knave-rules">2.1. Summary of <em>Knave</em> rules</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#making-a-rule-module">2.2. Making a rule module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-dice">2.3. Rolling dice</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#generic-dice-roller">2.3.1. Generic dice roller</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-with-advantage">2.3.2. Rolling with advantage</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#saving-throws">2.3.3. Saving throws</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#opposed-saving-throw">2.3.4. Opposed saving throw</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#morale-check">2.3.5. Morale check</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-healing">2.3.6. Roll for Healing</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-on-a-table">2.3.7. Rolling on a table</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-death">2.3.8. Roll for death</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#mocking-and-patching">Mocking and patching</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#testing">2.4. Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#mocking-and-patching">2.4.1. Mocking and patching</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary">Summary</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary">2.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html">Player Characters</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#inheritance-structure">Inheritance structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#living-mixin-class">Living mixin class</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#character-class">Character class</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#funcparser-inlines">Funcparser inlines</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#backtracking">Backtracking</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html">3. Player Characters</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#inheritance-structure">3.1. Inheritance structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#living-mixin-class">3.2. Living mixin class</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#character-class">3.3. Character class</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#funcparser-inlines">3.3.1. Funcparser inlines</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#backtracking">3.3.2. Backtracking</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#connecting-the-character-with-evennia">Connecting the Character with Evennia</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#about-races-and-classes">About races and classes</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#summary">Summary</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#connecting-the-character-with-evennia">3.4. Connecting the Character with Evennia</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#unit-testing">3.5. Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#about-races-and-classes">3.6. About races and classes</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#summary">3.7. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html">In-game Objects and items</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#new-enums">New Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#the-base-object">The base object</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#using-attributes-or-not">Using Attributes or not</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#creating-tags-in-at-object-creation">Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html">4. In-game Objects and items</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#new-enums">4.1. New Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#the-base-object">4.2. The base object</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#using-attributes-or-not">4.2.1. Using Attributes or not</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#creating-tags-in-at-object-creation">4.2.2. Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#other-object-types">Other object types</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#consumables">Consumables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#weapons">Weapons</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#magic">Magic</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#armor">Armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#your-bare-hands">Your Bare hands</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#testing-and-extra-credits">Testing and Extra credits</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#other-object-types">4.3. Other object types</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#consumables">4.4. Consumables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#weapons">4.5. Weapons</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#magic">4.6. Magic</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#armor">4.7. Armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#your-bare-hands">4.8. Your Bare hands</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#testing-and-extra-credits">4.9. Testing and Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html">Handling Equipment</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#equipmenthandler-that-saves">EquipmentHandler that saves</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#connecting-the-equipmenthandler">Connecting the EquipmentHandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#expanding-the-equipmenthandler">Expanding the Equipmenthandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validate-slot-usage"><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#max-slots"><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#count-slots"><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validating-slots">Validating slots</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html">5. Handling Equipment</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#equipmenthandler-that-saves">5.1. EquipmentHandler that saves</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#connecting-the-equipmenthandler">5.2. Connecting the EquipmentHandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#expanding-the-equipmenthandler">5.3. Expanding the Equipmenthandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validate-slot-usage">5.4. <code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#max-slots">5.4.1. <code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#count-slots">5.4.2. <code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validating-slots">5.4.3. Validating slots</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#add-and-remove"><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#moving-things-around">Moving things around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#get-everything">Get everything</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#weapon-and-armor">Weapon and armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#extra-credits">Extra credits</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#summary">Summary</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#add-and-remove">5.5. <code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#moving-things-around">5.6. Moving things around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#get-everything">5.7. Get everything</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#weapon-and-armor">5.8. Weapon and armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#extra-credits">5.9. Extra credits</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#unit-testing">5.10. Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#summary">5.11. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html">Character Generation</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#how-it-will-work">How it will work</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#random-tables">Random tables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#storing-state-of-the-menu">Storing state of the menu</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#showing-the-sheet">Showing the sheet</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#apply-character">Apply character</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html">6. Character Generation</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#how-it-will-work">6.1. How it will work</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#random-tables">6.2. Random tables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#storing-state-of-the-menu">6.3. Storing state of the menu</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#showing-the-sheet">6.3.1. Showing the sheet</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#apply-character">6.3.2. Apply character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#initializing-evmenu">Initializing EvMenu</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#main-node-choosing-what-to-do">Main Node: Choosing what to do</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-changing-your-name">Node: Changing your name</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-swapping-abilities-around">Node: Swapping Abilities around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-creating-the-character">Node: Creating the Character</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#tying-the-nodes-together">Tying the nodes together</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#conclusions">Conclusions</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#initializing-evmenu">6.4. Initializing EvMenu</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#main-node-choosing-what-to-do">6.5. Main Node: Choosing what to do</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-changing-your-name">6.6. Node: Changing your name</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-swapping-abilities-around">6.7. Node: Swapping Abilities around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-creating-the-character">6.8. Node: Creating the Character</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#tying-the-nodes-together">6.9. Tying the nodes together</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#conclusions">6.10. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rooms.html">In-game Rooms</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-NPCs.html">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Quests.html">Game Quests</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Shops.html">In-game Shops</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Dungeon.html">Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Commands.html">In-game Commands</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part3/Beginner-Tutorial-Part3-Intro.html#table-of-contents">Table of Contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html">Code structure and Utilities</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#folder-structure">Folder structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#enums">Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#utility-module">Utility module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#running-your-test">Running your test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Utilities.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html">Rules and dice rolling</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary-of-knave-rules">Summary of <em>Knave</em> rules</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#making-a-rule-module">Making a rule module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-dice">Rolling dice</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#generic-dice-roller">Generic dice roller</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-with-advantage">Rolling with advantage</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#saving-throws">Saving throws</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#opposed-saving-throw">Opposed saving throw</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#morale-check">Morale check</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-healing">Roll for Healing</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#rolling-on-a-table">Rolling on a table</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#roll-for-death">Roll for death</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#mocking-and-patching">Mocking and patching</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Rules.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html">Player Characters</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#inheritance-structure">Inheritance structure</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#living-mixin-class">Living mixin class</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#character-class">Character class</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#funcparser-inlines">Funcparser inlines</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#backtracking">Backtracking</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#connecting-the-character-with-evennia">Connecting the Character with Evennia</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#about-races-and-classes">About races and classes</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Characters.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html">In-game Objects and items</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#new-enums">New Enums</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#the-base-object">The base object</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#using-attributes-or-not">Using Attributes or not</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#creating-tags-in-at-object-creation">Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#other-object-types">Other object types</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#consumables">Consumables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#weapons">Weapons</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#magic">Magic</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#armor">Armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#your-bare-hands">Your Bare hands</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Objects.html#testing-and-extra-credits">Testing and Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html">Handling Equipment</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#equipmenthandler-that-saves">EquipmentHandler that saves</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#connecting-the-equipmenthandler">Connecting the EquipmentHandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#expanding-the-equipmenthandler">Expanding the Equipmenthandler</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validate-slot-usage"><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#max-slots"><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#count-slots"><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#validating-slots">Validating slots</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#add-and-remove"><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#moving-things-around">Moving things around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#get-everything">Get everything</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#weapon-and-armor">Weapon and armor</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#extra-credits">Extra credits</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Equipment.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html">Character Generation</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#how-it-will-work">How it will work</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#random-tables">Random tables</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#storing-state-of-the-menu">Storing state of the menu</a><ul>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#showing-the-sheet">Showing the sheet</a></li>
|
||||
<li class="toctree-l5"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#apply-character">Apply character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#initializing-evmenu">Initializing EvMenu</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#main-node-choosing-what-to-do">Main Node: Choosing what to do</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-changing-your-name">Node: Changing your name</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-swapping-abilities-around">Node: Swapping Abilities around</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#node-creating-the-character">Node: Creating the Character</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#tying-the-nodes-together">Tying the nodes together</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part3/Beginner-Tutorial-Chargen.html#conclusions">Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rooms.html">In-game Rooms</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-NPCs.html">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Quests.html">Game Quests</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Shops.html">In-game Shops</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Dungeon.html">Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Commands.html">In-game Commands</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Rooms.html">7. In-game Rooms</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-NPCs.html">8. Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Quests.html">9. Game Quests</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Shops.html">10. In-game Shops</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Dungeon.html">11. Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part3/Beginner-Tutorial-Commands.html">12. In-game Commands</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Part4/Beginner-Tutorial-Part4-Intro.html">Part 4: Using what we created</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part4/Beginner-Tutorial-Part4-Intro.html#lessons">Lessons</a><ul class="simple">
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part4/Beginner-Tutorial-Part4-Intro.html#table-of-contents">Table of Contents</a><ul class="simple">
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part4/Beginner-Tutorial-Part4-Intro.html#lessons">Lessons</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="../../Unimplemented.html">1. Unimplemented</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Part5/Beginner-Tutorial-Part5-Intro.html">Part 5: Showing the world</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part5/Beginner-Tutorial-Part5-Intro.html#lessons">Lessons</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html">Add a simple new web page</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#create-the-view">Create the view</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-html-page">The HTML page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-url">The URL</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html">1. Add a simple new web page</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#create-the-view">1.1. Create the view</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-html-page">1.2. The HTML page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-url">1.3. The URL</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Web-Tutorial.html">Web Tutorial</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#a-basic-overview">A Basic Overview</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-logo-on-the-front-page">Changing the logo on the front page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-front-pages-text">Changing the Front Page’s Text</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#further-reading">Further reading</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Part5/Beginner-Tutorial-Part5-Intro.html#table-of-contents">Table of Contents</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html">Add a simple new web page</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#create-the-view">Create the view</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-html-page">The HTML page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Add-a-simple-new-web-page.html#the-url">The URL</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Web-Tutorial.html">Web Tutorial</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#a-basic-overview">A Basic Overview</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-logo-on-the-front-page">Changing the logo on the front page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-front-pages-text">Changing the Front Page’s Text</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#further-reading">Further reading</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Part5/Web-Tutorial.html">2. Web Tutorial</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#a-basic-overview">2.1. A Basic Overview</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-logo-on-the-front-page">2.2. Changing the logo on the front page</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#changing-the-front-pages-text">2.3. Changing the Front Page’s Text</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="Part5/Web-Tutorial.html#further-reading">2.4. Further reading</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -356,26 +356,26 @@ You hit <target> with full force!
|
|||
<span class="normal">22</span>
|
||||
<span class="normal">23</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># ...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdHit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Hit a target.</span>
|
||||
<span class="hll"><span class="k">class</span> <span class="nc">CmdHit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
</span><span class="hll"> <span class="sd">"""</span>
|
||||
</span><span class="sd"> Hit a target.</span>
|
||||
|
||||
<span class="sd"> Usage:</span>
|
||||
<span class="sd"> hit <target></span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"hit"</span>
|
||||
|
||||
<span class="hll"> <span class="n">key</span> <span class="o">=</span> <span class="s2">"hit"</span>
|
||||
</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">args</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"Who do you want to hit?"</span><span class="p">)</span>
|
||||
<span class="k">return</span>
|
||||
<span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">target</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You hit </span><span class="si">{</span><span class="n">target</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
<span class="n">target</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You got hit by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
<span class="hll"> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
</span><span class="hll"> <span class="k">if</span> <span class="ow">not</span> <span class="n">args</span><span class="p">:</span>
|
||||
</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"Who do you want to hit?"</span><span class="p">)</span>
|
||||
<span class="hll"> <span class="k">return</span>
|
||||
</span><span class="hll"> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
|
||||
</span><span class="hll"> <span class="k">if</span> <span class="ow">not</span> <span class="n">target</span><span class="p">:</span>
|
||||
</span> <span class="k">return</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You hit </span><span class="si">{</span><span class="n">target</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
</span> <span class="n">target</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You got hit by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with full force!"</span><span class="p">)</span>
|
||||
<span class="c1"># ...</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,14 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">10. Creating things</a><ul>
|
||||
<li><a class="reference internal" href="#creating-objects">10.1. Creating Objects</a></li>
|
||||
<li><a class="reference internal" href="#creating-accounts">10.2. Creating Accounts</a></li>
|
||||
<li><a class="reference internal" href="#creating-rooms-characters-and-exits">10.2. Creating Rooms, Characters and Exits</a><ul>
|
||||
<li><a class="reference internal" href="#linking-exits-and-rooms-in-code">10.2.1. Linking Exits and Rooms in code</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#creating-accounts">10.3. Creating Accounts</a></li>
|
||||
<li><a class="reference internal" href="#creating-channels">10.4. Creating Channels</a></li>
|
||||
<li><a class="reference internal" href="#creating-scripts">10.5. Creating Scripts</a></li>
|
||||
<li><a class="reference internal" href="#conclusion">10.6. Conclusion</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -109,9 +116,46 @@
|
|||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="creating-things">
|
||||
<h1><span class="section-number">10. </span>Creating things<a class="headerlink" href="#creating-things" title="Permalink to this headline">¶</a></h1>
|
||||
<p>We have already created some things - dragons for example. There are many different things to create
|
||||
in Evennia though. In the last lesson we learned about typeclasses, the way to make objects persistent in the database.</p>
|
||||
<p>Given the path to a Typeclass, there are three ways to create an instance of it:</p>
|
||||
<p>We have already created some things - dragons for example. There are many different things to create in Evennia though. In the <a class="reference internal" href="Beginner-Tutorial-Learning-Typeclasses.html"><span class="doc std std-doc">Typeclasses tutorial</span></a>, we noted that there are 7 default Typeclasses coming with Evennia out of the box:</p>
|
||||
<table class="colwidths-auto docutils align-default">
|
||||
<thead>
|
||||
<tr class="row-odd"><th class="head"><p>Evennia base typeclass</p></th>
|
||||
<th class="head"><p>mygame.typeclasses child</p></th>
|
||||
<th class="head"><p>description</p></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultObject</span></code></p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.objects.Object</span></code></p></td>
|
||||
<td><p>Everything with a location</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultCharacter</span></code> (child of <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>)</p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.characters.Character</span></code></p></td>
|
||||
<td><p>Player avatars</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultRoom</span></code> (child of <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>)</p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.rooms.Room</span></code></p></td>
|
||||
<td><p>In-game locations</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultExit</span></code> (chld of <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>)</p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.exits.Exit</span></code></p></td>
|
||||
<td><p>Links between rooms</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultAccount</span></code></p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.accounts.Account</span></code></p></td>
|
||||
<td><p>A player account</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultChannel</span></code></p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.channels.Channel</span></code></p></td>
|
||||
<td><p>In-game comms</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">evennia.DefaultScript</span></code></p></td>
|
||||
<td><p><code class="docutils literal notranslate"><span class="pre">typeclasses.scripts.Script</span></code></p></td>
|
||||
<td><p>Entities with no location</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Given you have an imported Typeclass, there are four ways to create an instance of it:</p>
|
||||
<ul>
|
||||
<li><p>Firstly, you can call the class directly, and then <code class="docutils literal notranslate"><span class="pre">.save()</span></code> it:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> obj = SomeTypeClass(db_key=...)
|
||||
|
|
@ -119,42 +163,142 @@ in Evennia though. In the last lesson we learned about typeclasses, the way to m
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>This has the drawback of being two operations; you must also import the class and have to pass
|
||||
the actual database field names, such as <code class="docutils literal notranslate"><span class="pre">db_key</span></code> instead of <code class="docutils literal notranslate"><span class="pre">key</span></code> as keyword arguments.</p>
|
||||
the actual database field names, such as <code class="docutils literal notranslate"><span class="pre">db_key</span></code> instead of <code class="docutils literal notranslate"><span class="pre">key</span></code> as keyword arguments. This is closest to how a ‘normal’ Python class works, but is not recommended.</p>
|
||||
</li>
|
||||
<li><p>Secondly you can use the Evennia creation helpers:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> obj = evennia.create_object(SomeTypeClass, key=...)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This is the recommended way if you are trying to create things in Python. The first argument can either be
|
||||
the class <em>or</em> the python-path to the typeclass, like <code class="docutils literal notranslate"><span class="pre">"path.to.SomeTypeClass"</span></code>. It can also be <code class="docutils literal notranslate"><span class="pre">None</span></code> in which
|
||||
case the Evennia default will be used. While all the creation methods
|
||||
are available on <code class="docutils literal notranslate"><span class="pre">evennia</span></code>, they are actually implemented in <a class="reference internal" href="../../../api/evennia.utils.create.html"><span class="doc std std-doc">evennia/utils/create.py</span></a>.</p>
|
||||
<p>This is the recommended way if you are trying to create things in Python. The first argument can either be the class <em>or</em> the python-path to the typeclass, like <code class="docutils literal notranslate"><span class="pre">"path.to.SomeTypeClass"</span></code>. It can also be <code class="docutils literal notranslate"><span class="pre">None</span></code> in which case the Evennia default will be used. While all the creation methods
|
||||
are available on <code class="docutils literal notranslate"><span class="pre">evennia</span></code>, they are actually implemented in <a class="reference internal" href="../../../api/evennia.utils.create.html"><span class="doc std std-doc">evennia/utils/create.py</span></a>. Each of the different base classes have their own creation function, like <code class="docutils literal notranslate"><span class="pre">create_account</span></code> and <code class="docutils literal notranslate"><span class="pre">create_script</span></code> etc.</p>
|
||||
</li>
|
||||
<li><p>Finally, you can create objects using an in-game command, such as</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> create/drop obj:path.to.SomeTypeClass
|
||||
<li><p>Thirdly, you can use the <code class="docutils literal notranslate"><span class="pre">.create</span></code> method on the Typeclass itself:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">obj</span><span class="p">,</span> <span class="n">err</span> <span class="o">=</span> <span class="n">SomeTypeClass</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">key</span><span class="o">=...</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>As a developer you are usually best off using the two other methods, but a command is usually the only way
|
||||
to let regular players or builders without Python-access help build the game world.</p>
|
||||
<p>Since <code class="docutils literal notranslate"><span class="pre">.create</span></code> is a method on the typeclass, this form is useful if you want to customize how the creation process works for your custom typeclasses. Note that it returns <em>two</em> values - the <code class="docutils literal notranslate"><span class="pre">obj</span></code> is either the new object or <code class="docutils literal notranslate"><span class="pre">None</span></code>, in which case <code class="docutils literal notranslate"><span class="pre">err</span></code> should be a list of error-strings detailing what went wrong.</p>
|
||||
</li>
|
||||
<li><p>Finally, you can create objects using an in-game command, such as</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> create obj:path.to.SomeTypeClass
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>As a developer you are usually best off using the other methods, but a command is usually the only way to let regular players or builders without Python-access help build the game world.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<section id="creating-objects">
|
||||
<h2><span class="section-number">10.1. </span>Creating Objects<a class="headerlink" href="#creating-objects" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This is one of the most common creation-types. These are entities that inherits from <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code> at any distance.
|
||||
They have an existence in the game world and includes rooms, characters, exits, weapons, flower pots and castles.</p>
|
||||
<p>An <a class="reference internal" href="../../../Components/Objects.html"><span class="doc std std-doc">Object</span></a> is one of the most common creation-types. These are entities that inherits from <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code> at any distance. They have an existence in the game world and includes rooms, characters, exits, weapons, flower pots and castles.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> py
|
||||
> import evennia
|
||||
> rose = evennia.create_object(key="rose")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Since we didn’t specify the <code class="docutils literal notranslate"><span class="pre">typeclass</span></code> as the first argument, the default given by <code class="docutils literal notranslate"><span class="pre">settings.BASE_OBJECT_TYPECLASS</span></code>
|
||||
(<code class="docutils literal notranslate"><span class="pre">typeclasses.objects.Object</span></code>) will be used.</p>
|
||||
<p>Since we didn’t specify the <code class="docutils literal notranslate"><span class="pre">typeclass</span></code> as the first argument, the default given by <code class="docutils literal notranslate"><span class="pre">settings.BASE_OBJECT_TYPECLASS</span></code> (<code class="docutils literal notranslate"><span class="pre">typeclasses.objects.Object</span></code> out of the box) will be used.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">create_object</span></code> has <a class="reference internal" href="../../../api/evennia.utils.create.html#evennia.utils.create.create_object" title="evennia.utils.create.create_object"><span class="xref myst py py-func">a lot of options</span></a>. A more detailed example in code:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_object</span><span class="p">,</span> <span class="n">search_object</span>
|
||||
|
||||
<span class="n">meadow</span> <span class="o">=</span> <span class="n">search_object</span><span class="p">(</span><span class="s2">"Meadow"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
|
||||
|
||||
<span class="n">lasgun</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="s2">"typeclasses.objects.guns.LasGun"</span><span class="p">,</span>
|
||||
<span class="n">key</span><span class="o">=</span><span class="s2">"lasgun"</span><span class="p">,</span>
|
||||
<span class="n">location</span><span class="o">=</span><span class="n">meadow</span><span class="p">,</span>
|
||||
<span class="n">attributes</span><span class="o">=</span><span class="p">[(</span><span class="s2">"desc"</span><span class="p">,</span> <span class="s2">"A fearsome Lasgun."</span><span class="p">)])</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Here we set the location of a weapon as well as gave it an <a class="reference internal" href="../../../Components/Attributes.html"><span class="doc std std-doc">Attribute</span></a> <code class="docutils literal notranslate"><span class="pre">desc</span></code>, which is what the <code class="docutils literal notranslate"><span class="pre">look</span></code> command will use when looking this and other things.</p>
|
||||
</section>
|
||||
<section id="creating-rooms-characters-and-exits">
|
||||
<h2><span class="section-number">10.2. </span>Creating Rooms, Characters and Exits<a class="headerlink" href="#creating-rooms-characters-and-exits" title="Permalink to this headline">¶</a></h2>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">Characters</span></code>, <code class="docutils literal notranslate"><span class="pre">Rooms</span></code> and <code class="docutils literal notranslate"><span class="pre">Exits</span></code> are all subclasses of <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>. So there is for example no separate <code class="docutils literal notranslate"><span class="pre">create_character</span></code>, you just create characters with <code class="docutils literal notranslate"><span class="pre">create_object</span></code> pointing to the <code class="docutils literal notranslate"><span class="pre">Character</span></code> typeclass.</p>
|
||||
<section id="linking-exits-and-rooms-in-code">
|
||||
<h3><span class="section-number">10.2.1. </span>Linking Exits and Rooms in code<a class="headerlink" href="#linking-exits-and-rooms-in-code" title="Permalink to this headline">¶</a></h3>
|
||||
<p>An <code class="docutils literal notranslate"><span class="pre">Exit</span></code> is a one-way link between rooms. For example, <code class="docutils literal notranslate"><span class="pre">east</span></code> could be an <code class="docutils literal notranslate"><span class="pre">Exit</span></code> between the <code class="docutils literal notranslate"><span class="pre">Forest</span></code> room and the <code class="docutils literal notranslate"><span class="pre">Meadow</span></code> room.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Meadow -> east -> Forest
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">east</span></code> exit has a <code class="docutils literal notranslate"><span class="pre">key</span></code> of <code class="docutils literal notranslate"><span class="pre">east</span></code>, a <code class="docutils literal notranslate"><span class="pre">location</span></code> of <code class="docutils literal notranslate"><span class="pre">Meadow</span></code> and a <code class="docutils literal notranslate"><span class="pre">destination</span></code> of <code class="docutils literal notranslate"><span class="pre">Forest</span></code>. If you wanted to be able to go back from Forest to Meadow, you’d need to create a new <code class="docutils literal notranslate"><span class="pre">Exit</span></code>, say, <code class="docutils literal notranslate"><span class="pre">west</span></code>, where <code class="docutils literal notranslate"><span class="pre">location</span></code> is <code class="docutils literal notranslate"><span class="pre">Forest</span></code> and <code class="docutils literal notranslate"><span class="pre">destination</span></code> is <code class="docutils literal notranslate"><span class="pre">Meadow</span></code>.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Meadow -> east -> Forest
|
||||
Forest -> west -> Meadow
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>In-game you do this with <code class="docutils literal notranslate"><span class="pre">tunnel</span></code> and <code class="docutils literal notranslate"><span class="pre">dig</span></code> commands, bit if you want to ever set up these links in code, you can do it like this:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_object</span>
|
||||
<span class="kn">from</span> <span class="nn">mygame.typeclasses</span> <span class="kn">import</span> <span class="n">rooms</span><span class="p">,</span> <span class="n">exits</span>
|
||||
|
||||
<span class="c1"># rooms</span>
|
||||
<span class="n">meadow</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">rooms</span><span class="o">.</span><span class="n">Room</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"Meadow"</span><span class="p">)</span>
|
||||
<span class="n">forest</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">rooms</span><span class="o">.</span><span class="n">Room</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"Forest"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># exits </span>
|
||||
<span class="n">create_object</span><span class="p">(</span><span class="n">exits</span><span class="o">.</span><span class="n">Exit</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"east"</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="n">meadow</span><span class="p">,</span> <span class="n">destination</span><span class="o">=</span><span class="n">forest</span><span class="p">)</span>
|
||||
<span class="n">create_object</span><span class="p">(</span><span class="n">exits</span><span class="o">.</span><span class="n">Exit</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"west"</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="n">forest</span><span class="p">,</span> <span class="n">destination</span><span class="o">=</span><span class="n">meadow</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<section id="creating-accounts">
|
||||
<h2><span class="section-number">10.2. </span>Creating Accounts<a class="headerlink" href="#creating-accounts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>An <em>Account</em> is an out-of-character (OOC) entity, with no existence in the game world.
|
||||
<h2><span class="section-number">10.3. </span>Creating Accounts<a class="headerlink" href="#creating-accounts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>An <a class="reference internal" href="../../../Components/Accounts.html"><span class="doc std std-doc">Account</span></a> is an out-of-character (OOC) entity, with no existence in the game world.
|
||||
You can find the parent class for Accounts in <code class="docutils literal notranslate"><span class="pre">typeclasses/accounts.py</span></code>.</p>
|
||||
<p><em>TODO</em></p>
|
||||
<p>Normally, you want to create the Account when a user authenticates. By default, this happens in the <code class="docutils literal notranslate"><span class="pre">create</span> <span class="pre">account</span></code> and <code class="docutils literal notranslate"><span class="pre">login</span></code> default commands in the <code class="docutils literal notranslate"><span class="pre">UnloggedInCmdSet</span></code>. This means that customizing this just means replacing those commands!</p>
|
||||
<p>So normally you’d modify those commands rather than make something from scratch. But here’s the principle:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_account</span>
|
||||
|
||||
<span class="n">new_account</span> <span class="o">=</span> <span class="n">create_account</span><span class="p">(</span>
|
||||
<span class="n">accountname</span><span class="p">,</span> <span class="n">email</span><span class="p">,</span> <span class="n">password</span><span class="p">,</span>
|
||||
<span class="n">permissions</span><span class="o">=</span><span class="p">[</span><span class="s2">"Player"</span><span class="p">],</span>
|
||||
<span class="n">typeclass</span><span class="o">=</span><span class="s2">"typeclasses.accounts.MyAccount"</span>
|
||||
<span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The inputs are usually taken from the player via the command. The <code class="docutils literal notranslate"><span class="pre">email</span></code> must be given, but can be <code class="docutils literal notranslate"><span class="pre">None</span></code> if you are not using it. The <code class="docutils literal notranslate"><span class="pre">accountname</span></code> must be globally unique on the server. The <code class="docutils literal notranslate"><span class="pre">password</span></code> is stored encrypted in the database. If <code class="docutils literal notranslate"><span class="pre">typeclass</span></code> is not given, the <code class="docutils literal notranslate"><span class="pre">settings.BASE_ACCOUNT_TYPECLASS</span></code> will be used (<code class="docutils literal notranslate"><span class="pre">typeclasses.accounts.Account</span></code>).</p>
|
||||
</section>
|
||||
<section id="creating-channels">
|
||||
<h2><span class="section-number">10.4. </span>Creating Channels<a class="headerlink" href="#creating-channels" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A <a class="reference internal" href="../../../Components/Channels.html"><span class="doc std std-doc">Channel</span></a> acts like a switchboard for sending in-game messages between users; like an IRC- or discord channel but inside the game.</p>
|
||||
<p>Users interact with channels via the <code class="docutils literal notranslate"><span class="pre">channel</span></code> command:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>channel/all
|
||||
channel/create channelname
|
||||
channel/who channelname
|
||||
channel/sub channel name
|
||||
...
|
||||
(see 'help channel')
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>If a channel named, say, <code class="docutils literal notranslate"><span class="pre">myguild</span></code> exists, a user can send a message to it just by writing the channel name:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> myguild Hello! I have some questions ...
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Creating channels follows a familiar syntax:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_channel</span>
|
||||
|
||||
<span class="n">new_channel</span> <span class="o">=</span> <span class="n">create_channel</span><span class="p">(</span><span class="n">channelname</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Channels can also be auto-created by the server by setting the <code class="docutils literal notranslate"><span class="pre">DEFAULT_CHANNELS</span></code> setting. See <a class="reference internal" href="../../../Components/Channels.html"><span class="doc std std-doc">Channels documentation</span></a> for details.</p>
|
||||
</section>
|
||||
<section id="creating-scripts">
|
||||
<h2><span class="section-number">10.5. </span>Creating Scripts<a class="headerlink" href="#creating-scripts" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A <a class="reference internal" href="../../../Components/Scripts.html"><span class="doc std std-doc">Script</span></a> is an entity that has no in-game location. It can be used to store arbitrary data and is often used for game systems that need persistent storage but which you can’t ‘look’ at in-game. Examples are economic systems, weather and combat handlers.</p>
|
||||
<p>Scripts are multi-use and depending on what they do, a given script can either be ‘global’ or be attached “to” another object (like a Room or Character).</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_script</span><span class="p">,</span> <span class="n">search_object</span>
|
||||
<span class="c1"># global script </span>
|
||||
<span class="n">new_script</span> <span class="o">=</span> <span class="n">create_script</span><span class="p">(</span><span class="s2">"typeclasses.scripts.MyScript"</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"myscript"</span><span class="p">)</span>
|
||||
|
||||
<span class="c1"># on-object script </span>
|
||||
<span class="n">meadow</span> <span class="o">=</span> <span class="n">search_object</span><span class="p">(</span><span class="s2">"Meadow"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">new_script</span> <span class="o">=</span> <span class="n">create_script</span><span class="p">(</span><span class="s2">"typeclasses.scripts.MyScripts"</span><span class="p">,</span>
|
||||
<span class="n">key</span><span class="s2">"myscript2"</span><span class="p">,</span> <span class="n">obj</span><span class="o">=</span><span class="n">meadow</span><span class="p">)</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>A convenient way to create global scripts is define them in the <code class="docutils literal notranslate"><span class="pre">GLOBAL_SCRIPTS</span></code> setting; Evennia will then make sure to initialize them. Scripts also have an optional ‘timer’ component. See the dedicated <a class="reference internal" href="../../../Components/Scripts.html"><span class="doc std std-doc">Script</span></a> documentation for more info.</p>
|
||||
</section>
|
||||
<section id="conclusion">
|
||||
<h2><span class="section-number">10.6. </span>Conclusion<a class="headerlink" href="#conclusion" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Any game will need peristent storage of data. This was a quick run-down of how to create each default type of typeclassed entity. If you make your own typeclasses (as children of the default ones), you create them in the same way.</p>
|
||||
<p>Next we’ll learn how to find them again by <em>searching</em> for them in the database.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Part 2: What we want" href="../Part2/Beginner-Tutorial-Part2-Intro.html" />
|
||||
<link rel="next" title="13. Building a chair you can sit on" href="Beginner-Tutorial-Making-A-Sittable-Object.html" />
|
||||
<link rel="prev" title="11. Searching for things" href="Beginner-Tutorial-Searching-Things.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
<a href="Beginner-Tutorial-Making-A-Sittable-Object.html" title="13. Building a chair you can sit on"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Searching-Things.html" title="11. Searching for things"
|
||||
|
|
@ -66,8 +66,8 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">12. Advanced searching - Django Database queries</a><ul>
|
||||
<li><a class="reference internal" href="#queryset-field-lookups">12.1. Queryset field lookups</a></li>
|
||||
<li><a class="reference internal" href="#get-that-werewolf">12.2. Get that werewolf …</a></li>
|
||||
<li><a class="reference internal" href="#complex-queries">12.3. Complex queries</a></li>
|
||||
<li><a class="reference internal" href="#lets-get-that-werewolf">12.2. Let’s get that werewolf …</a></li>
|
||||
<li><a class="reference internal" href="#queries-with-or-or-not">12.3. Queries with OR or NOT</a></li>
|
||||
<li><a class="reference internal" href="#annotations">12.4. Annotations</a></li>
|
||||
<li><a class="reference internal" href="#f-objects">12.5. F-objects</a></li>
|
||||
<li><a class="reference internal" href="#grouping-and-returning-only-certain-properties">12.6. Grouping and returning only certain properties</a></li>
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
<p class="topless"><a href="Beginner-Tutorial-Searching-Things.html"
|
||||
title="previous chapter"><span class="section-number">11. </span>Searching for things</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../Part2/Beginner-Tutorial-Part2-Intro.html"
|
||||
title="next chapter">Part 2: What we want</a></p>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Making-A-Sittable-Object.html"
|
||||
title="next chapter"><span class="section-number">13. </span>Building a chair you can sit on</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -135,30 +135,20 @@ But sometimes you need to be more specific:</p>
|
|||
and if statements. But for something non-standard like this, querying the database directly will be
|
||||
much more efficient.</p>
|
||||
<p>Evennia uses <a class="reference external" href="https://www.djangoproject.com/">Django</a> to handle its connection to the database.
|
||||
A <a class="reference external" href="https://docs.djangoproject.com/en/3.0/ref/models/querysets/">django queryset</a> represents
|
||||
a database query. One can add querysets together to build ever-more complicated queries. Only when
|
||||
you are trying to use the results of the queryset will it actually call the database.</p>
|
||||
<p>The normal way to build a queryset is to define what class of entity you want to search by getting its
|
||||
<code class="docutils literal notranslate"><span class="pre">.objects</span></code> resource, and then call various methods on that. We’ve seen this one before:</p>
|
||||
A <a class="reference external" href="https://docs.djangoproject.com/en/3.0/ref/models/querysets/">django queryset</a> represents a database query. One can add querysets together to build ever-more complicated queries. Only when you are trying to use the results of the queryset will it actually call the database.</p>
|
||||
<p>The normal way to build a queryset is to define what class of entity you want to search by getting its <code class="docutils literal notranslate"><span class="pre">.objects</span></code> resource, and then call various methods on that. We’ve seen variants of this before:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>all_weapons = Weapon.objects.all()
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This is now a queryset representing all instances of <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>. If <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> had a subclass <code class="docutils literal notranslate"><span class="pre">Cannon</span></code> and we
|
||||
only wanted the cannons, we would do</p>
|
||||
<p>This is now a queryset representing all instances of <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>. If <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> had a subclass <code class="docutils literal notranslate"><span class="pre">Cannon</span></code> and we only wanted the cannons, we would do</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>all_cannons = Cannon.objects.all()
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Note that <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> and <code class="docutils literal notranslate"><span class="pre">Cannon</span></code> are <em>different</em> typeclasses. This means that you
|
||||
won’t find any <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>-typeclassed results in <code class="docutils literal notranslate"><span class="pre">all_cannons</span></code>. Vice-versa, you
|
||||
won’t find any <code class="docutils literal notranslate"><span class="pre">Cannon</span></code>-typeclassed results in <code class="docutils literal notranslate"><span class="pre">all_weapons</span></code>. This may not be
|
||||
what you expect.</p>
|
||||
<p>If you want to get all entities with typeclass <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> <em>as well</em> as all the
|
||||
subclasses of <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>, such as <code class="docutils literal notranslate"><span class="pre">Cannon</span></code>, you need to use the <code class="docutils literal notranslate"><span class="pre">_family</span></code> type of
|
||||
query:</p>
|
||||
<p>Note that <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> and <code class="docutils literal notranslate"><span class="pre">Cannon</span></code> are <em>different</em> typeclasses. This means that you won’t find any <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>-typeclassed results in <code class="docutils literal notranslate"><span class="pre">all_cannons</span></code>. Vice-versa, you won’t find any <code class="docutils literal notranslate"><span class="pre">Cannon</span></code>-typeclassed results in <code class="docutils literal notranslate"><span class="pre">all_weapons</span></code>. This may not be what you expect.</p>
|
||||
<p>If you want to get all entities with typeclass <code class="docutils literal notranslate"><span class="pre">Weapon</span></code> <em>as well</em> as all the subclasses of <code class="docutils literal notranslate"><span class="pre">Weapon</span></code>, such as <code class="docutils literal notranslate"><span class="pre">Cannon</span></code>, you need to use the <code class="docutils literal notranslate"><span class="pre">_family</span></code> type of query:</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">_family</p>
|
||||
<p>The all_family, filter_family etc is an Evennia-specific
|
||||
thing. It’s not part of regular Django.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">all_family</span></code> and <code class="docutils literal notranslate"><span class="pre">filter_family</span></code> (as well as <code class="docutils literal notranslate"><span class="pre">get_family</span></code> for getting exactly one result) are Evennia-specific. They are not part of regular Django.</p>
|
||||
</aside>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>really_all_weapons = Weapon.objects.all_family()
|
||||
</pre></div>
|
||||
|
|
@ -192,23 +182,13 @@ get results out of it to be able to loop):</p>
|
|||
print(rose)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>From now on, the queryset is <em>evaluated</em> and we can’t keep adding more queries to it - we’d need to
|
||||
create a new queryset if we wanted to find some other result. Other ways to evaluate the queryset is to
|
||||
print it, convert it to a list with <code class="docutils literal notranslate"><span class="pre">list()</span></code> and otherwise try to access its results.</p>
|
||||
<p>Note how we use <code class="docutils literal notranslate"><span class="pre">db_key</span></code> and <code class="docutils literal notranslate"><span class="pre">db_location</span></code>. This is the actual names of these
|
||||
database fields. By convention Evennia uses <code class="docutils literal notranslate"><span class="pre">db_</span></code> in front of every database
|
||||
field. When you use the normal Evennia search helpers and objects you can skip
|
||||
the <code class="docutils literal notranslate"><span class="pre">db_</span></code> but here we are calling the database directly and need to use the
|
||||
‘real’ names.</p>
|
||||
<p>From now on, the queryset is <em>evaluated</em> and we can’t keep adding more queries to it - we’d need to create a new queryset if we wanted to find some other result. Other ways to evaluate the queryset is to print it, convert it to a list with <code class="docutils literal notranslate"><span class="pre">list()</span></code> and otherwise try to access its results.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">database fields</p>
|
||||
<p>Each database table have only a few fields. For <code class="docutils literal notranslate"><span class="pre">Objects</span></code>, the most common ones
|
||||
are <code class="docutils literal notranslate"><span class="pre">db_key</span></code>, <code class="docutils literal notranslate"><span class="pre">db_location</span></code> and <code class="docutils literal notranslate"><span class="pre">db_destination</span></code>. When accessing them they are
|
||||
normally accessed just as <code class="docutils literal notranslate"><span class="pre">obj.key</span></code>, <code class="docutils literal notranslate"><span class="pre">obj.location</span></code> and <code class="docutils literal notranslate"><span class="pre">obj.destination</span></code>. You
|
||||
only need to remember the <code class="docutils literal notranslate"><span class="pre">db_</span></code> when using them in database queries. The object
|
||||
description, <code class="docutils literal notranslate"><span class="pre">obj.db.desc</span></code> is not such a hard-coded field, but one of many
|
||||
arbitrary Attributes attached to the Object.</p>
|
||||
<p>Each database table have only a few fields. For <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>, the most common ones are <code class="docutils literal notranslate"><span class="pre">db_key</span></code>, <code class="docutils literal notranslate"><span class="pre">db_location</span></code> and <code class="docutils literal notranslate"><span class="pre">db_destination</span></code>. When accessing them they are normally accessed just as <code class="docutils literal notranslate"><span class="pre">obj.key</span></code>, <code class="docutils literal notranslate"><span class="pre">obj.location</span></code> and <code class="docutils literal notranslate"><span class="pre">obj.destination</span></code>. You only need to remember the <code class="docutils literal notranslate"><span class="pre">db_</span></code> when using them in database queries. The object description, <code class="docutils literal notranslate"><span class="pre">obj.db.desc</span></code> is not such a hard-coded field, but one of many
|
||||
Attributes attached to the Object.</p>
|
||||
</aside>
|
||||
<p>Note how we use <code class="docutils literal notranslate"><span class="pre">db_key</span></code> and <code class="docutils literal notranslate"><span class="pre">db_location</span></code>. This is the actual names of these database fields. By convention Evennia uses <code class="docutils literal notranslate"><span class="pre">db_</span></code> in front of every database field. When you use the normal Evennia search helpers and objects you can skip the <code class="docutils literal notranslate"><span class="pre">db_</span></code> but here we are calling the database directly and need to use the ‘real’ names.</p>
|
||||
<p>Here are the most commonly used methods to use with the <code class="docutils literal notranslate"><span class="pre">objects</span></code> managers:</p>
|
||||
<ul class="simple">
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">filter</span></code> - query for a listing of objects based on search criteria. Gives empty queryset if none
|
||||
|
|
@ -216,57 +196,61 @@ were found.</p></li>
|
|||
<li><p><code class="docutils literal notranslate"><span class="pre">get</span></code> - query for a single match - raises exception if none were found, or more than one was
|
||||
found.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">all</span></code> - get all instances of the particular type.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">filter_family</span></code> - like <code class="docutils literal notranslate"><span class="pre">filter</span></code>, but search all sub classes as well.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">get_family</span></code> - like <code class="docutils literal notranslate"><span class="pre">get</span></code>, but search all sub classes as well.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">filter_family</span></code> - like <code class="docutils literal notranslate"><span class="pre">filter</span></code>, but search all subclasses as well.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">get_family</span></code> - like <code class="docutils literal notranslate"><span class="pre">get</span></code>, but search all subclasses as well.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">all_family</span></code> - like <code class="docutils literal notranslate"><span class="pre">all</span></code>, but return entities of all subclasses as well.</p></li>
|
||||
</ul>
|
||||
<blockquote>
|
||||
<div><p>All of Evennia search functions use querysets under the hood. The <code class="docutils literal notranslate"><span class="pre">evennia.search_*</span></code> functions actually
|
||||
return querysets, which means you could in principle keep adding queries to their results as well.</p>
|
||||
<div><p>All of Evennia search functions use querysets under the hood. The <code class="docutils literal notranslate"><span class="pre">evennia.search_*</span></code> functions actually return querysets (we have just been treating them as lists so far). This means you could in principle add a <code class="docutils literal notranslate"><span class="pre">.filter</span></code> query to the result of <code class="docutils literal notranslate"><span class="pre">evennia.search_object</span></code> to further refine the search.</p>
|
||||
</div></blockquote>
|
||||
<section id="queryset-field-lookups">
|
||||
<h2><span class="section-number">12.1. </span>Queryset field lookups<a class="headerlink" href="#queryset-field-lookups" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Above we found roses with exactly the <code class="docutils literal notranslate"><span class="pre">db_key</span></code> <code class="docutils literal notranslate"><span class="pre">"rose"</span></code>. This is an <em>exact</em> match that is <em>case sensitive</em>,
|
||||
so it would not find <code class="docutils literal notranslate"><span class="pre">"Rose"</span></code>.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span># this is case-sensitive and the same as =
|
||||
roses = Flower.objects.filter(db_key__exact="rose"
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># this is case-sensitive and the same as =</span>
|
||||
<span class="n">roses</span> <span class="o">=</span> <span class="n">Flower</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_key__exact</span><span class="o">=</span><span class="s2">"rose"</span>
|
||||
|
||||
# the i means it's case-insensitive
|
||||
roses = Flower.objects.filter(db_key__iexact="rose")
|
||||
<span class="c1"># the i means it's case-insensitive</span>
|
||||
<span class="n">roses</span> <span class="o">=</span> <span class="n">Flower</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_key__iexact</span><span class="o">=</span><span class="s2">"rose"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The Django field query language uses <code class="docutils literal notranslate"><span class="pre">__</span></code> similarly to how Python uses <code class="docutils literal notranslate"><span class="pre">.</span></code> to access resources. This
|
||||
is because <code class="docutils literal notranslate"><span class="pre">.</span></code> is not allowed in a function keyword.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>roses = Flower.objects.filter(db_key__icontains="rose")
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">roses</span> <span class="o">=</span> <span class="n">Flower</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_key__icontains</span><span class="o">=</span><span class="s2">"rose"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This will find all flowers whose name contains the string <code class="docutils literal notranslate"><span class="pre">"rose"</span></code>, like <code class="docutils literal notranslate"><span class="pre">"roses"</span></code>, <code class="docutils literal notranslate"><span class="pre">"wild</span> <span class="pre">rose"</span></code> etc. The
|
||||
<code class="docutils literal notranslate"><span class="pre">i</span></code> in the beginning makes the search case-insensitive. Other useful variations to use
|
||||
are <code class="docutils literal notranslate"><span class="pre">__istartswith</span></code> and <code class="docutils literal notranslate"><span class="pre">__iendswith</span></code>. You can also use <code class="docutils literal notranslate"><span class="pre">__gt</span></code>, <code class="docutils literal notranslate"><span class="pre">__ge</span></code> for “greater-than”/“greater-or-equal-than”
|
||||
comparisons (same for <code class="docutils literal notranslate"><span class="pre">__lt</span></code> and <code class="docutils literal notranslate"><span class="pre">__le</span></code>). There is also <code class="docutils literal notranslate"><span class="pre">__in</span></code>:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>swords = Weapons.objects.filter(db_key__in=("rapier", "two-hander", "shortsword"))
|
||||
<p>This will find all flowers whose name contains the string <code class="docutils literal notranslate"><span class="pre">"rose"</span></code>, like <code class="docutils literal notranslate"><span class="pre">"roses"</span></code>, <code class="docutils literal notranslate"><span class="pre">"wild</span> <span class="pre">rose"</span></code> etc. The <code class="docutils literal notranslate"><span class="pre">i</span></code> in the beginning makes the search case-insensitive. Other useful variations to use
|
||||
are <code class="docutils literal notranslate"><span class="pre">__istartswith</span></code> and <code class="docutils literal notranslate"><span class="pre">__iendswith</span></code>. You can also use <code class="docutils literal notranslate"><span class="pre">__gt</span></code>, <code class="docutils literal notranslate"><span class="pre">__ge</span></code> for “greater-than”/“greater-or-equal-than” comparisons (same for <code class="docutils literal notranslate"><span class="pre">__lt</span></code> and <code class="docutils literal notranslate"><span class="pre">__le</span></code>). There is also <code class="docutils literal notranslate"><span class="pre">__in</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">swords</span> <span class="o">=</span> <span class="n">Weapons</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_key__in</span><span class="o">=</span><span class="p">(</span><span class="s2">"rapier"</span><span class="p">,</span> <span class="s2">"two-hander"</span><span class="p">,</span> <span class="s2">"shortsword"</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>One also uses <code class="docutils literal notranslate"><span class="pre">__</span></code> to access foreign objects like Tags. Let’s for example assume
|
||||
this is how we have identified mages:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>char.tags.add("mage", category="profession")
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">char</span><span class="o">.</span><span class="n">tags</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s2">"mage"</span><span class="p">,</span> <span class="n">category</span><span class="o">=</span><span class="s2">"profession"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Now, in this case we have an Evennia helper to do this search:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>mages = evennia.search_tags("mage", category="profession")
|
||||
<p>Now, in this case we already have an Evennia helper to do this search:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">mages</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">search_tags</span><span class="p">(</span><span class="s2">"mage"</span><span class="p">,</span> <span class="n">category</span><span class="o">=</span><span class="s2">"profession"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>But this will find all Objects with this tag+category. Maybe you are only looking for Vampire mages:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>sparkly_mages = Vampire.objects.filter(db_tags__db_key="mage", db_tags__db_category="profession")
|
||||
<p>Here is what it would look as a query if you were only looking for Vampire mages:</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Breaking lines of code</p>
|
||||
<p>In Python you can wrap code in <code class="docutils literal notranslate"><span class="pre">(...)</span></code> to break it over multiple lines. Doing this doesn’t affect functionality, but can make it easier to read.</p>
|
||||
</aside>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">sparkly_mages</span> <span class="o">=</span> <span class="p">(</span>
|
||||
<span class="n">Vampire</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span>
|
||||
<span class="n">db_tags__db_key</span><span class="o">=</span><span class="s2">"mage"</span><span class="p">,</span>
|
||||
<span class="n">db_tags__db_category</span><span class="o">=</span><span class="s2">"profession"</span><span class="p">)</span>
|
||||
<span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This looks at the <code class="docutils literal notranslate"><span class="pre">db_tags</span></code> field on the <code class="docutils literal notranslate"><span class="pre">Vampire</span></code> and filters on the values of each tag’s
|
||||
<code class="docutils literal notranslate"><span class="pre">db_key</span></code> and <code class="docutils literal notranslate"><span class="pre">db_category</span></code> together.</p>
|
||||
<p>For more field lookups, see the
|
||||
<a class="reference external" href="https://docs.djangoproject.com/en/3.0/ref/models/querysets/#field-lookups">django docs</a> on the subject.</p>
|
||||
<p>For more field lookups, see the <a class="reference external" href="https://docs.djangoproject.com/en/3.0/ref/models/querysets/#field-lookups">django docs</a> on the subject.</p>
|
||||
</section>
|
||||
<section id="get-that-werewolf">
|
||||
<h2><span class="section-number">12.2. </span>Get that werewolf …<a class="headerlink" href="#get-that-werewolf" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="lets-get-that-werewolf">
|
||||
<h2><span class="section-number">12.2. </span>Let’s get that werewolf …<a class="headerlink" href="#lets-get-that-werewolf" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Let’s see if we can make a query for the werewolves in the moonlight we mentioned at the beginning
|
||||
of this lesson.</p>
|
||||
<p>Firstly, we make ourselves and our current location match the criteria, so we can test:</p>
|
||||
|
|
@ -276,52 +260,55 @@ of this lesson.</p>
|
|||
</div>
|
||||
<p>This is an example of a more complex query. We’ll consider it an example of what is
|
||||
possible.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Line breaks</p>
|
||||
<p>Note the way of writing this code. It would have been very hard to read if we
|
||||
just wrote it in one long line. But since we wrapped it in <code class="docutils literal notranslate"><span class="pre">(...)</span></code> we can spread
|
||||
it out over multiple lines without worrying about line breaks!</p>
|
||||
</aside>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">typeclasses.characters</span> <span class="kn">import</span> <span class="n">Character</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span></pre></div></td><td class="code"><div><pre><span></span><span class="kn">from</span> <span class="nn">typeclasses.characters</span> <span class="kn">import</span> <span class="n">Character</span>
|
||||
|
||||
<span class="n">will_transform</span> <span class="o">=</span> <span class="p">(</span>
|
||||
<span class="n">Character</span><span class="o">.</span><span class="n">objects</span>
|
||||
<span class="o">.</span><span class="n">filter</span><span class="p">(</span>
|
||||
<span class="n">db_location__db_tags__db_key__iexact</span><span class="o">=</span><span class="s2">"moonlit"</span><span class="p">,</span>
|
||||
<span class="n">db_attributes__db_key</span><span class="o">=</span><span class="s2">"lycantrophy"</span><span class="p">,</span>
|
||||
<span class="n">db_attributes__db_value__gt</span><span class="o">=</span><span class="mi">2</span>
|
||||
<span class="p">)</span>
|
||||
<span class="hll"> <span class="n">Character</span><span class="o">.</span><span class="n">objects</span>
|
||||
</span> <span class="o">.</span><span class="n">filter</span><span class="p">(</span>
|
||||
<span class="hll"> <span class="n">db_location__db_tags__db_key__iexact</span><span class="o">=</span><span class="s2">"moonlit"</span><span class="p">,</span>
|
||||
</span><span class="hll"> <span class="n">db_attributes__db_key</span><span class="o">=</span><span class="s2">"lycantrophy"</span><span class="p">,</span>
|
||||
</span><span class="hll"> <span class="n">db_attributes__db_value__gt</span><span class="o">=</span><span class="mi">2</span>
|
||||
</span> <span class="p">)</span>
|
||||
<span class="p">)</span>
|
||||
</pre></div>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Attributes vs database fields</p>
|
||||
<p>Don’t confuse database fields with <a class="reference internal" href="../../../Components/Attributes.html"><span class="doc std std-doc">Attributes</span></a> you set via <code class="docutils literal notranslate"><span class="pre">obj.db.attr</span> <span class="pre">=</span> <span class="pre">'foo'</span></code> or <code class="docutils literal notranslate"><span class="pre">obj.attributes.add()</span></code>. Attributes are custom database entities <em>linked</em> to an object. They are not separate fields <em>on</em> that object like <code class="docutils literal notranslate"><span class="pre">db_key</span></code> or <code class="docutils literal notranslate"><span class="pre">db_location</span></code> are.</p>
|
||||
</aside>
|
||||
<ul class="simple">
|
||||
<li><p>We want to find <code class="docutils literal notranslate"><span class="pre">Character</span></code>s, so we access <code class="docutils literal notranslate"><span class="pre">.objects</span></code> on the <code class="docutils literal notranslate"><span class="pre">Character</span></code> typeclass.</p></li>
|
||||
<li><p>We start to filter …</p></li>
|
||||
<li><ul>
|
||||
<li><p>… by accessing the <code class="docutils literal notranslate"><span class="pre">db_location</span></code> field (usually this is a Room)</p></li>
|
||||
<li><p><strong>Line 4</strong> We want to find <code class="docutils literal notranslate"><span class="pre">Character</span></code>s, so we access <code class="docutils literal notranslate"><span class="pre">.objects</span></code> on the <code class="docutils literal notranslate"><span class="pre">Character</span></code> typeclass.</p></li>
|
||||
<li><p>We start to filter …</p>
|
||||
<ul>
|
||||
<li><p><strong>Line 6</strong>: … by accessing the <code class="docutils literal notranslate"><span class="pre">db_location</span></code> field (usually this is a Room)</p>
|
||||
<ul>
|
||||
<li><p>… and on that location, we get the value of <code class="docutils literal notranslate"><span class="pre">db_tags</span></code> (this is a <em>many-to-many</em> database field
|
||||
that we can treat like an object for this purpose; it references all Tags on the location)</p></li>
|
||||
<li><p>… and from those <code class="docutils literal notranslate"><span class="pre">Tags</span></code>, we looking for <code class="docutils literal notranslate"><span class="pre">Tags</span></code> whose <code class="docutils literal notranslate"><span class="pre">db_key</span></code> is “monlit” (non-case sensitive).</p></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><p>… We also want only Characters with <code class="docutils literal notranslate"><span class="pre">Attributes</span></code> whose <code class="docutils literal notranslate"><span class="pre">db_key</span></code> is exactly <code class="docutils literal notranslate"><span class="pre">"lycantrophy"</span></code></p></li>
|
||||
<li><p>… at the same time as the <code class="docutils literal notranslate"><span class="pre">Attribute</span></code>’s <code class="docutils literal notranslate"><span class="pre">db_value</span></code> is greater-than 2.</p></li>
|
||||
<li><p><strong>Line 7</strong>: … We also want only Characters with <code class="docutils literal notranslate"><span class="pre">Attributes</span></code> whose <code class="docutils literal notranslate"><span class="pre">db_key</span></code> is exactly <code class="docutils literal notranslate"><span class="pre">"lycantrophy"</span></code></p></li>
|
||||
<li><p><strong>Line 8</strong> :… at the same time as the <code class="docutils literal notranslate"><span class="pre">Attribute</span></code>’s <code class="docutils literal notranslate"><span class="pre">db_value</span></code> is greater-than 2.</p></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Running this query makes our newly lycantrophic Character appear in <code class="docutils literal notranslate"><span class="pre">will_transform</span></code> so we
|
||||
know to transform it. Success!</p>
|
||||
<blockquote>
|
||||
<div><p>Don’t confuse database fields with <a class="reference internal" href="../../../Components/Attributes.html"><span class="doc std std-doc">Attributes</span></a> you set via <code class="docutils literal notranslate"><span class="pre">obj.db.attr</span> <span class="pre">=</span> <span class="pre">'foo'</span></code> or
|
||||
<code class="docutils literal notranslate"><span class="pre">obj.attributes.add()</span></code>. Attributes are custom database entities <em>linked</em> to an object. They are not
|
||||
separate fields <em>on</em> that object like <code class="docutils literal notranslate"><span class="pre">db_key</span></code> or <code class="docutils literal notranslate"><span class="pre">db_location</span></code> are.</p>
|
||||
</div></blockquote>
|
||||
</section>
|
||||
<section id="complex-queries">
|
||||
<h2><span class="section-number">12.3. </span>Complex queries<a class="headerlink" href="#complex-queries" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="queries-with-or-or-not">
|
||||
<h2><span class="section-number">12.3. </span>Queries with OR or NOT<a class="headerlink" href="#queries-with-or-or-not" title="Permalink to this headline">¶</a></h2>
|
||||
<p>All examples so far used <code class="docutils literal notranslate"><span class="pre">AND</span></code> relations. The arguments to <code class="docutils literal notranslate"><span class="pre">.filter</span></code> are added together with <code class="docutils literal notranslate"><span class="pre">AND</span></code>
|
||||
(“we want tag room to be “monlit” <em>and</em> lycantrhopy be > 2”).</p>
|
||||
<p>For queries using <code class="docutils literal notranslate"><span class="pre">OR</span></code> and <code class="docutils literal notranslate"><span class="pre">NOT</span></code> we need Django’s
|
||||
<a class="reference external" href="https://docs.djangoproject.com/en/1.11/topics/db/queries/#complex-lookups-with-q-objects">Q object</a>. It is
|
||||
imported from Django directly:</p>
|
||||
<p>For queries using <code class="docutils literal notranslate"><span class="pre">OR</span></code> and <code class="docutils literal notranslate"><span class="pre">NOT</span></code> we need Django’s <a class="reference external" href="https://docs.djangoproject.com/en/1.11/topics/db/queries/#complex-lookups-with-q-objects">Q object</a>. It is imported from Django directly:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>from django.db.models import Q
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -332,10 +319,11 @@ imported from Django directly:</p>
|
|||
<p>You can then use this <code class="docutils literal notranslate"><span class="pre">Q</span></code> instance as argument in a <code class="docutils literal notranslate"><span class="pre">filter</span></code>:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>q1 = Q(db_key="foo")
|
||||
Character.objects.filter(q1)
|
||||
# this is the same as
|
||||
Character.objects.filter(db_key="foo")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The useful thing about <code class="docutils literal notranslate"><span class="pre">Q</span></code> is that these objects can be chained together with special symbols (bit operators):
|
||||
<code class="docutils literal notranslate"><span class="pre">|</span></code> for <code class="docutils literal notranslate"><span class="pre">OR</span></code> and <code class="docutils literal notranslate"><span class="pre">&</span></code> for <code class="docutils literal notranslate"><span class="pre">AND</span></code>. A tilde <code class="docutils literal notranslate"><span class="pre">~</span></code> in front negates the expression inside the <code class="docutils literal notranslate"><span class="pre">Q</span></code> and thus
|
||||
<p>The useful thing about <code class="docutils literal notranslate"><span class="pre">Q</span></code> is that these objects can be chained together with special symbols (bit operators): <code class="docutils literal notranslate"><span class="pre">|</span></code> for <code class="docutils literal notranslate"><span class="pre">OR</span></code> and <code class="docutils literal notranslate"><span class="pre">&</span></code> for <code class="docutils literal notranslate"><span class="pre">AND</span></code>. A tilde <code class="docutils literal notranslate"><span class="pre">~</span></code> in front negates the expression inside the <code class="docutils literal notranslate"><span class="pre">Q</span></code> and thus
|
||||
works like <code class="docutils literal notranslate"><span class="pre">NOT</span></code>.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>q1 = Q(db_key="Dalton")
|
||||
q2 = Q(db_location=prison)
|
||||
|
|
@ -344,12 +332,8 @@ Character.objects.filter(q1 | ~q2)
|
|||
</div>
|
||||
<p>Would get all Characters that are either named “Dalton” <em>or</em> which is <em>not</em> in prison. The result is a mix
|
||||
of Daltons and non-prisoners.</p>
|
||||
<p>Let us expand our original werewolf query. Not only do we want to find all
|
||||
Characters in a moonlit room with a certain level of <code class="docutils literal notranslate"><span class="pre">lycanthrophy</span></code>. Now we also
|
||||
want the full moon to immediately transform people who were recently bitten,
|
||||
even if their <code class="docutils literal notranslate"><span class="pre">lycantrophy</span></code> level is not yet high enough (more dramatic this
|
||||
way!). When you get bitten, you’ll get a Tag <code class="docutils literal notranslate"><span class="pre">recently_bitten</span></code> put on you to
|
||||
indicate this.</p>
|
||||
<p>Let us expand our original werewolf query. Not only do we want to find all Characters in a moonlit room with a certain level of <code class="docutils literal notranslate"><span class="pre">lycanthrophy</span></code> - we decide that if they have been <em>newly bitten</em>, they should also turn, <em>regardless</em> of their lycantrophy level (more dramatic that way!).</p>
|
||||
<p>Let’s say that getting bitten means that you’ll get assigned a Tag <code class="docutils literal notranslate"><span class="pre">recently_bitten</span></code>.</p>
|
||||
<p>This is how we’d change our query:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">Q</span>
|
||||
|
||||
|
|
@ -396,57 +380,67 @@ sure that there is only one instance of each Character in the result.</p>
|
|||
<section id="annotations">
|
||||
<h2><span class="section-number">12.4. </span>Annotations<a class="headerlink" href="#annotations" title="Permalink to this headline">¶</a></h2>
|
||||
<p>What if we wanted to filter on some condition that isn’t represented easily by a
|
||||
field on the object? Maybe we want to find rooms only containing five or more
|
||||
objects?</p>
|
||||
field on the object? An example would wanting to find rooms only containing <em>five or more objects</em>.</p>
|
||||
<p>We <em>could</em> do it like this (don’t actually do it this way!):</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
|
||||
<span class="n">all_rooms</span> <span class="o">=</span> <span class="n">Rooms</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
|
||||
<span class="n">all_rooms</span> <span class="o">=</span> <span class="n">Rooms</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
|
||||
|
||||
<span class="n">rooms_with_five_objects</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">room</span> <span class="ow">in</span> <span class="n">all_rooms</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">room</span><span class="o">.</span><span class="n">contents</span><span class="p">)</span> <span class="o">>=</span> <span class="mi">5</span><span class="p">:</span>
|
||||
<span class="n">rooms_with_five_objects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">room</span><span class="p">)</span>
|
||||
<span class="n">rooms_with_five_objects</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">room</span> <span class="ow">in</span> <span class="n">all_rooms</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">room</span><span class="o">.</span><span class="n">contents</span><span class="p">)</span> <span class="o">>=</span> <span class="mi">5</span><span class="p">:</span>
|
||||
<span class="n">rooms_with_five_objects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">room</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Above we get all rooms and then use <code class="docutils literal notranslate"><span class="pre">list.append()</span></code> to keep adding the right
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">list.append, extend and .pop</p>
|
||||
<p>Use <code class="docutils literal notranslate"><span class="pre">mylist.append(obj)</span></code> to add new items to a list. Use <code class="docutils literal notranslate"><span class="pre">mylist.extend(another_list))</span></code> or <code class="docutils literal notranslate"><span class="pre">list1</span> <span class="pre">+</span> <span class="pre">list2</span></code> to merge two lists together. Use <code class="docutils literal notranslate"><span class="pre">mylist.pop()</span></code> to remove an item from the end or <code class="docutils literal notranslate"><span class="pre">.pop(0)</span></code> to remove from the beginning of the list. Remember all indices start from <code class="docutils literal notranslate"><span class="pre">0</span></code> in Python.</p>
|
||||
</aside>
|
||||
<p>Above we get <em>all</em> rooms and then use <code class="docutils literal notranslate"><span class="pre">list.append()</span></code> to keep adding the right
|
||||
rooms to an ever-growing list. This is <em>not</em> a good idea, once your database
|
||||
grows this will be unnecessarily computing-intensive. The database is much more
|
||||
suitable for this.</p>
|
||||
grows this will be unnecessarily compute-intensive. It’s much better to query the
|
||||
database directly</p>
|
||||
<p><em>Annotations</em> allow you to set a ‘variable’ inside the query that you can then
|
||||
access from other parts of the query. Let’s do the same example as before
|
||||
directly in the database:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span>
|
||||
<span class="normal">5</span>
|
||||
<span class="normal">6</span>
|
||||
<span class="normal">7</span>
|
||||
<span class="normal">8</span>
|
||||
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
<span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">Count</span>
|
||||
|
||||
<span class="n">rooms</span> <span class="o">=</span> <span class="p">(</span>
|
||||
<span class="n">Room</span><span class="o">.</span><span class="n">objects</span>
|
||||
<span class="o">.</span><span class="n">annotate</span><span class="p">(</span>
|
||||
<span class="n">num_objects</span><span class="o">=</span><span class="n">Count</span><span class="p">(</span><span class="s1">'locations_set'</span><span class="p">))</span>
|
||||
<span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">num_objects__gte</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
|
||||
<span class="p">)</span>
|
||||
</pre></div>
|
||||
<span class="hll"> <span class="o">.</span><span class="n">annotate</span><span class="p">(</span>
|
||||
</span> <span class="n">num_objects</span><span class="o">=</span><span class="n">Count</span><span class="p">(</span><span class="s1">'locations_set'</span><span class="p">))</span>
|
||||
<span class="hll"> <span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">num_objects__gte</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
|
||||
</span><span class="p">)</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">locations_set</p>
|
||||
<p>Note the use of <code class="docutils literal notranslate"><span class="pre">locations_set</span></code> in that <code class="docutils literal notranslate"><span class="pre">Count</span></code>. The <code class="docutils literal notranslate"><span class="pre">*s_set</span></code> is a back-reference automatically created by Django. In this case it allows you to find all objects that <em>has the current object as location</em>.</p>
|
||||
</aside>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">Count</span></code> is a Django class for counting the number of things in the database.</p>
|
||||
<p>Here we first create an annotation <code class="docutils literal notranslate"><span class="pre">num_objects</span></code> of type <code class="docutils literal notranslate"><span class="pre">Count</span></code>. It creates an in-database function
|
||||
that will count the number of results inside the database.</p>
|
||||
<blockquote>
|
||||
<div><p>Note the use of <code class="docutils literal notranslate"><span class="pre">location_set</span></code> in that <code class="docutils literal notranslate"><span class="pre">Count</span></code>. The <code class="docutils literal notranslate"><span class="pre">*_set</span></code> is a back-reference automatically created by
|
||||
Django. In this case it allows you to find all objects that <em>has the current object as location</em>.</p>
|
||||
</div></blockquote>
|
||||
<p>Next we filter on this annotation, using the name <code class="docutils literal notranslate"><span class="pre">num_objects</span></code> as something we
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 6-7</strong>: Here we first create an annotation <code class="docutils literal notranslate"><span class="pre">num_objects</span></code> of type <code class="docutils literal notranslate"><span class="pre">Count</span></code>. It creates an in-database function that will count the number of results inside the database. The fact annotation means that now <code class="docutils literal notranslate"><span class="pre">num_objects</span></code> is avaiable to be used in other parts of the query.</p></li>
|
||||
<li><p><strong>Line 8</strong> We filter on this annotation, using the name <code class="docutils literal notranslate"><span class="pre">num_objects</span></code> as something we
|
||||
can filter for. We use <code class="docutils literal notranslate"><span class="pre">num_objects__gte=5</span></code> which means that <code class="docutils literal notranslate"><span class="pre">num_objects</span></code>
|
||||
should be greater than or equal to 5. This is a little harder to get one’s head
|
||||
around but much more efficient than lopping over all objects in Python.</p>
|
||||
should be greater than or equal to 5.</p></li>
|
||||
</ul>
|
||||
<p>Annotations can be a little harder to get one’s head around but much more efficient than lopping over all objects in Python.</p>
|
||||
</section>
|
||||
<section id="f-objects">
|
||||
<h2><span class="section-number">12.5. </span>F-objects<a class="headerlink" href="#f-objects" title="Permalink to this headline">¶</a></h2>
|
||||
<p>What if we wanted to compare two dynamic parameters against one another in a
|
||||
query? For example, what if instead of having 5 or more objects, we only wanted
|
||||
objects that had a bigger inventory than they had tags (silly example, but …)?
|
||||
This can be with Django’s <a class="reference external" href="https://docs.djangoproject.com/en/1.11/ref/models/expressions/#f-expressions">F objects</a>.
|
||||
So-called F expressions allow you to do a query that looks at a value of each
|
||||
object in the database.</p>
|
||||
objects that had a bigger inventory than they had tags (silly example, but …)?</p>
|
||||
<p>This can be with Django’s <a class="reference external" href="https://docs.djangoproject.com/en/4.1/ref/models/expressions/#f-expressions">F objects</a>. So-called F expressions allow you to do a query that looks at a value of each object in the database.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">Count</span><span class="p">,</span> <span class="n">F</span>
|
||||
<span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
|
||||
|
|
@ -465,34 +459,35 @@ condition to be calculated on the fly, completely within the database.</p>
|
|||
</section>
|
||||
<section id="grouping-and-returning-only-certain-properties">
|
||||
<h2><span class="section-number">12.6. </span>Grouping and returning only certain properties<a class="headerlink" href="#grouping-and-returning-only-certain-properties" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Suppose you used tags to mark someone belonging to an organization. Now you want to make a list and
|
||||
need to get the membership count of every organization all at once.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">.annotate</span></code>, <code class="docutils literal notranslate"><span class="pre">.values_list</span></code>, and <code class="docutils literal notranslate"><span class="pre">.order_by</span></code> queryset methods are useful for this. Normally when
|
||||
you run a <code class="docutils literal notranslate"><span class="pre">.filter</span></code>, what you get back is a bunch of full typeclass instances, like roses or swords.
|
||||
Using <code class="docutils literal notranslate"><span class="pre">.values_list</span></code> you can instead choose to only get back certain properties on objects.
|
||||
The <code class="docutils literal notranslate"><span class="pre">.order_by</span></code> method finally allows for sorting the results according to some criterion:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">Count</span>
|
||||
<p>Suppose you used tags to mark someone belonging to an organization. Now you want to make a list and need to get the membership count of every organization all at once.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">.annotate</span></code>, <code class="docutils literal notranslate"><span class="pre">.values_list</span></code>, and <code class="docutils literal notranslate"><span class="pre">.order_by</span></code> queryset methods are useful for this. Normally when you run a <code class="docutils literal notranslate"><span class="pre">.filter</span></code>, what you get back is a bunch of full typeclass instances, like roses or swords. Using <code class="docutils literal notranslate"><span class="pre">.values_list</span></code> you can instead choose to only get back certain properties on objects. The <code class="docutils literal notranslate"><span class="pre">.order_by</span></code> method finally allows for sorting the results according to some criterion:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span>
|
||||
<span class="normal">5</span>
|
||||
<span class="normal">6</span>
|
||||
<span class="normal">7</span>
|
||||
<span class="normal">8</span>
|
||||
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="kn">from</span> <span class="nn">django.db.models</span> <span class="kn">import</span> <span class="n">Count</span>
|
||||
<span class="kn">from</span> <span class="nn">typeclasses.rooms</span> <span class="kn">import</span> <span class="n">Room</span>
|
||||
|
||||
<span class="n">result</span> <span class="o">=</span> <span class="p">(</span>
|
||||
<span class="n">Character</span><span class="o">.</span><span class="n">objects</span>
|
||||
<span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_tags__db_category</span><span class="o">=</span><span class="s2">"organization"</span><span class="p">)</span>
|
||||
<span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">tagcount</span><span class="o">=</span><span class="n">Count</span><span class="p">(</span><span class="s1">'id'</span><span class="p">))</span>
|
||||
<span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s1">'-tagcount'</span><span class="p">))</span>
|
||||
<span class="o">.</span><span class="n">values_list</span><span class="p">(</span><span class="s1">'db_tags__db_key'</span><span class="p">,</span> <span class="s2">"tagcount"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
<span class="hll"> <span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">db_tags__db_category</span><span class="o">=</span><span class="s2">"organization"</span><span class="p">)</span>
|
||||
</span><span class="hll"> <span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">tagcount</span><span class="o">=</span><span class="n">Count</span><span class="p">(</span><span class="s1">'id'</span><span class="p">))</span>
|
||||
</span><span class="hll"> <span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s1">'-tagcount'</span><span class="p">))</span>
|
||||
</span><span class="hll"> <span class="o">.</span><span class="n">values_list</span><span class="p">(</span><span class="s1">'db_tags__db_key'</span><span class="p">,</span> <span class="s2">"tagcount"</span><span class="p">)</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>Here we fetch all Characters who …</p>
|
||||
<ul class="simple">
|
||||
<li><p>… has a tag of category “organization” on them</p></li>
|
||||
<li><p>… along the way we count how many different Characters (each <code class="docutils literal notranslate"><span class="pre">id</span></code> is unique) we find for each organization
|
||||
and store it in a ‘variable’ <code class="docutils literal notranslate"><span class="pre">tagcount</span></code> using <code class="docutils literal notranslate"><span class="pre">.annotate</span></code> and <code class="docutils literal notranslate"><span class="pre">Count</span></code></p></li>
|
||||
<li><p>… we use this count to sort the result in descending order of <code class="docutils literal notranslate"><span class="pre">tagcount</span></code> (descending because there is a minus sign,
|
||||
default is increasing order but we want the most popular organization to be first).</p></li>
|
||||
<li><p>… and finally we make sure to only return exactly the properties we want, namely the name of the organization tag
|
||||
and how many matches we found for that organization.</p></li>
|
||||
<li><p><strong>Line 6</strong>: … has a tag of category “organization” on them</p></li>
|
||||
<li><p><strong>Line 7</strong>:… along the way we count how many different Characters (each <code class="docutils literal notranslate"><span class="pre">id</span></code> is unique) we find for each organization and store it in a ‘variable’ <code class="docutils literal notranslate"><span class="pre">tagcount</span></code> using <code class="docutils literal notranslate"><span class="pre">.annotate</span></code> and <code class="docutils literal notranslate"><span class="pre">Count</span></code></p></li>
|
||||
<li><p><strong>Line 8</strong>: … we use this count to sort the result in descending order of <code class="docutils literal notranslate"><span class="pre">tagcount</span></code> (descending because there is a minus sign, default is increasing order but we want the most popular organization to be first).</p></li>
|
||||
<li><p><strong>Line 9</strong>: … and finally we make sure to only return exactly the properties we want, namely the name of the organization tag and how many matches we found for that organization. For this we use the <code class="docutils literal notranslate"><span class="pre">values_list</span></code> method on the queryset. This will evaluate the queryset immediately.</p></li>
|
||||
</ul>
|
||||
<p>The result queryset will be a list of tuples ordered in descending order by the number of matches,
|
||||
<p>The result will be a list of tuples ordered in descending order by the number of matches,
|
||||
in a format like the following:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
|
||||
<span class="p">(</span><span class="s1">'Griatch'</span><span class="n">s</span> <span class="n">poets</span> <span class="n">society</span><span class="s1">', 3872),</span>
|
||||
|
|
@ -506,11 +501,7 @@ in a format like the following:</p>
|
|||
</section>
|
||||
<section id="conclusions">
|
||||
<h2><span class="section-number">12.7. </span>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We have covered a lot of ground in this lesson and covered several more complex
|
||||
topics. Knowing how to query using Django is a powerful skill to have.</p>
|
||||
<p>This concludes the first part of the Evennia starting tutorial - “What we have”.
|
||||
Now we have a good foundation to understand how to plan what our tutorial game
|
||||
will be about.</p>
|
||||
<p>We have covered a lot of ground in this lesson and covered several more complex topics. Knowing how to query using Django is a powerful skill to have.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
|
@ -530,7 +521,7 @@ will be about.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
<a href="Beginner-Tutorial-Making-A-Sittable-Object.html" title="13. Building a chair you can sit on"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Searching-Things.html" title="11. Searching for things"
|
||||
|
|
|
|||
|
|
@ -129,8 +129,7 @@
|
|||
<h1><span class="section-number">7. </span>Making objects persistent<a class="headerlink" href="#making-objects-persistent" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Now that we have learned a little about how to find things in the Evennia library, let’s use it.</p>
|
||||
<p>In the <a class="reference internal" href="Beginner-Tutorial-Python-classes-and-objects.html"><span class="doc std std-doc">Python classes and objects</span></a> lesson we created the dragons Fluffy, Cuddly
|
||||
and Smaug and made them fly and breathe fire. So far our dragons are short-lived - whenever we <code class="docutils literal notranslate"><span class="pre">restart</span></code>
|
||||
the server or <code class="docutils literal notranslate"><span class="pre">quit()</span></code> out of python mode they are gone.</p>
|
||||
and Smaug and made them fly and breathe fire. So far our dragons are short-lived - whenever we <code class="docutils literal notranslate"><span class="pre">restart</span></code> the server or <code class="docutils literal notranslate"><span class="pre">quit()</span></code> out of python mode they are gone.</p>
|
||||
<p>This is what you should have in <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/monsters.py</span></code> so far:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
|
||||
<span class="k">class</span> <span class="nc">Monster</span><span class="p">:</span>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,943 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>13. Building a chair you can sit on — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
<script src="../../../_static/jquery.js"></script>
|
||||
<script src="../../../_static/underscore.js"></script>
|
||||
<script src="../../../_static/doctools.js"></script>
|
||||
<script src="../../../_static/language_data.js"></script>
|
||||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Part 2: What we want" href="../Part2/Beginner-Tutorial-Part2-Intro.html" />
|
||||
<link rel="prev" title="12. Advanced searching - Django Database queries" href="Beginner-Tutorial-Django-queries.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Django-queries.html" title="12. Advanced searching - Django Database queries"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part1-Intro.html" accesskey="U">Part 1: What we have</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">13. </span>Building a chair you can sit on</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
|
||||
<div class="documentwrapper">
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<p class="logo"><a href="../../../index.html">
|
||||
<img class="logo" src="../../../_static/evennia_logo.png" alt="Logo"/>
|
||||
</a></p>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">Quick search</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||||
<input type="submit" value="Go" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">13. Building a chair you can sit on</a><ul>
|
||||
<li><a class="reference internal" href="#make-us-not-able-to-move-while-resting">13.1. Make us not able to move while resting</a></li>
|
||||
<li><a class="reference internal" href="#making-the-chair-itself">13.2. Making the Chair itself</a><ul>
|
||||
<li><a class="reference internal" href="#sitting-on-or-in">13.2.1. Sitting on or in?</a></li>
|
||||
<li><a class="reference internal" href="#extra-credits">13.2.2. Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#adding-commands">13.3. Adding commands</a><ul>
|
||||
<li><a class="reference internal" href="#command-variant-1-commands-on-the-chair">13.3.1. Command variant 1: Commands on the chair</a></li>
|
||||
<li><a class="reference internal" href="#command-variant-2-command-on-character">13.3.2. Command variant 2: Command on Character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#conclusions">13.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Django-queries.html"
|
||||
title="previous chapter"><span class="section-number">12. </span>Advanced searching - Django Database queries</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../Part2/Beginner-Tutorial-Part2-Intro.html"
|
||||
title="next chapter">Part 2: What we want</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Making-A-Sittable-Object.md.txt"
|
||||
rel="nofollow">Show Page Source</a></li>
|
||||
</ul>
|
||||
</div><h3>Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://www.evennia.com">Home page</a> </li>
|
||||
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
|
||||
<li><a href="http://games.evennia.com">Game Index</a> </li>
|
||||
<li>
|
||||
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
|
||||
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
|
||||
<a href="https://evennia.blogspot.com/">Blog</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Versions</h3>
|
||||
<ul>
|
||||
<li><a href="Beginner-Tutorial-Making-A-Sittable-Object.html">1.0-dev (develop branch)</a></li>
|
||||
<ul>
|
||||
<li><a href="../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="building-a-chair-you-can-sit-on">
|
||||
<h1><span class="section-number">13. </span>Building a chair you can sit on<a class="headerlink" href="#building-a-chair-you-can-sit-on" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In this lesson we will make use of what we have learned to create a new game object: a chair you can sit on.</p>
|
||||
<p>Out goals are:</p>
|
||||
<ul class="simple">
|
||||
<li><p>We want a new ‘sittable’ object, a <code class="docutils literal notranslate"><span class="pre">Chair</span></code> in particular.</p></li>
|
||||
<li><p>We want to be able to use a command to sit in the chair.</p></li>
|
||||
<li><p>Once we are sitting in the chair it should affect us somehow. To demonstrate this store
|
||||
the current chair in an attribute <code class="docutils literal notranslate"><span class="pre">is_sitting</span></code>. Other systems could check this to affect us in different ways.</p></li>
|
||||
<li><p>A character should be able to stand up and move away from the chair.</p></li>
|
||||
<li><p>When you sit down you should not be able to walk to another room without first standing up.</p></li>
|
||||
</ul>
|
||||
<section id="make-us-not-able-to-move-while-resting">
|
||||
<h2><span class="section-number">13.1. </span>Make us not able to move while resting<a class="headerlink" href="#make-us-not-able-to-move-while-resting" title="Permalink to this headline">¶</a></h2>
|
||||
<p>When you are sitting in a chair you can’t just walk off without first standing up.
|
||||
This requires a change to our Character typeclass. Open <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/characters.py</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/typeclasses/characters.py</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">Character</span><span class="p">(</span><span class="n">DefaultCharacter</span><span class="p">):</span>
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">at_pre_move</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">destination</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Called by self.move_to when trying to move somewhere. If this returns</span>
|
||||
<span class="sd"> False, the move is immediately cancelled.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_resting</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"You need to stand up first."</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="kc">False</span>
|
||||
<span class="k">return</span> <span class="kc">True</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>When moving somewhere, <a class="reference internal" href="../../../api/evennia.objects.objects.html#evennia.objects.objects.DefaultObject.move_to" title="evennia.objects.objects.DefaultObject.move_to"><span class="xref myst py py-meth">character.move_to</span></a> is called. This in turn
|
||||
will call <code class="docutils literal notranslate"><span class="pre">character.at_pre_move</span></code>. If this returns <code class="docutils literal notranslate"><span class="pre">False</span></code>, the move is aborted.</p>
|
||||
<p>Here we look for an Attribute <code class="docutils literal notranslate"><span class="pre">is_resting</span></code> (which we will assign below) to determine if we are stuck on the chair or not.</p>
|
||||
</section>
|
||||
<section id="making-the-chair-itself">
|
||||
<h2><span class="section-number">13.2. </span>Making the Chair itself<a class="headerlink" href="#making-the-chair-itself" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Next we need the Chair itself, or rather a whole family of “things you can sit on” that we will call <em>sittables</em>. We can’t just use a default Object since we want a sittable to contain some custom code. We need a new, custom Typeclass. Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/sittables.py</span></code> with the following content:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span>
|
||||
<span class="normal">24</span>
|
||||
<span class="normal">25</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/typeclasses/sittables.py</span>
|
||||
|
||||
<span class="hll"><span class="kn">from</span> <span class="nn">typeclasses.objects</span> <span class="kn">import</span> <span class="n">Object</span>
|
||||
</span>
|
||||
<span class="k">class</span> <span class="nc">Sittable</span><span class="p">(</span><span class="n">Object</span><span class="p">):</span>
|
||||
|
||||
<span class="hll"> <span class="k">def</span> <span class="nf">do_sit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sitter</span><span class="p">):</span>
|
||||
</span> <span class="sd">"""</span>
|
||||
<span class="sd"> Called when trying to sit on/in this object.</span>
|
||||
|
||||
<span class="sd"> Args:</span>
|
||||
<span class="sd"> sitter (Object): The one trying to sit down.</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="hll"> <span class="n">current</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitter</span>
|
||||
</span><span class="hll"> <span class="k">if</span> <span class="n">current</span><span class="p">:</span>
|
||||
</span> <span class="k">if</span> <span class="n">current</span> <span class="o">==</span> <span class="n">sitter</span><span class="p">:</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You are already sitting on </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You can't sit on </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> "</span>
|
||||
<span class="sa">f</span><span class="s2">"- </span><span class="si">{</span><span class="n">current</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> is already sitting there!"</span><span class="p">)</span>
|
||||
<span class="k">return</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitting</span> <span class="o">=</span> <span class="n">sitter</span>
|
||||
</span><span class="hll"> <span class="n">sitter</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_sitting</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span>
|
||||
</span><span class="hll"> <span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You sit on </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>This handles the logic of someone sitting down on the chair.</p>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 3</strong>: We inherit from the empty <code class="docutils literal notranslate"><span class="pre">Object</span></code> class in <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/objects.py</span></code>. This means we can theoretically modify that in the future and have those changes affect sittables too.</p></li>
|
||||
<li><p><strong>Line 7</strong>: The <code class="docutils literal notranslate"><span class="pre">do_sit</span></code> method expects to be called with the argument <code class="docutils literal notranslate"><span class="pre">sitter</span></code>, which is to be an <code class="docutils literal notranslate"><span class="pre">Object</span></code> (most likely a <code class="docutils literal notranslate"><span class="pre">Character</span></code>). This is the one wanting to sit down.</p></li>
|
||||
<li><p><strong>Line 15</strong>: Note that, if the <a class="reference internal" href="../../../Components/Attributes.html"><span class="doc std std-doc">Attribute</span></a> <code class="docutils literal notranslate"><span class="pre">sitter</span></code> is not defined on the chair (because this is the first time someone sits in it), this will simply return <code class="docutils literal notranslate"><span class="pre">None</span></code>, which is fine.</p></li>
|
||||
<li><p><strong>Lines 16-22</strong> We check if someone is already sitting on the chair and returns appropriate error messages depending on if it’s you or someone else. We use <code class="docutils literal notranslate"><span class="pre">return</span></code> to abort the sit-action.</p></li>
|
||||
<li><p><strong>Line 23</strong>: If we get to this point, <code class="docutils literal notranslate"><span class="pre">sitter</span></code> gets to, well, sit down. We store them in the <code class="docutils literal notranslate"><span class="pre">sitter</span></code> Attribute on the chair.</p></li>
|
||||
<li><p><strong>Line 24</strong>: <code class="docutils literal notranslate"><span class="pre">self.obj</span></code> is the chair this command is attachd to. We store that in the <code class="docutils literal notranslate"><span class="pre">is_sitting</span></code> Attribute on the <code class="docutils literal notranslate"><span class="pre">sitter</span></code> itself.</p></li>
|
||||
<li><p><strong>Line 25</strong>: Finally we tell the sitter that they could sit down.</p></li>
|
||||
</ul>
|
||||
<p>Let’s continue:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># add this right after the `do_sit method` in the same class </span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">do_stand</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">stander</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Called when trying to stand from this object.</span>
|
||||
|
||||
<span class="sd"> Args:</span>
|
||||
<span class="sd"> stander (Object): The one trying to stand up.</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">current</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitter</span>
|
||||
<span class="hll"> <span class="k">if</span> <span class="ow">not</span> <span class="n">stander</span> <span class="o">==</span> <span class="n">current</span><span class="p">:</span>
|
||||
</span> <span class="n">stander</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You are not sitting on </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitter</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
</span><span class="hll"> <span class="k">del</span> <span class="n">stander</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_sitting</span>
|
||||
</span><span class="hll"> <span class="n">stander</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You stand up from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>This is the inverse of sitting down; we need to do some cleanup.</p>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 12</strong>: If we are not sitting on the chair, it makes no sense to stand up from it.</p></li>
|
||||
<li><p><strong>Line 15</strong>: If we get here, we could stand up. We make sure to un-set the <code class="docutils literal notranslate"><span class="pre">sitter</span></code> Attribute so someone else could use the chair later.</p></li>
|
||||
<li><p><strong>Line 16</strong>: The character is no longer sitting, so we delete their <code class="docutils literal notranslate"><span class="pre">is_sitting</span></code> Attribute. We could also have done <code class="docutils literal notranslate"><span class="pre">stander.db.is_sitting</span> <span class="pre">=</span> <span class="pre">None</span></code> here, but deleting the Attribute feels cleaner.</p></li>
|
||||
<li><p><strong>Line 17</strong>: Finally, we inform them that they stood up successfully.</p></li>
|
||||
</ul>
|
||||
<p>One could imagine that one could have the future <code class="docutils literal notranslate"><span class="pre">sit</span></code> command (which we haven’t created yet) check if someone is already sitting in the chair instead. This would work too, but letting the <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> class handle the logic around who can sit on it makes sense.</p>
|
||||
<p>We let the typeclass handle the logic, and also let it do all the return messaging. This makes it easy to churn out a bunch of chairs for people to sit on.</p>
|
||||
<section id="sitting-on-or-in">
|
||||
<h3><span class="section-number">13.2.1. </span>Sitting on or in?<a class="headerlink" href="#sitting-on-or-in" title="Permalink to this headline">¶</a></h3>
|
||||
<p>It’s fine to sit ‘on’ a chair. But what if our Sittable is an armchair?</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="n">armchair</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">create_object</span><span class="p">(</span><span class="s2">"typeclasses.sittables.Sittable"</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"armchair"</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="n">here</span><span class="p">)</span>
|
||||
<span class="o">></span> <span class="n">armchair</span><span class="o">.</span><span class="n">do_sit</span><span class="p">(</span><span class="n">me</span><span class="p">)</span>
|
||||
<span class="o">></span> <span class="n">You</span> <span class="n">sit</span> <span class="n">on</span> <span class="n">armchair</span><span class="o">.</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This is not grammatically correct, you actually sit “in” an armchair rather than “on” it. It’s also possible to both sit ‘in’ or ‘on’ a chair depending on the type of chair (English is weird). We want to be able to control this.</p>
|
||||
<p>We <em>could</em> make a child class of <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> named <code class="docutils literal notranslate"><span class="pre">SittableIn</span></code> that makes this change, but that feels excessive. Instead we will modify what we have:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span>
|
||||
<span class="normal">24</span>
|
||||
<span class="normal">25</span>
|
||||
<span class="normal">26</span>
|
||||
<span class="normal">27</span>
|
||||
<span class="normal">28</span>
|
||||
<span class="normal">29</span>
|
||||
<span class="normal">30</span>
|
||||
<span class="normal">31</span>
|
||||
<span class="normal">32</span>
|
||||
<span class="normal">33</span>
|
||||
<span class="normal">34</span>
|
||||
<span class="normal">35</span>
|
||||
<span class="normal">36</span>
|
||||
<span class="normal">37</span>
|
||||
<span class="normal">38</span>
|
||||
<span class="normal">39</span>
|
||||
<span class="normal">40</span>
|
||||
<span class="normal">41</span>
|
||||
<span class="normal">42</span>
|
||||
<span class="normal">43</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/typeclasses/sittables.py</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultObject</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">Sittable</span><span class="p">(</span><span class="n">DefaultObject</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">do_sit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sitter</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Called when trying to sit on/in this object.</span>
|
||||
|
||||
<span class="sd"> Args:</span>
|
||||
<span class="sd"> sitter (Object): The one trying to sit down.</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="hll"> <span class="n">adjective</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">adjective</span> <span class="ow">or</span> <span class="s2">"on"</span>
|
||||
</span> <span class="n">current</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitter</span>
|
||||
<span class="k">if</span> <span class="n">current</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">current</span> <span class="o">==</span> <span class="n">sitter</span><span class="p">:</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You are already sitting </span><span class="si">{</span><span class="n">adjective</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span>
|
||||
<span class="hll"> <span class="sa">f</span><span class="s2">"You can't sit </span><span class="si">{</span><span class="n">adjective</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> "</span>
|
||||
</span> <span class="sa">f</span><span class="s2">"- </span><span class="si">{</span><span class="n">current</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> is already sitting there!"</span><span class="p">)</span>
|
||||
<span class="k">return</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitting</span> <span class="o">=</span> <span class="n">sitter</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_sitting</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span>
|
||||
<span class="n">sitter</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You sit </span><span class="si">{</span><span class="n">adjective</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">do_stand</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">stander</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Called when trying to stand from this object.</span>
|
||||
|
||||
<span class="sd"> Args:</span>
|
||||
<span class="sd"> stander (Object): The one trying to stand up.</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">current</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitter</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">stander</span> <span class="o">==</span> <span class="n">current</span><span class="p">:</span>
|
||||
<span class="n">stander</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You are not sitting </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">adjective</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitting</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="k">del</span> <span class="n">stander</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_sitting</span>
|
||||
<span class="hll"> <span class="n">stander</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You stand up from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 15</strong>: We grab the <code class="docutils literal notranslate"><span class="pre">adjective</span></code> Attribute. Using <code class="docutils literal notranslate"><span class="pre">seld.db.adjective</span> <span class="pre">or</span> <span class="pre">"on"</span></code> here means that if the Attribute is not set (is <code class="docutils literal notranslate"><span class="pre">None</span></code>/falsy) the default “on” string will be assumed.</p></li>
|
||||
<li><p><strong>Lines 22 and 43</strong>: We use this adjective to modify the return text we see.</p></li>
|
||||
</ul>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">reload</span></code> the server. An advantage of using Attributes like this is that they can be modified on the fly, in-game. Let’s look at a builder could use this by normal building commands (no need for <code class="docutils literal notranslate"><span class="pre">py</span></code>):</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="nb">set</span> <span class="n">armchair</span><span class="o">/</span><span class="n">adjective</span> <span class="o">=</span> <span class="ow">in</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Since we haven’t added the <code class="docutils literal notranslate"><span class="pre">sit</span></code> command yet, we must still use <code class="docutils literal notranslate"><span class="pre">py</span></code> to test:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="n">py</span> <span class="n">armchair</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">search_object</span><span class="p">(</span><span class="s2">"armchair"</span><span class="p">)[</span><span class="mi">0</span><span class="p">];</span><span class="n">armchair</span><span class="o">.</span><span class="n">do_sit</span><span class="p">(</span><span class="n">me</span><span class="p">)</span>
|
||||
<span class="n">You</span> <span class="n">sit</span> <span class="ow">in</span> <span class="n">armchair</span><span class="o">.</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="extra-credits">
|
||||
<h3><span class="section-number">13.2.2. </span>Extra credits<a class="headerlink" href="#extra-credits" title="Permalink to this headline">¶</a></h3>
|
||||
<p>What if we want some more dramatic flair when you sit down in certain chairs?</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>You sit down and a whoopie cushion makes a loud fart noise!
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can make this happen by tweaking your <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> class having the return messages be replaceable by <code class="docutils literal notranslate"><span class="pre">Attributes</span></code> that you can set on the object you create. You want something like this:</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>> chair = evennia.create_object("typeclasses.sittables.Sittable", key="pallet")
|
||||
> chair.do_sit(me)
|
||||
You sit down on pallet.
|
||||
> chair.do_stand(me)
|
||||
You stand up from pallet.
|
||||
> chair.db.msg_sitting_down = "You sit down and a whoopie cushion makes a loud fart noise!"
|
||||
> chair.do_sit(me)
|
||||
You sit down and a whoopie cushion makes a loud fart noise!
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>That is, if you are not setting the Attribute, you should get a default value. We leave this implementation up to the reader.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="adding-commands">
|
||||
<h2><span class="section-number">13.3. </span>Adding commands<a class="headerlink" href="#adding-commands" title="Permalink to this headline">¶</a></h2>
|
||||
<p>As we discussed in the <a class="reference internal" href="Beginner-Tutorial-More-on-Commands.html"><span class="doc std std-doc">lesson about adding Commands</span></a>, there are two main ways to design the commands for sitting and standing up:</p>
|
||||
<ul class="simple">
|
||||
<li><p>You can store the commands on the chair so they are only available when a chair is in the room</p></li>
|
||||
<li><p>You can store the commands on the Character so they are always available and you must always specify which chair to sit on.</p></li>
|
||||
</ul>
|
||||
<p>Both of these are very useful to know about, so in this lesson we’ll try both.</p>
|
||||
<section id="command-variant-1-commands-on-the-chair">
|
||||
<h3><span class="section-number">13.3.1. </span>Command variant 1: Commands on the chair<a class="headerlink" href="#command-variant-1-commands-on-the-chair" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This way to implement <code class="docutils literal notranslate"><span class="pre">sit</span></code> and <code class="docutils literal notranslate"><span class="pre">stand</span></code> puts new cmdsets on the Sittable itself.
|
||||
As we’ve learned before, commands on objects are made available to others in the room.
|
||||
This makes the command easy but instead adds some complexity in the management of the CmdSet.</p>
|
||||
<p>This is how it could look if <code class="docutils literal notranslate"><span class="pre">armchair</span></code> is in the room (if you overrode the sit message):</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> sit
|
||||
As you sit down in armchair, life feels easier.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>What happens if there are sittables <code class="docutils literal notranslate"><span class="pre">sofa</span></code> and <code class="docutils literal notranslate"><span class="pre">barstool</span></code> also in the room? Evennia will automatically
|
||||
handle this for us and allow us to specify which one we want:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> sit
|
||||
More than one match for 'sit' (please narrow target):
|
||||
sit-1 (armchair)
|
||||
sit-2 (sofa)
|
||||
sit-3 (barstool)
|
||||
> sit-1
|
||||
As you sit down in armchair, life feels easier.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>To keep things separate we’ll make a new module <code class="docutils literal notranslate"><span class="pre">mygame/commands/sittables.py</span></code>:</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Separate Commands and Typeclasses?</p>
|
||||
<p>You can organize these things as you like. If you wanted you could put the sit-command + cmdset together with the <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> typeclass in <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/sittables.py</span></code>. That has the advantage of keeping everything related to sitting in one place. But there is also some organizational merit to keeping all Commands in one place as we do here.</p>
|
||||
</aside>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span>
|
||||
<span class="normal">24</span>
|
||||
<span class="normal">25</span>
|
||||
<span class="normal">26</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/commands/sittables.py </span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">Command</span><span class="p">,</span> <span class="n">CmdSet</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdSit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Sit down.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"sit"</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">do_sit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="p">)</span>
|
||||
</span>
|
||||
<span class="k">class</span> <span class="nc">CmdStand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Stand up.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"stand"</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">do_stand</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="p">)</span>
|
||||
</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdSetSit</span><span class="p">(</span><span class="n">CmdSet</span><span class="p">):</span>
|
||||
<span class="hll"> <span class="n">priority</span> <span class="o">=</span> <span class="mi">1</span>
|
||||
</span> <span class="k">def</span> <span class="nf">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">CmdSit</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">CmdStand</span><span class="p">)</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>As seen, the commands are nearly trivial.</p>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Lines 11 and 19</strong>: The <code class="docutils literal notranslate"><span class="pre">self.obj</span></code> is the object to which we added the cmdset with this Command (so the chair). We just call the <code class="docutils literal notranslate"><span class="pre">do_sit/stand</span></code> on that object and pass the <code class="docutils literal notranslate"><span class="pre">caller</span></code> (the person sitting down). The <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> will do the rest.</p></li>
|
||||
<li><p><strong>Line 23</strong>: The <code class="docutils literal notranslate"><span class="pre">priority</span> <span class="pre">=</span> <span class="pre">1</span></code> on <code class="docutils literal notranslate"><span class="pre">CmdSetSit</span></code> means that same-named Commands from this cmdset merge with a bit higher priority than Commands from the on-Character-cmdset (which has <code class="docutils literal notranslate"><span class="pre">priority</span> <span class="pre">=</span> <span class="pre">0</span></code>). This means that if you have a <code class="docutils literal notranslate"><span class="pre">sit</span></code> command on your Character and comes into a room with a chair, the <code class="docutils literal notranslate"><span class="pre">sit</span></code> command on the chair will take precedence.</p></li>
|
||||
</ul>
|
||||
<p>We also need to make a change to our <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> typeclass. Open <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/sittables.py</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/typeclasses/sittables.py</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultObject</span>
|
||||
<span class="hll"><span class="kn">from</span> <span class="nn">commands.sittables</span> <span class="kn">import</span> <span class="n">CmdSetSit</span>
|
||||
</span>
|
||||
<span class="k">class</span> <span class="nc">Sittable</span><span class="p">(</span><span class="n">DefaultObject</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> (docstring)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="hll"> <span class="k">def</span> <span class="nf">at_object_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
</span><span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">cmdset</span><span class="o">.</span><span class="n">add_default</span><span class="p">(</span><span class="n">CmdSetSit</span><span class="p">)</span><span class="n">A</span>
|
||||
</span> <span class="c1"># ... </span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 4</strong>: We must install the <code class="docutils literal notranslate"><span class="pre">CmdSetSit</span></code> .</p></li>
|
||||
<li><p><strong>Line 10</strong>: The <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code> method will only be called once, when the object is first created.</p></li>
|
||||
<li><p><strong>Line 11</strong>: We add the command-set as a ‘default’ cmdset with <code class="docutils literal notranslate"><span class="pre">add_default</span></code>. This makes it persistent also protects it from being deleted should another cmdset be added. See <a class="reference internal" href="../../../Components/Command-Sets.html"><span class="doc std std-doc">Command Sets</span></a> for more info.</p></li>
|
||||
</ul>
|
||||
<p>Make sure to <code class="docutils literal notranslate"><span class="pre">reload</span></code> to make the code changes available.</p>
|
||||
<p>All <em>new</em> Sittables will now have your <code class="docutils literal notranslate"><span class="pre">sit</span></code> Command. Your existing <code class="docutils literal notranslate"><span class="pre">armchair</span></code> will not though. This is because <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code> will not re-run for already existing objects. We can update it manually:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> update armchair
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We could also update all existing sittables (all on one line):</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">List comprehensions </p>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">[obj</span> <span class="pre">for</span> <span class="pre">obj</span> <span class="pre">in</span> <span class="pre">iterator]</span></code> is an example of a <em>list comprehension</em>. Think of it as an efficient way to construct a new list all in one line. You can read more about list comprehensions <a class="reference external" href="https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions">here in the Python docs</a>.</p>
|
||||
</aside>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> py from typeclasses.sittables import Sittable ;
|
||||
[sittable.at_object_creation() for sittable in Sittable.objects.all()]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We should now be able to use <code class="docutils literal notranslate"><span class="pre">sit</span></code> while in the room with the armchair.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> sit
|
||||
As you sit down in armchair, life feels easier.
|
||||
> stand
|
||||
You stand up from armchair.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>One issue with placing the <code class="docutils literal notranslate"><span class="pre">sit</span></code> (or <code class="docutils literal notranslate"><span class="pre">stand</span></code>) Command “on” the chair is that it will not be available when in a room without a Sittable object:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> sit
|
||||
Command 'sit' is not available. ...
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This is practical but not so good-looking; it makes it harder for the user to know a <code class="docutils literal notranslate"><span class="pre">sit</span></code> action is at all possible. Here is a trick for fixing this. Let’s add <em>another</em> Command to the bottom
|
||||
of <code class="docutils literal notranslate"><span class="pre">mygame/commands/sittables.py</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># after the other commands in mygame/commands/sittables.py</span>
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdNoSitStand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Sit down or Stand up</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"sit"</span>
|
||||
<span class="hll"> <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"stand"</span><span class="p">]</span>
|
||||
</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="hll"> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">cmdname</span> <span class="o">==</span> <span class="s2">"sit"</span><span class="p">:</span>
|
||||
</span> <span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"You have nothing to sit on."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"You are not sitting down."</span><span class="p">)</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 9</strong>: This command responds both to <code class="docutils literal notranslate"><span class="pre">sit</span></code> and <code class="docutils literal notranslate"><span class="pre">stand</span></code> because we added <code class="docutils literal notranslate"><span class="pre">stand</span></code> to its <code class="docutils literal notranslate"><span class="pre">aliases</span></code> list. Command aliases have the same ‘weight’ as the <code class="docutils literal notranslate"><span class="pre">key</span></code> of the command, both equally identify the Command.</p></li>
|
||||
<li><p><strong>Line 12</strong>: The <code class="docutils literal notranslate"><span class="pre">.cmdname</span></code> of a <code class="docutils literal notranslate"><span class="pre">Command</span></code> holds the name actually used to call it. This will be one of <code class="docutils literal notranslate"><span class="pre">"sit"</span></code> or <code class="docutils literal notranslate"><span class="pre">"stand"</span></code>. This leads to different return messages.</p></li>
|
||||
</ul>
|
||||
<p>We don’t need a new CmdSet for this, instead we will add this to the default Character cmdset. Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/commands/default_cmdsets.py</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
<span class="kn">from</span> <span class="nn">commands</span> <span class="kn">import</span> <span class="n">sittables</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">CmdSet</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> (docstring)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># ...</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">sittables</span><span class="o">.</span><span class="n">CmdNoSitStand</span><span class="p">)</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>As usual, make sure to <code class="docutils literal notranslate"><span class="pre">reload</span></code> the server to have the new code recognized.</p>
|
||||
<p>To test we’ll build a new location without any comfy armchairs and go there:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> tunnel n = kitchen
|
||||
north
|
||||
> sit
|
||||
You have nothing to sit on.
|
||||
> south
|
||||
sit
|
||||
As you sit down in armchair, life feels easier.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We now have a fully functioning <code class="docutils literal notranslate"><span class="pre">sit</span></code> action that is contained with the chair itself. When no chair is around, a default error message is shown.</p>
|
||||
<p>How does this work? There are two cmdsets at play, both of which have a <code class="docutils literal notranslate"><span class="pre">sit/stand</span></code> Command - one on the <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> (armchair) and the other on us (via the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code>). Since we set a <code class="docutils literal notranslate"><span class="pre">priority=1</span></code> on the chair’s cmdset (and <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code> has <code class="docutils literal notranslate"><span class="pre">priority=0</span></code>), there will be no command-collision: the chair’s <code class="docutils literal notranslate"><span class="pre">sit</span></code> takes precedence over the <code class="docutils literal notranslate"><span class="pre">sit</span></code> defined on us … until there is no chair around.</p>
|
||||
<p>So this handles <code class="docutils literal notranslate"><span class="pre">sit</span></code>. What about <code class="docutils literal notranslate"><span class="pre">stand</span></code>? That will work just fine:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> stand
|
||||
You stand up from armchair.
|
||||
> north
|
||||
> stand
|
||||
You are not sitting down.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We have one remaining problem with <code class="docutils literal notranslate"><span class="pre">stand</span></code> though - what happens when you are sitting down and try to <code class="docutils literal notranslate"><span class="pre">stand</span></code> in a room with more than one <code class="docutils literal notranslate"><span class="pre">Sittable</span></code>:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> stand
|
||||
More than one match for 'stand' (please narrow target):
|
||||
stand-1 (armchair)
|
||||
stand-2 (sofa)
|
||||
stand-3 (barstool)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Since all the sittables have the <code class="docutils literal notranslate"><span class="pre">stand</span></code> Command on them, you’ll get a multi-match error. This <em>works</em> … but you could pick <em>any</em> of those sittables to “stand up from”. That’s really weird.</p>
|
||||
<p>With <code class="docutils literal notranslate"><span class="pre">sit</span></code> it was okay to get a choice - Evennia can’t know which chair we intended to sit on. But once we sit we sure know from which chair we should stand up from! We must make sure that we only get the command from the chair we are actually sitting on.</p>
|
||||
<p>We will fix this with a <a class="reference internal" href="../../../Components/Locks.html"><span class="doc std std-doc">Lock</span></a> and a custom <code class="docutils literal notranslate"><span class="pre">lock</span> <span class="pre">function</span></code>. We want a lock on the <code class="docutils literal notranslate"><span class="pre">stand</span></code> Command that only makes it available when the caller is actually sitting on the chair that particular <code class="docutils literal notranslate"><span class="pre">stand</span></code> command is attached to.</p>
|
||||
<p>First let’s add the lock so we see what we want. Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/sittables.py</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/commands/sittables.py</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdStand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Stand up.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"stand"</span>
|
||||
<span class="hll"> <span class="n">lock</span> <span class="o">=</span> <span class="s2">"cmd:sitsonthis()"</span>
|
||||
</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">do_stand</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="p">)</span>
|
||||
<span class="c1"># ...</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 10</strong>: This is the lock definition. It’s on the form <code class="docutils literal notranslate"><span class="pre">condition:lockfunc</span></code>. The <code class="docutils literal notranslate"><span class="pre">cmd:</span></code> type lock is checked by Evennia when determining if a user has access to a Command at all. We want the lock-function to only return <code class="docutils literal notranslate"><span class="pre">True</span></code> if this command is on a chair which the caller is sitting on.
|
||||
What will be checked is the <code class="docutils literal notranslate"><span class="pre">sitsonthis</span></code> <em>lock function</em> which doesn’t exist yet.</p></li>
|
||||
</ul>
|
||||
<p>Open <code class="docutils literal notranslate"><span class="pre">mygame/server/conf/lockfuncs.py</span></code> to add it!</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/server/conf/lockfuncs.py</span>
|
||||
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd">(module lockstring)</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">sitsonthis</span><span class="p">(</span><span class="n">accessing_obj</span><span class="p">,</span> <span class="n">accessed_obj</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> True if accessing_obj is sitting on/in the accessed_obj.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">accessed_obj</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">sitting</span> <span class="o">==</span> <span class="n">accessing_obj</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Evennia knows that <em>all</em> functions in <code class="docutils literal notranslate"><span class="pre">mygame/server/conf/lockfuncs</span></code> should be possible to use in a lock definition.</p>
|
||||
<p>All lock functions must acccept the same arguments. The arguments are required and Evennia will pass all relevant objects as needed.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Lockfuncs</p>
|
||||
<p>Evennia provides a large number of default lockfuncs, such as checking permission-levels, if you are carrying or are inside the accessed object etc. There is no concept of ‘sitting’ in default Evennia however, so this we need to specify ourselves.</p>
|
||||
</aside>
|
||||
<ul class="simple">
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">accessing_obj</span></code> is the one trying to access the lock. So us, in this case.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">accessed_obj</span></code> is the entity we are trying to gain a particular type of access to. So the chair.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">args</span></code> is a tuple holding any arguments passed to the lockfunc. Since we use <code class="docutils literal notranslate"><span class="pre">sitsondthis()</span></code> this will be empty (and if we add anything, it will be ignored).</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">kwargs</span></code> is a tuple of keyword arguments passed to the lockfuncs. This will be empty as well in our example.</p></li>
|
||||
</ul>
|
||||
<p>Make sure you <code class="docutils literal notranslate"><span class="pre">reload</span></code>.</p>
|
||||
<p>If you are superuser, it’s important that you <code class="docutils literal notranslate"><span class="pre">quell</span></code> yourself before trying this out. This is because the superuser bypasses all locks - it can never get locked out, but it means it will also not see the effects of a lock like this.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> quell
|
||||
> stand
|
||||
You stand up from armchair
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>None of the other sittables’ <code class="docutils literal notranslate"><span class="pre">stand</span></code> commands passed the lock and only the one we are actually sitting on did! This is a fully functional chair now!</p>
|
||||
<p>Adding a Command to the chair object like this is powerful and is a good technique to know. It does come with some caveats though, as we’ve seen.</p>
|
||||
<p>We’ll now try another way to add the <code class="docutils literal notranslate"><span class="pre">sit/stand</span></code> commands.</p>
|
||||
</section>
|
||||
<section id="command-variant-2-command-on-character">
|
||||
<h3><span class="section-number">13.3.2. </span>Command variant 2: Command on Character<a class="headerlink" href="#command-variant-2-command-on-character" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Before we start with this, delete the chairs you’ve created:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> del armchair
|
||||
> del sofa
|
||||
> (etc)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The make the following changes:</p>
|
||||
<ul class="simple">
|
||||
<li><p>In <code class="docutils literal notranslate"><span class="pre">mygame/typeclasses/sittables.py</span></code>, comment out the entire <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code> method.</p></li>
|
||||
<li><p>In <code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>, comment out the line <code class="docutils literal notranslate"><span class="pre">self.add(sittables.CmdNoSitStand)</span></code>.</p></li>
|
||||
</ul>
|
||||
<p>This disables the on-object command solution so we can try an alternative. Make sure to <code class="docutils literal notranslate"><span class="pre">reload</span></code> so the changes are known to Evennia.</p>
|
||||
<p>In this variation we will put the <code class="docutils literal notranslate"><span class="pre">sit</span></code> and <code class="docutils literal notranslate"><span class="pre">stand</span></code> commands on the <code class="docutils literal notranslate"><span class="pre">Character</span></code> instead of on the chair. This makes some things easier, but makes the Commands themselves more complex because they will not know which chair to sit on. We can’t just do <code class="docutils literal notranslate"><span class="pre">sit</span></code> anymore. This is how it will work.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> sit <chair>
|
||||
You sit on chair.
|
||||
> stand
|
||||
You stand up from chair.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/sittables.py</span></code> again. We’ll add a new sit-command. We name the class <code class="docutils literal notranslate"><span class="pre">CmdSit2</span></code> since we already have <code class="docutils literal notranslate"><span class="pre">CmdSit</span></code> from the previous example. We put everything at the end of the module to keep it separate.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span>
|
||||
<span class="normal">24</span>
|
||||
<span class="normal">25</span>
|
||||
<span class="normal">26</span>
|
||||
<span class="normal">27</span>
|
||||
<span class="normal">28</span>
|
||||
<span class="normal">29</span>
|
||||
<span class="normal">30</span>
|
||||
<span class="normal">31</span>
|
||||
<span class="normal">32</span>
|
||||
<span class="normal">33</span>
|
||||
<span class="normal">34</span>
|
||||
<span class="normal">35</span>
|
||||
<span class="normal">36</span>
|
||||
<span class="normal">37</span>
|
||||
<span class="normal">38</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># in mygame/commands/sittables.py</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">Command</span><span class="p">,</span> <span class="n">CmdSet</span>
|
||||
<span class="hll"><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">InterruptCommand</span>
|
||||
</span>
|
||||
<span class="k">class</span> <span class="nc">CmdSit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
<span class="c1"># new from here</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdSit2</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Sit down.</span>
|
||||
|
||||
<span class="sd"> Usage:</span>
|
||||
<span class="sd"> sit <sittable></span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"sit"</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"Sit on what?"</span><span class="p">)</span>
|
||||
<span class="hll"> <span class="k">raise</span> <span class="n">InterruptCommand</span>
|
||||
</span>
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
|
||||
<span class="c1"># self.search handles all error messages etc.</span>
|
||||
<span class="hll"> <span class="n">sittable</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">)</span>
|
||||
</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">sittable</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="hll"> <span class="k">try</span><span class="p">:</span>
|
||||
</span> <span class="n">sittable</span><span class="o">.</span><span class="n">do_sit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="p">)</span>
|
||||
<span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"You can't sit on that!"</span><span class="p">)</span>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Raising exceptions</p>
|
||||
<p>Raising an exception allows for immediately interrupting the current program flow. Python automatically raises error-exceptions when detecting problems with the code. It will be raised up through the sequence of called code (the ‘stack’) until it’s either <code class="docutils literal notranslate"><span class="pre">caught</span></code> with a <code class="docutils literal notranslate"><span class="pre">try</span> <span class="pre">...</span> <span class="pre">except</span></code> or reaches the outermost scope where it’ll be logged or displayed. In this case Evennia knows to catch the <code class="docutils literal notranslate"><span class="pre">InterruptCommand</span></code> exception and stop the command execution early.</p>
|
||||
</aside>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 4</strong>: We need the <code class="docutils literal notranslate"><span class="pre">InterruptCommand</span></code> to be able to abort command parsing early (see below).</p></li>
|
||||
<li><p><strong>Line 27</strong>: The <code class="docutils literal notranslate"><span class="pre">parse</span></code> method runs before the <code class="docutils literal notranslate"><span class="pre">func</span></code> method on a <code class="docutils literal notranslate"><span class="pre">Command</span></code>. If no argument is provided to the command, we want to fail early, already in <code class="docutils literal notranslate"><span class="pre">parse</span></code>, so <code class="docutils literal notranslate"><span class="pre">func</span></code> never fires. Just <code class="docutils literal notranslate"><span class="pre">return</span></code> is not enough to do that, we need to <code class="docutils literal notranslate"><span class="pre">raise</span> <span class="pre">InterruptCommand</span></code>. Evennia will see a raised <code class="docutils literal notranslate"><span class="pre">InterruptCommand</span></code> as a sign it should immediately abort the command execution.</p></li>
|
||||
<li><p><strong>Line 32</strong>: We use the parsed command arguments as the target-chair to search for. As discussed in the <a class="reference internal" href="Beginner-Tutorial-Searching-Things.html"><span class="doc std std-doc">search tutorial</span></a>, <code class="docutils literal notranslate"><span class="pre">self.caller.search()</span></code> will handle error messages itself. So if it returns <code class="docutils literal notranslate"><span class="pre">None</span></code>, we can just <code class="docutils literal notranslate"><span class="pre">return</span></code>.</p></li>
|
||||
<li><p><strong>Line 35-38</strong>: The <code class="docutils literal notranslate"><span class="pre">try...except</span></code> block ‘catches’ and exception and handles it. In this case we try to run <code class="docutils literal notranslate"><span class="pre">do_sit</span></code> on the object. If the object we found is <em>not</em> a <code class="docutils literal notranslate"><span class="pre">Sittable</span></code>, it will likely not have a <code class="docutils literal notranslate"><span class="pre">do_sit</span></code> method and an <code class="docutils literal notranslate"><span class="pre">AttributeError</span></code> will be raised. We should handle that case gracefully.</p></li>
|
||||
</ul>
|
||||
<p>Let’s do the <code class="docutils literal notranslate"><span class="pre">stand</span></code> command while we are at it. Since the Command is external to the chair we don’t know which object we are sitting on and have to search for it. In this case we really want to find <em>only</em> things we are sitting on.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># end of mygame/commands/sittables.py</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdStand2</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Stand up.</span>
|
||||
|
||||
<span class="sd"> Usage:</span>
|
||||
<span class="sd"> stand</span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"stand"</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
|
||||
<span class="n">caller</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span>
|
||||
<span class="c1"># if we are sitting, this should be set on us</span>
|
||||
<span class="hll"> <span class="n">sittable</span> <span class="o">=</span> <span class="n">caller</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">is_sitting</span>
|
||||
</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">sittable</span><span class="p">:</span>
|
||||
<span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"You are not sitting down."</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="hll"> <span class="n">sittable</span><span class="o">.</span><span class="n">do_stand</span><span class="p">(</span><span class="n">caller</span><span class="p">)</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line 17</strong>: We didn’t need the <code class="docutils literal notranslate"><span class="pre">is_sitting</span></code> Attribute for the first version of these Commands, but we do need it now. Since we have this, we don’t need to search and know just which chair we sit on. If we don’t have this set, we are not sitting anywhere.</p></li>
|
||||
<li><p><strong>Line 21</strong>: We stand up using the sittable we found.</p></li>
|
||||
</ul>
|
||||
<p>All that is left now is to make this available to us. This type of Command should be available to us all the time so we can put it in the default Cmdset on the Character. Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/commands/default_cmdsets.py</span>
|
||||
|
||||
<span class="c1"># ...</span>
|
||||
<span class="kn">from</span> <span class="nn">commands</span> <span class="kn">import</span> <span class="n">sittables</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">CmdSet</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> (docstring)</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">def</span> <span class="nf">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="c1"># ...</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">sittables</span><span class="o">.</span><span class="n">CmdSit2</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">sittables</span><span class="o">.</span><span class="n">CmdStand2</span><span class="p">)</span>
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Make sure to <code class="docutils literal notranslate"><span class="pre">reload</span></code>.</p>
|
||||
<p>Now let’s try it out:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> create/drop sofa : sittables.Sittable
|
||||
> sit sofa
|
||||
You sit down on sofa.
|
||||
> stand
|
||||
You stand up from sofa.
|
||||
> north
|
||||
> sit sofa
|
||||
> You can't find 'sofa'.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Storing commands on the Character centralizes them, but you must instead search or store any external objects you want that command to interact on.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="conclusions">
|
||||
<h2><span class="section-number">13.4. </span>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In this lesson we built ourselves a chair and even a sofa!</p>
|
||||
<ul class="simple">
|
||||
<li><p>We modified our <code class="docutils literal notranslate"><span class="pre">Character</span></code> class to avoid moving when sitting down.</p></li>
|
||||
<li><p>We made a new <code class="docutils literal notranslate"><span class="pre">Sittable</span></code> typeclass</p></li>
|
||||
<li><p>We tried two ways to allow a user to interact with sittables using <code class="docutils literal notranslate"><span class="pre">sit</span></code> and <code class="docutils literal notranslate"><span class="pre">stand</span></code> commands.</p></li>
|
||||
</ul>
|
||||
<p>Eagle-eyed readers will notice that the <code class="docutils literal notranslate"><span class="pre">stand</span></code> command sitting “on” the chair (variant 1) would work just fine together with the <code class="docutils literal notranslate"><span class="pre">sit</span></code> command sitting “on” the Character (variant 2). There is nothing stopping you from mixing them, or even try a third solution that better fits what you have in mind.</p>
|
||||
<p>This concludes the first part of the Beginner tutorial!</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Django-queries.html" title="12. Advanced searching - Django Database queries"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part1-Intro.html" >Part 1: What we have</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">13. </span>Building a chair you can sit on</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
<div class="footer" role="contentinfo">
|
||||
© Copyright 2022, The Evennia developer community.
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
also learn how to add, modify and extend Evennia’s default commands.</p>
|
||||
<section id="more-advanced-parsing">
|
||||
<h2><span class="section-number">9.1. </span>More advanced parsing<a class="headerlink" href="#more-advanced-parsing" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In the last lesson we made a <code class="docutils literal notranslate"><span class="pre">hit</span></code> Command and hit a dragon with it. You should have the code
|
||||
<p>In the <a class="reference internal" href="Beginner-Tutorial-Adding-Commands.html"><span class="doc std std-doc">last lesson</span></a> we made a <code class="docutils literal notranslate"><span class="pre">hit</span></code> Command and struck a dragon with it. You should have the code
|
||||
from that still around.</p>
|
||||
<p>Let’s expand our simple <code class="docutils literal notranslate"><span class="pre">hit</span></code> command to accept a little more complex input:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>hit <target> [[with] <weapon>]
|
||||
|
|
@ -135,9 +135,50 @@ hit target with weapon
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>If you don’t specify a weapon you’ll use your fists. It’s also nice to be able to skip “with” if
|
||||
you are in a hurry. Time to modify <code class="docutils literal notranslate"><span class="pre">mygame/commands/mycommands.py</span></code> again. Let us break out the parsing
|
||||
a little, in a new method <code class="docutils literal notranslate"><span class="pre">parse</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1">#...</span>
|
||||
you are in a hurry. Time to modify <code class="docutils literal notranslate"><span class="pre">mygame/commands/mycommands.py</span></code> again. Let us break out the parsing a little, in a new method <code class="docutils literal notranslate"><span class="pre">parse</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
||||
<span class="normal"> 2</span>
|
||||
<span class="normal"> 3</span>
|
||||
<span class="normal"> 4</span>
|
||||
<span class="normal"> 5</span>
|
||||
<span class="normal"> 6</span>
|
||||
<span class="normal"> 7</span>
|
||||
<span class="normal"> 8</span>
|
||||
<span class="normal"> 9</span>
|
||||
<span class="normal">10</span>
|
||||
<span class="normal">11</span>
|
||||
<span class="normal">12</span>
|
||||
<span class="normal">13</span>
|
||||
<span class="normal">14</span>
|
||||
<span class="normal">15</span>
|
||||
<span class="normal">16</span>
|
||||
<span class="normal">17</span>
|
||||
<span class="normal">18</span>
|
||||
<span class="normal">19</span>
|
||||
<span class="normal">20</span>
|
||||
<span class="normal">21</span>
|
||||
<span class="normal">22</span>
|
||||
<span class="normal">23</span>
|
||||
<span class="normal">24</span>
|
||||
<span class="normal">25</span>
|
||||
<span class="normal">26</span>
|
||||
<span class="normal">27</span>
|
||||
<span class="normal">28</span>
|
||||
<span class="normal">29</span>
|
||||
<span class="normal">30</span>
|
||||
<span class="normal">31</span>
|
||||
<span class="normal">32</span>
|
||||
<span class="normal">33</span>
|
||||
<span class="normal">34</span>
|
||||
<span class="normal">35</span>
|
||||
<span class="normal">36</span>
|
||||
<span class="normal">37</span>
|
||||
<span class="normal">38</span>
|
||||
<span class="normal">39</span>
|
||||
<span class="normal">40</span>
|
||||
<span class="normal">41</span>
|
||||
<span class="normal">42</span>
|
||||
<span class="normal">43</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1">#...</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CmdHit</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
|
|
@ -150,12 +191,12 @@ a little, in a new method <code class="docutils literal notranslate"><span class
|
|||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"hit"</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">weapon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" with "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">weapon</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">if</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
</span><span class="hll"> <span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">weapon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" with "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
</span><span class="hll"> <span class="k">if</span> <span class="ow">not</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
</span> <span class="n">target</span><span class="p">,</span> <span class="o">*</span><span class="n">weapon</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
</span> <span class="k">if</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">weapon</span> <span class="o">=</span> <span class="n">weapon</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">weapon</span> <span class="o">=</span> <span class="s2">""</span>
|
||||
|
|
@ -165,28 +206,24 @@ a little, in a new method <code class="docutils literal notranslate"><span class
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">"Who do you want to hit?"</span><span class="p">)</span>
|
||||
<span class="k">return</span>
|
||||
<span class="c1"># get the target for the hit</span>
|
||||
<span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">target</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">target</span><span class="p">:</span>
|
||||
<span class="hll"> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">target</span><span class="p">)</span>
|
||||
</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">target</span><span class="p">:</span>
|
||||
<span class="k">return</span>
|
||||
<span class="c1"># get and handle the weapon</span>
|
||||
<span class="n">weapon</span> <span class="o">=</span> <span class="kc">None</span>
|
||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="n">weapon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weapon</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="hll"> <span class="n">weapon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">weapon</span><span class="p">)</span>
|
||||
</span> <span class="k">if</span> <span class="n">weapon</span><span class="p">:</span>
|
||||
<span class="n">weaponstr</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">weapon</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">weaponstr</span> <span class="o">=</span> <span class="s2">"bare fists"</span>
|
||||
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You hit </span><span class="si">{</span><span class="n">target</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with </span><span class="si">{</span><span class="n">weaponstr</span><span class="si">}</span><span class="s2">!"</span><span class="p">)</span>
|
||||
<span class="n">target</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You got hit by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with </span><span class="si">{</span><span class="n">weaponstr</span><span class="si">}</span><span class="s2">!"</span><span class="p">)</span>
|
||||
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You hit </span><span class="si">{</span><span class="n">target</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with </span><span class="si">{</span><span class="n">weaponstr</span><span class="si">}</span><span class="s2">!"</span><span class="p">)</span>
|
||||
</span> <span class="n">target</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"You got hit by </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> with </span><span class="si">{</span><span class="n">weaponstr</span><span class="si">}</span><span class="s2">!"</span><span class="p">)</span>
|
||||
<span class="c1"># ...</span>
|
||||
|
||||
</pre></div>
|
||||
</pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">parse</span></code> method is called before <code class="docutils literal notranslate"><span class="pre">func</span></code> and has access to all the same on-command variables as in <code class="docutils literal notranslate"><span class="pre">func</span></code>. Using
|
||||
<code class="docutils literal notranslate"><span class="pre">parse</span></code> not only makes things a little easier to read, it also means you can easily let other Commands <em>inherit</em>
|
||||
your parsing - if you wanted some other Command to also understand input on the form <code class="docutils literal notranslate"><span class="pre"><arg></span> <span class="pre">with</span> <span class="pre"><arg></span></code> you’d inherit
|
||||
from this class and just implement the <code class="docutils literal notranslate"><span class="pre">func</span></code> needed for that command without implementing <code class="docutils literal notranslate"><span class="pre">parse</span></code> anew.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">parse</span></code> method is a special one Evennia knows to call <em>before</em> <code class="docutils literal notranslate"><span class="pre">func</span></code>. At this time it has access to all the same on-command variables as <code class="docutils literal notranslate"><span class="pre">func</span></code> does. Using <code class="docutils literal notranslate"><span class="pre">parse</span></code> not only makes things a little easier to read, it also means you can easily let other Commands <em>inherit</em> your parsing - if you wanted some other Command to also understand input on the form <code class="docutils literal notranslate"><span class="pre"><arg></span> <span class="pre">with</span> <span class="pre"><arg></span></code> you’d inherit from this class and just implement the <code class="docutils literal notranslate"><span class="pre">func</span></code> needed for that command without implementing <code class="docutils literal notranslate"><span class="pre">parse</span></code> anew.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Tuples and Lists</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -233,25 +270,27 @@ for these local variables to made available in <code class="docutils literal not
|
|||
before running <code class="docutils literal notranslate"><span class="pre">strip()</span></code> on it. This is because we know that if it’s falsy, it’s an empty list <code class="docutils literal notranslate"><span class="pre">[]</span></code> and lists
|
||||
don’t have the <code class="docutils literal notranslate"><span class="pre">.strip()</span></code> method on them (so if we tried to use it, we’d get an error).</p></li>
|
||||
</ul>
|
||||
<p>Now onto the <code class="docutils literal notranslate"><span class="pre">func</span></code> method. The main difference is we now have <code class="docutils literal notranslate"><span class="pre">self.target</span></code> and <code class="docutils literal notranslate"><span class="pre">self.weapon</span></code> available for
|
||||
convenient use.</p>
|
||||
<ul class="simple">
|
||||
<p>Now onto the <code class="docutils literal notranslate"><span class="pre">func</span></code> method. The main difference is we now have <code class="docutils literal notranslate"><span class="pre">self.target</span></code> and <code class="docutils literal notranslate"><span class="pre">self.weapon</span></code> available for convenient use.</p>
|
||||
<aside class="sidebar">
|
||||
<p>Here we create the messages to send to each side of the fight explicitly. Later we’ll find out how to use Evennia’s <a class="reference internal" href="../../../Components/FuncParser.html"><span class="doc std std-doc">inline functions</span></a> to send a single string that looks different depending on who sees it.</p>
|
||||
</aside>
|
||||
<ul>
|
||||
<li><p><strong>Lines 29 and 35</strong> - We make use of the previously parsed search terms for the target and weapon to find the
|
||||
respective resource.</p></li>
|
||||
<li><p><strong>Lines 34-39</strong> - Since the weapon is optional, we need to supply a default (use our fists!) if it’s not set. We
|
||||
use this to create a <code class="docutils literal notranslate"><span class="pre">weaponstr</span></code> that is different depending on if we have a weapon or not.</p></li>
|
||||
<li><p><strong>Lines 41-42</strong> - We merge the <code class="docutils literal notranslate"><span class="pre">weaponstr</span></code> with our attack text.</p></li>
|
||||
<li><p><strong>Lines 41-42</strong> - We merge the <code class="docutils literal notranslate"><span class="pre">weaponstr</span></code> with our attack texts and send it to attacker and target respectively.
|
||||
Let’s try it out!</p>
|
||||
<blockquote>
|
||||
<div><p>reload
|
||||
hit smaug with sword
|
||||
Could not find ‘sword’.
|
||||
You hit smaug with bare fists!</p>
|
||||
</div></blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Let’s try it out!</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> reload
|
||||
> hit smaug with sword
|
||||
Could not find 'sword'.
|
||||
You hit smaug with bare fists!
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Oops, our <code class="docutils literal notranslate"><span class="pre">self.caller.search(self.weapon)</span></code> is telling us that it found no sword. Since we are not <code class="docutils literal notranslate"><span class="pre">return</span></code>ing
|
||||
in this situation (like we do if failing to find <code class="docutils literal notranslate"><span class="pre">target</span></code>) we still continue fighting with our bare hands.
|
||||
This won’t do. Let’s make ourselves a sword.</p>
|
||||
<p>Oops, our <code class="docutils literal notranslate"><span class="pre">self.caller.search(self.weapon)</span></code> is telling us that it found no sword. This is reasonable (we don’t have a sword). Since we are not <code class="docutils literal notranslate"><span class="pre">return</span></code>ing when failing to find a weapon in the way we do if we find no <code class="docutils literal notranslate"><span class="pre">target</span></code>, we still continue fighting with our bare hands.</p>
|
||||
<p>This won’t do. Let’s make ourselves a sword:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> create sword
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -262,13 +301,16 @@ change (no code changed, only stuff in the database).</p>
|
|||
You hit smaug with sword!
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Poor Smaug.</p>
|
||||
</section>
|
||||
<section id="adding-a-command-to-an-object">
|
||||
<h2><span class="section-number">9.2. </span>Adding a Command to an object<a class="headerlink" href="#adding-a-command-to-an-object" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The commands of a cmdset attached to an object with <code class="docutils literal notranslate"><span class="pre">obj.cmdset.add()</span></code> will by default be made available to that object
|
||||
but <em>also to those in the same location as that object</em>. If you did the <a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html"><span class="doc std std-doc">Building introduction</span></a>
|
||||
you’ve seen an example of this with the “Red Button” object. The <a class="reference internal" href="Beginner-Tutorial-Tutorial-World.html"><span class="doc std std-doc">Tutorial world</span></a>
|
||||
also has many examples of objects with commands on them.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Command Sets on Characters </p>
|
||||
<p>In case you wonder, the ‘Character CmdSet’ on <code class="docutils literal notranslate"><span class="pre">Characters</span></code> is configured to be available to <em>only</em> that Character. If not, you’d get command multi-matches for things like <code class="docutils literal notranslate"><span class="pre">look</span></code> whenever you were in the same room with another character using the same command set. See <a class="reference internal" href="../../../Components/Command-Sets.html"><span class="doc std std-doc">Command Sets</span></a> docs for more info.</p>
|
||||
</aside>
|
||||
<p>As we learned in the lesson about <a class="reference internal" href="Beginner-Tutorial-Adding-Commands.html"><span class="doc std std-doc">Adding commands</span></a>, Commands are are grouped in Command Sets. Such Command Sets are attached to an object with <code class="docutils literal notranslate"><span class="pre">obj.cmdset.add()</span></code> and will then be available for that object to use.</p>
|
||||
<p>What we didn’t mention before is that by default those commands are <em>also available to those in the same location as that object</em>. If you did the <a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html"><span class="doc std std-doc">Building quickstart lesson</span></a> you’ve seen an example of this with the “Red Button” object. The <a class="reference internal" href="Beginner-Tutorial-Tutorial-World.html"><span class="doc std std-doc">Tutorial world</span></a> also has many examples of objects with commands on them.</p>
|
||||
<p>To show how this could work, let’s put our ‘hit’ Command on our simple <code class="docutils literal notranslate"><span class="pre">sword</span></code> object from the previous section.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> self.search("sword").cmdset.add("commands.mycommands.MyCmdSet", persistent=True)
|
||||
</pre></div>
|
||||
|
|
@ -284,12 +326,9 @@ hit-2
|
|||
</div>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Multi-matches</p>
|
||||
<p>Some game engines will just pick the first hit when finding more than one. Evennia will always give you a choice. The reason for this is that Evennia cannot know if <code class="docutils literal notranslate"><span class="pre">hit</span></code> and <code class="docutils literal notranslate"><span class="pre">hit</span></code> are different or the same - maybe it behaves differently depending on the object it sits on? Besides, imagine if you had a red and a blue button both with the command <code class="docutils literal notranslate"><span class="pre">push</span></code> on it. Now you just write <code class="docutils literal notranslate"><span class="pre">push</span></code>. Wouldn’t you prefer to be asked <code class="docutils literal notranslate"><span class="pre">which</span></code> button you really wanted to push?</p>
|
||||
<p>Some game engines will just pick the first hit when finding more than one. Evennia will always give you a choice. The reason for this is that Evennia cannot know if <code class="docutils literal notranslate"><span class="pre">hit</span></code> and <code class="docutils literal notranslate"><span class="pre">hit</span></code> are different or the same - maybe it behaves differently depending on the object it sits on? Besides, imagine if you had a red and a blue button both with the command <code class="docutils literal notranslate"><span class="pre">push</span></code> on it. Now you just write <code class="docutils literal notranslate"><span class="pre">push</span></code>. Wouldn’t you prefer to be asked <em>which</em> button you really wanted to push?</p>
|
||||
</aside>
|
||||
<p>Woah, that didn’t go as planned. Evennia actually found <em>two</em> <code class="docutils literal notranslate"><span class="pre">hit</span></code> commands to didn’t know which one to use
|
||||
(<em>we</em> know they are the same, but Evennia can’t be sure of that). As we can see, <code class="docutils literal notranslate"><span class="pre">hit-1</span></code> is the one found on
|
||||
the sword. The other one is from adding <code class="docutils literal notranslate"><span class="pre">MyCmdSet</span></code> to ourself earlier. It’s easy enough to tell Evennia which
|
||||
one you meant:</p>
|
||||
<p>Woah, that didn’t go as planned. Evennia actually found <em>two</em> <code class="docutils literal notranslate"><span class="pre">hit</span></code> commands and didn’t know which one to use (<em>we</em> know they are the same, but Evennia can’t be sure of that). As we can see, <code class="docutils literal notranslate"><span class="pre">hit-1</span></code> is the one found on the sword. The other one is from adding <code class="docutils literal notranslate"><span class="pre">MyCmdSet</span></code> to ourself earlier. It’s easy enough to tell Evennia which one you meant:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> hit-1
|
||||
Who do you want to hit?
|
||||
> hit-2
|
||||
|
|
@ -302,7 +341,7 @@ Who do you want to hit?
|
|||
Who do you want to hit?
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Now try this:</p>
|
||||
<p>Now try making a new location and then drop the sword in it.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> tunnel n = kitchen
|
||||
> n
|
||||
> drop sword
|
||||
|
|
@ -314,24 +353,19 @@ Command 'hit' is not available. Maybe you meant ...
|
|||
Who do you want to hit?
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">hit</span></code> command is now only available if you hold or are in the same room as the sword.</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">hit</span></code> command is only available if you hold <em>or</em> are in the same room as the sword.</p>
|
||||
<section id="you-need-to-hold-the-sword">
|
||||
<h3><span class="section-number">9.2.1. </span>You need to hold the sword!<a class="headerlink" href="#you-need-to-hold-the-sword" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Let’s get a little ahead of ourselves and make it so you have to <em>hold</em> the sword for the <code class="docutils literal notranslate"><span class="pre">hit</span></code> command to
|
||||
be available. This involves a <em>Lock</em>. We’ve cover locks in more detail later, just know that they are useful
|
||||
for limiting the kind of things you can do with an object, including limiting just when you can call commands on
|
||||
it.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Locks</p>
|
||||
<p>Evennia Locks are defined as a mini-language defined in <code class="docutils literal notranslate"><span class="pre">lockstrings</span></code>. The lockstring is on a form <code class="docutils literal notranslate"><span class="pre"><situation>:<lockfuncs></span></code>, where <code class="docutils literal notranslate"><span class="pre">situation</span></code> determines when this lock applies and the <code class="docutils literal notranslate"><span class="pre">lockfuncs</span></code> (there can be more than one) are run to determine if the lock-check passes or not depending on circumstance.</p>
|
||||
</aside>
|
||||
<p>Let’s get a little ahead of ourselves and make it so you have to <em>hold</em> the sword for the <code class="docutils literal notranslate"><span class="pre">hit</span></code> command to be available. This involves a <a class="reference internal" href="../../../Components/Locks.html"><span class="doc std std-doc">Lock</span></a>. We’ve cover locks in more detail later, just know that they are useful for limiting the kind of things you can do with an object, including limiting just when you can call commands on it.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>> py self.search("sword").locks.add("call:holds()")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We added a new lock to the sword. The <em>lockstring</em> <code class="docutils literal notranslate"><span class="pre">"call:holds()"</span></code> means that you can only <em>call</em> commands on
|
||||
this object if you are <em>holding</em> the object (that is, it’s in your inventory).</p>
|
||||
<p>For locks to work, you cannot be <em>superuser</em>, since the superuser passes all locks. You need to <code class="docutils literal notranslate"><span class="pre">quell</span></code> yourself
|
||||
first:</p>
|
||||
<p>We added a new lock to the sword. The <em>lockstring</em> <code class="docutils literal notranslate"><span class="pre">"call:holds()"</span></code> means that you can only <em>call</em> commands on this object if you are <em>holding</em> the object (that is, it’s in your inventory).</p>
|
||||
<p>For locks to work, you cannot be <em>superuser</em>, since the superuser passes all locks. You need to <code class="docutils literal notranslate"><span class="pre">quell</span></code> yourself first:</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">quell/unquell</p>
|
||||
<p>Quelling allows you as a developer to take on the role of players with less priveleges. This is useful for testing and debugging, in particular since a superuser has a little <code class="docutils literal notranslate"><span class="pre">too</span></code> much power sometimes. Use <code class="docutils literal notranslate"><span class="pre">unquell</span></code> to get back to your normal self.</p>
|
||||
|
|
@ -347,8 +381,7 @@ Command 'hit' is not available. ..
|
|||
> Who do you want to hit?
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Finally, we get rid of ours sword so we have a clean slate with no more <code class="docutils literal notranslate"><span class="pre">hit</span></code> commands floating around.
|
||||
We can do that in two ways:</p>
|
||||
<p>Finally, we get rid of ours sword so we have a clean slate with no more <code class="docutils literal notranslate"><span class="pre">hit</span></code> commands floating around. We can do that in two ways:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>delete sword
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -360,17 +393,7 @@ We can do that in two ways:</p>
|
|||
</section>
|
||||
<section id="adding-the-command-to-a-default-cmdset">
|
||||
<h2><span class="section-number">9.3. </span>Adding the Command to a default Cmdset<a class="headerlink" href="#adding-the-command-to-a-default-cmdset" title="Permalink to this headline">¶</a></h2>
|
||||
<p>As we have seen we can use <code class="docutils literal notranslate"><span class="pre">obj.cmdset.add()</span></code> to add a new cmdset to objects, whether that object
|
||||
is ourself (<code class="docutils literal notranslate"><span class="pre">self</span></code>) or other objects like the <code class="docutils literal notranslate"><span class="pre">sword</span></code>.</p>
|
||||
<p>This is how all commands in Evennia work, including default commands like <code class="docutils literal notranslate"><span class="pre">look</span></code>, <code class="docutils literal notranslate"><span class="pre">dig</span></code>, <code class="docutils literal notranslate"><span class="pre">inventory</span></code> and so on.
|
||||
All these commands are in just loaded on the default objects that Evennia provides out of the box.</p>
|
||||
<ul class="simple">
|
||||
<li><p>Characters (that is ‘you’ in the gameworld) has the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code>.</p></li>
|
||||
<li><p>Accounts (the thing that represents your out-of-character existence on the server) has the <code class="docutils literal notranslate"><span class="pre">AccountCmdSet</span></code></p></li>
|
||||
<li><p>Sessions (representing one single client connection) has the <code class="docutils literal notranslate"><span class="pre">SessionCmdSet</span></code></p></li>
|
||||
<li><p>Before you log in (at the connection screen) you’ll have access to the <code class="docutils literal notranslate"><span class="pre">UnloggedinCmdSet</span></code>.</p></li>
|
||||
</ul>
|
||||
<p>The thing must commonly modified is the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code>.</p>
|
||||
<p>As we have seen we can use <code class="docutils literal notranslate"><span class="pre">obj.cmdset.add()</span></code> to add a new cmdset to objects, whether that object is ourself (<code class="docutils literal notranslate"><span class="pre">self</span></code>) or other objects like the <code class="docutils literal notranslate"><span class="pre">sword</span></code>. Doing this this way is a little cumbersome though. It would be better to add this to all characters.</p>
|
||||
<p>The default cmdset are defined in <code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>. Open that file now:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="sd">"""</span>
|
||||
<span class="sd">(module docstring)</span>
|
||||
|
|
@ -427,14 +450,15 @@ All these commands are in just loaded on the default objects that Evennia provid
|
|||
<p class="sidebar-title">super()</p>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">super()</span></code> function refers to the parent of the current class and is commonly used to call same-named methods on the parent.</p>
|
||||
</aside>
|
||||
<p><code class="docutils literal notranslate"><span class="pre">evennia.default_cmds</span></code> is a container that holds all of Evennia’s default commands and cmdsets. In this module
|
||||
we can see that this was imported and then a new child class was made for each cmdset. Each class looks familiar
|
||||
(except the <code class="docutils literal notranslate"><span class="pre">key</span></code>, that’s mainly used to easily identify the cmdset in listings). In each <code class="docutils literal notranslate"><span class="pre">at_cmdset_creation</span></code> all
|
||||
we do is call <code class="docutils literal notranslate"><span class="pre">super().at_cmdset_creation</span></code> which means that we call `at_cmdset_creation() on the <em>parent</em> CmdSet.
|
||||
<p><code class="docutils literal notranslate"><span class="pre">evennia.default_cmds</span></code> is a container that holds all of Evennia’s default commands and cmdsets. In this module we can see that this was imported and then a new child class was made for each cmdset. Each class looks familiar (except the <code class="docutils literal notranslate"><span class="pre">key</span></code>, that’s mainly used to easily identify the cmdset in listings). In each <code class="docutils literal notranslate"><span class="pre">at_cmdset_creation</span></code> all we do is call <code class="docutils literal notranslate"><span class="pre">super().at_cmdset_creation</span></code> which means that we call `at_cmdset_creation() on the <em>parent</em> CmdSet.
|
||||
This is what adds all the default commands to each CmdSet.</p>
|
||||
<p>To add even more Commands to a default cmdset, we can just add them below the <code class="docutils literal notranslate"><span class="pre">super()</span></code> line. Usefully, if we were to
|
||||
add a Command with the same <code class="docutils literal notranslate"><span class="pre">.key</span></code> as a default command, it would completely replace that original. So if you were
|
||||
to add a command with a key <code class="docutils literal notranslate"><span class="pre">look</span></code>, the original <code class="docutils literal notranslate"><span class="pre">look</span></code> command would be replaced by your own version.</p>
|
||||
<p>When the <code class="docutils literal notranslate"><span class="pre">DefaultCharacter</span></code> (or a child of it) is created, you’ll find that the equivalence of <code class="docutils literal notranslate"><span class="pre">self.cmdset.add("default_cmdsets.CharacterCmdSet,</span> <span class="pre">persistent=True")</span></code> gets called. This means that all new Characters get this cmdset. After adding more commands to it, you just need to reload to have all characters see it.</p>
|
||||
<ul class="simple">
|
||||
<li><p>Characters (that is ‘you’ in the gameworld) has the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code>.</p></li>
|
||||
<li><p>Accounts (the thing that represents your out-of-character existence on the server) has the <code class="docutils literal notranslate"><span class="pre">AccountCmdSet</span></code></p></li>
|
||||
<li><p>Sessions (representing one single client connection) has the <code class="docutils literal notranslate"><span class="pre">SessionCmdSet</span></code></p></li>
|
||||
<li><p>Before you log in (at the connection screen) your Session have access to the <code class="docutils literal notranslate"><span class="pre">UnloggedinCmdSet</span></code>.</p></li>
|
||||
</ul>
|
||||
<p>For now, let’s add our own <code class="docutils literal notranslate"><span class="pre">hit</span></code> and <code class="docutils literal notranslate"><span class="pre">echo</span></code> commands to the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># ...</span>
|
||||
|
||||
|
|
@ -460,8 +484,7 @@ to add a command with a key <code class="docutils literal notranslate"><span cla
|
|||
Who do you want to hit?
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Your new commands are now available for all player characters in the game. There is another way to add a bunch
|
||||
of commands at once, and that is to add a <em>CmdSet</em> to the other cmdset. All commands in that cmdset will then be added:</p>
|
||||
<p>Your new commands are now available for all player characters in the game. There is another way to add a bunch of commands at once, and that is to add your own <em>CmdSet</em> to the other cmdset.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">commands</span> <span class="kn">import</span> <span class="n">mycommands</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">CharacterCmdSet</span><span class="p">):</span>
|
||||
|
|
@ -485,7 +508,7 @@ this is practical. A Command can be a part of any number of different CmdSets.</
|
|||
<code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>. But what if you want to remove a default command?</p>
|
||||
<p>We already know that we use <code class="docutils literal notranslate"><span class="pre">cmdset.remove()</span></code> to remove a cmdset. It turns out you can
|
||||
do the same in <code class="docutils literal notranslate"><span class="pre">at_cmdset_creation</span></code>. For example, let’s remove the default <code class="docutils literal notranslate"><span class="pre">get</span></code> Command
|
||||
from Evennia. We happen to know this can be found as <code class="docutils literal notranslate"><span class="pre">default_cmds.CmdGet</span></code>.</p>
|
||||
from Evennia. If you investigate the <code class="docutils literal notranslate"><span class="pre">default_cmds.CharacterCmdSet</span></code> parent, you’ll find that its class is <code class="docutils literal notranslate"><span class="pre">default_cmds.CmdGet</span></code> (the ‘real’ location is <code class="docutils literal notranslate"><span class="pre">evennia.commands.default.general.CmdGet</span></code>).</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># ...</span>
|
||||
<span class="kn">from</span> <span class="nn">commands</span> <span class="kn">import</span> <span class="n">mycommands</span>
|
||||
|
||||
|
|
@ -515,23 +538,28 @@ Command 'get' is not available ...
|
|||
<h2><span class="section-number">9.4. </span>Replace a default command<a class="headerlink" href="#replace-a-default-command" title="Permalink to this headline">¶</a></h2>
|
||||
<p>At this point you already have all the pieces for how to do this! We just need to add a new
|
||||
command with the same <code class="docutils literal notranslate"><span class="pre">key</span></code> in the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code> to replace the default one.</p>
|
||||
<p>Let’s combine this with what we know about classes and
|
||||
how to <em>override</em> a parent class. Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/mycommands.py</span></code> and lets override
|
||||
that <code class="docutils literal notranslate"><span class="pre">CmdGet</span></code> command.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># up top, by the other imports</span>
|
||||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">default_cmds</span>
|
||||
|
||||
<p>Let’s combine this with what we know about classes and how to <em>override</em> a parent class. Open <code class="docutils literal notranslate"><span class="pre">mygame/commands/mycommands.py</span></code> and make a new <code class="docutils literal notranslate"><span class="pre">get</span></code> command:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
||||
<span class="normal">2</span>
|
||||
<span class="normal">3</span>
|
||||
<span class="normal">4</span>
|
||||
<span class="normal">5</span>
|
||||
<span class="normal">6</span>
|
||||
<span class="normal">7</span>
|
||||
<span class="normal">8</span>
|
||||
<span class="normal">9</span></pre></div></td><td class="code"><div><pre><span></span><span class="c1"># up top, by the other imports</span>
|
||||
<span class="hll"><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">default_cmds</span>
|
||||
</span>
|
||||
<span class="c1"># somewhere below</span>
|
||||
<span class="k">class</span> <span class="nc">MyCmdGet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">CmdGet</span><span class="p">):</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">location</span><span class="o">.</span><span class="n">contents</span><span class="p">))</span>
|
||||
|
||||
</pre></div>
|
||||
<span class="hll"> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
</span><span class="hll"> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
|
||||
</span><span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">location</span><span class="o">.</span><span class="n">contents</span><span class="p">))</span>
|
||||
</span></pre></div></td></tr></table></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><strong>Line2</strong>: We import <code class="docutils literal notranslate"><span class="pre">default_cmds</span></code> so we can get the parent class.
|
||||
<li><p><strong>Line 2</strong>: We import <code class="docutils literal notranslate"><span class="pre">default_cmds</span></code> so we can get the parent class.
|
||||
We made a new class and we make it <em>inherit</em> <code class="docutils literal notranslate"><span class="pre">default_cmds.CmdGet</span></code>. We don’t
|
||||
need to set <code class="docutils literal notranslate"><span class="pre">.key</span></code> or <code class="docutils literal notranslate"><span class="pre">.parse</span></code>, that’s already handled by the parent.
|
||||
In <code class="docutils literal notranslate"><span class="pre">func</span></code> we call <code class="docutils literal notranslate"><span class="pre">super().func()</span></code> to let the parent do its normal thing,</p></li>
|
||||
|
|
@ -565,6 +593,7 @@ has a special function <code class="docutils literal notranslate"><span class="p
|
|||
<span class="c1"># ...</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We don’t need to use <code class="docutils literal notranslate"><span class="pre">self.remove()</span></code> first; just adding a command with the same <code class="docutils literal notranslate"><span class="pre">key</span></code> (<code class="docutils literal notranslate"><span class="pre">get</span></code>) will replace the default <code class="docutils literal notranslate"><span class="pre">get</span></code> we had from before.</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Another way</p>
|
||||
<p>Instead of adding <code class="docutils literal notranslate"><span class="pre">MyCmdGet</span></code> explicitly in default_cmdset.py, you could also add it to <code class="docutils literal notranslate"><span class="pre">mycommands.MyCmdSet</span></code> and let it be added automatically here for you.</p>
|
||||
|
|
@ -575,14 +604,12 @@ Get What?
|
|||
[smaug, fluffy, YourName, ...]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We just made a new <code class="docutils literal notranslate"><span class="pre">get</span></code>-command that tells us everything we could pick up (well, we can’t pick up ourselves, so
|
||||
there’s some room for improvement there).</p>
|
||||
<p>We just made a new <code class="docutils literal notranslate"><span class="pre">get</span></code>-command that tells us everything we could pick up (well, we can’t pick up ourselves, so there’s some room for improvement there …).</p>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2><span class="section-number">9.5. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In this lesson we got into some more advanced string formatting - many of those tricks will help you a lot in
|
||||
the future! We also made a functional sword. Finally we got into how to add to, extend and replace a default
|
||||
command on ourselves.</p>
|
||||
<p>In this lesson we got into some more advanced string formatting - many of those tricks will help you a lot in the future! We also made a functional sword. Finally we got into how to add to, extend and replace a default command on ourselves. Knowing to add commands is a big part of making a game!</p>
|
||||
<p>We have been beating on poor Smaug for too long. Next we’ll create more things to play around with.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">Part 1: What we have</a><ul>
|
||||
<li><a class="reference internal" href="#lessons">Lessons</a></li>
|
||||
<li><a class="reference internal" href="#table-of-contents">Table of Contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -134,25 +133,6 @@ these concepts in the context of Evennia before.</p>
|
|||
<h2>Lessons<a class="headerlink" href="#lessons" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html">1. Using commands and building stuff</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Tutorial-World.html">2. The Tutorial World</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Python-basic-introduction.html">3. Intro to using Python with Evennia</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Gamedir-Overview.html">4. Overview of your new Game Dir</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Python-classes-and-objects.html">5. Introduction to Python classes and objects</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Evennia-Library-Overview.html">6. Overview of the Evennia library</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Learning-Typeclasses.html">7. Making objects persistent</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Adding-Commands.html">8. Adding custom commands</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-More-on-Commands.html">9. Parsing Command input</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html">10. Creating things</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Searching-Things.html">11. Searching for things</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html">12. Advanced searching - Django Database queries</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="table-of-contents">
|
||||
<h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html">1. Using commands and building stuff</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html#getting-help">1.1. Getting help</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Building-Quickstart.html#looking-around">1.2. Looking around</a></li>
|
||||
|
|
@ -226,7 +206,11 @@ these concepts in the context of Evennia before.</p>
|
|||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html">10. Creating things</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-objects">10.1. Creating Objects</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-accounts">10.2. Creating Accounts</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-rooms-characters-and-exits">10.2. Creating Rooms, Characters and Exits</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-accounts">10.3. Creating Accounts</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-channels">10.4. Creating Channels</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#creating-scripts">10.5. Creating Scripts</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Creating-Things.html#conclusion">10.6. Conclusion</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Searching-Things.html">11. Searching for things</a><ul>
|
||||
|
|
@ -239,14 +223,21 @@ these concepts in the context of Evennia before.</p>
|
|||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html">12. Advanced searching - Django Database queries</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#queryset-field-lookups">12.1. Queryset field lookups</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#get-that-werewolf">12.2. Get that werewolf …</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#complex-queries">12.3. Complex queries</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#lets-get-that-werewolf">12.2. Let’s get that werewolf …</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#queries-with-or-or-not">12.3. Queries with OR or NOT</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#annotations">12.4. Annotations</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#f-objects">12.5. F-objects</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#grouping-and-returning-only-certain-properties">12.6. Grouping and returning only certain properties</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Django-queries.html#conclusions">12.7. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Making-A-Sittable-Object.html">13. Building a chair you can sit on</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Making-A-Sittable-Object.html#make-us-not-able-to-move-while-resting">13.1. Make us not able to move while resting</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Making-A-Sittable-Object.html#making-the-chair-itself">13.2. Making the Chair itself</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Making-A-Sittable-Object.html#adding-commands">13.3. Adding commands</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Making-A-Sittable-Object.html#conclusions">13.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -126,30 +126,31 @@ if we cannot find and use it afterwards.</p>
|
|||
<section id="main-search-functions">
|
||||
<h2><span class="section-number">11.1. </span>Main search functions<a class="headerlink" href="#main-search-functions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The base tools are the <code class="docutils literal notranslate"><span class="pre">evennia.search_*</span></code> functions, such as <code class="docutils literal notranslate"><span class="pre">evennia.search_object</span></code>.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> rose = evennia.search_object(key="rose")
|
||||
acct = evennia.search_account(key="MyAccountName", email="foo@bar.com")
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">evennia</span>
|
||||
|
||||
<span class="n">roses</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">search_object</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">"rose"</span><span class="p">)</span>
|
||||
<span class="n">accts</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">search_account</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">"MyAccountName"</span><span class="p">,</span> <span class="n">email</span><span class="o">=</span><span class="s2">"foo@bar.com"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Querysets</p>
|
||||
<p>What is returned from the main search functions is actually a <code class="docutils literal notranslate"><span class="pre">queryset</span></code>. They can be treated like lists except that they can’t modified in-place. We’ll discuss querysets in the <code class="docutils literal notranslate"><span class="pre">next</span> <span class="pre">lesson</span></code> <Django-queries>`_.</p>
|
||||
</aside>
|
||||
<p>Strings are always case-insensitive, so searching for <code class="docutils literal notranslate"><span class="pre">"rose"</span></code>, <code class="docutils literal notranslate"><span class="pre">"Rose"</span></code> or <code class="docutils literal notranslate"><span class="pre">"rOsE"</span></code> give the same results.
|
||||
It’s important to remember that what is returned from these search methods is a <em>listing</em> of 0, one or more
|
||||
elements - all the matches to your search. To get the first match:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rose = rose[0]
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
|
||||
```{sidebar} Querysets
|
||||
|
||||
What is returned from the main search functions is actually a `queryset`. They can be treated like lists except that they can't modified in-place. We'll discuss querysets in the `next lesson` <Django-queries>`_.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Often you really want all matches to the search parameters you specify. In other situations, having zero or
|
||||
more than one match is a sign of a problem and you need to handle this case yourself.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>the_one_ring = evennia.search_object(key="The one Ring")
|
||||
if not the_one_ring:
|
||||
# handle not finding the ring at all
|
||||
elif len(the_one_ring) > 1:
|
||||
# handle finding more than one ring
|
||||
else:
|
||||
# ok - exactly one ring found
|
||||
the_one_ring = the_one_ring[0]
|
||||
<p>Strings are always case-insensitive, so searching for <code class="docutils literal notranslate"><span class="pre">"rose"</span></code>, <code class="docutils literal notranslate"><span class="pre">"Rose"</span></code> or <code class="docutils literal notranslate"><span class="pre">"rOsE"</span></code> give the same results. It’s important to remember that what is returned from these search methods is a <em>listing</em> of zero, one or more elements - all the matches to your search. To get the first match:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rose = roses[0]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Often you really want all matches to the search parameters you specify. In other situations, having zero or more than one match is a sign of a problem and you need to handle this case yourself.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="n">the_one_ring</span> <span class="o">=</span> <span class="n">evennia</span><span class="o">.</span><span class="n">search_object</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">"The one Ring"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">the_one_ring</span><span class="p">:</span>
|
||||
<span class="c1"># handle not finding the ring at all</span>
|
||||
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">the_one_ring</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span>
|
||||
<span class="c1"># handle finding more than one ring</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="c1"># ok - exactly one ring found</span>
|
||||
<span class="n">the_one_ring</span> <span class="o">=</span> <span class="n">the_one_ring</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>There are equivalent search functions for all the main resources. You can find a listing of them
|
||||
|
|
@ -157,46 +158,54 @@ else:
|
|||
</section>
|
||||
<section id="searching-using-object-search">
|
||||
<h2><span class="section-number">11.2. </span>Searching using Object.search<a class="headerlink" href="#searching-using-object-search" title="Permalink to this headline">¶</a></h2>
|
||||
<p>On the <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code> is a <code class="docutils literal notranslate"><span class="pre">.search</span></code> method which we have already tried out when we made Commands. For
|
||||
this to be used you must already have an object available:</p>
|
||||
<p>On the <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code> is a <code class="docutils literal notranslate"><span class="pre">.search</span></code> method which we have already tried out when we made Commands. For this to be used you must already have an object available:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rose = obj.search("rose")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">.search</span></code> method wraps <code class="docutils literal notranslate"><span class="pre">evennia.search_object</span></code> and handles its output in various ways.</p>
|
||||
<p>This searches for objects based on <code class="docutils literal notranslate"><span class="pre">key</span></code> or aliases. The <code class="docutils literal notranslate"><span class="pre">.search</span></code> method wraps <code class="docutils literal notranslate"><span class="pre">evennia.search_object</span></code> and handles its output in various ways.</p>
|
||||
<ul class="simple">
|
||||
<li><p>By default it will always search for objects among those in <code class="docutils literal notranslate"><span class="pre">obj.location.contents</span></code> and <code class="docutils literal notranslate"><span class="pre">obj.contents</span></code> (that is,
|
||||
things in obj’s inventory or in the same room).</p></li>
|
||||
<li><p>By default it will always search for objects among those in <code class="docutils literal notranslate"><span class="pre">obj.location.contents</span></code> and <code class="docutils literal notranslate"><span class="pre">obj.contents</span></code> (that is, things in obj’s inventory or in the same room).</p></li>
|
||||
<li><p>It will always return exactly one match. If it found zero or more than one match, the return is <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p></li>
|
||||
<li><p>On a no-match or multimatch, <code class="docutils literal notranslate"><span class="pre">.search</span></code> will automatically send an error message to <code class="docutils literal notranslate"><span class="pre">obj</span></code>.</p></li>
|
||||
</ul>
|
||||
<p>So this method handles error messaging for you. A very common way to use it is in commands:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">Command</span>
|
||||
|
||||
<span class="k">class</span> <span class="nc">MyCommand</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="k">class</span> <span class="nc">CmdQuickFind</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||||
<span class="sd">""" </span>
|
||||
<span class="sd"> Find an item in your current location.</span>
|
||||
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"findfoo"</span>
|
||||
<span class="sd"> Usage: </span>
|
||||
<span class="sd"> quickfind <query></span>
|
||||
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"quickfind"</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
|
||||
<span class="n">foo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">foo</span><span class="p">:</span>
|
||||
<span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span>
|
||||
<span class="n">result</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">result</span>
|
||||
<span class="k">return</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">caller</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Found match for </span><span class="si">{</span><span class="n">query</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">foo</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Remember, <code class="docutils literal notranslate"><span class="pre">self.caller</span></code> is the one calling the command. This is usually a Character, which
|
||||
inherits from <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>! This (rather stupid) Command searches for an object named “foo” in
|
||||
the same location. If it can’t find it, <code class="docutils literal notranslate"><span class="pre">foo</span></code> will be <code class="docutils literal notranslate"><span class="pre">None</span></code>. The error has already been reported
|
||||
to <code class="docutils literal notranslate"><span class="pre">self.caller</span></code> so we just abort with <code class="docutils literal notranslate"><span class="pre">return</span></code>.</p>
|
||||
inherits from <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code>!</p>
|
||||
<p>This simple little Command takes its arguments and searches for a match. If it can’t find it, <code class="docutils literal notranslate"><span class="pre">result</span></code> will be <code class="docutils literal notranslate"><span class="pre">None</span></code>. The error has already been reported to <code class="docutils literal notranslate"><span class="pre">self.caller</span></code> so we just abort with <code class="docutils literal notranslate"><span class="pre">return</span></code>.</p>
|
||||
<p>You can use <code class="docutils literal notranslate"><span class="pre">.search</span></code> to find anything, not just stuff in the same room:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>volcano = self.caller.search("Volcano", global=True)
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>volcano = self.caller.search("Vesuvio", global=True)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can limit your matches to particular typeclasses:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>water_glass = self.caller.search("glass", typeclass="typeclasses.objects.WaterGlass")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>If you only want to search for a specific list of things, you can do so too:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>stone = self.caller.search("MyStone", candidates=[obj1, obj2, obj3, obj4])
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This will only return a match if MyStone is one of the four provided candidate objects. This is quite powerful,
|
||||
here’s how you’d find something only in your inventory:</p>
|
||||
<p>This will only return a match if “MyStone” is in the room (or in your inventory) <em>and</em> is one of the four provided candidate objects. This is quite powerful, here’s how you’d find something only in your inventory:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>potion = self.caller.search("Healing potion", candidates=self.caller.contents)
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -204,8 +213,7 @@ here’s how you’d find something only in your inventory:</p>
|
|||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>swords = self.caller.search("Sword", quiet=True)
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>With <code class="docutils literal notranslate"><span class="pre">quiet=True</span></code> the user will not be notified on zero or multi-match errors. Instead you are expected to handle this
|
||||
yourself and what you get back is now a list of zero, one or more matches!</p>
|
||||
<p>With <code class="docutils literal notranslate"><span class="pre">quiet=True</span></code> the user will not be notified on zero or multi-match errors. Instead you are expected to handle this yourself. Furthermore, what is returned is now a list of zero, one or more matches!</p>
|
||||
</section>
|
||||
<section id="what-can-be-searched-for">
|
||||
<h2><span class="section-number">11.3. </span>What can be searched for<a class="headerlink" href="#what-can-be-searched-for" title="Permalink to this headline">¶</a></h2>
|
||||
|
|
@ -214,9 +222,9 @@ yourself and what you get back is now a list of zero, one or more matches!</p>
|
|||
<li><p><a class="reference internal" href="../../../Components/Objects.html"><span class="doc std std-doc">Objects</span></a></p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Accounts.html"><span class="doc std std-doc">Accounts</span></a></p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Scripts.html"><span class="doc std std-doc">Scripts</span></a>,</p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Channels.html"><span class="doc std std-doc">Channels</span></a>,</p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Msg.html"><span class="doc std std-doc">Messages</span></a></p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Help-System.html"><span class="doc std std-doc">Help Entries</span></a>.</p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Channels.html"><span class="doc std std-doc">Channels</span></a></p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Msg.html"><span class="doc std std-doc">Messages</span></a> (used by <code class="docutils literal notranslate"><span class="pre">page</span></code> command by default)</p></li>
|
||||
<li><p><a class="reference internal" href="../../../Components/Help-System.html"><span class="doc std std-doc">Help Entries</span></a> (help entries created manually)</p></li>
|
||||
</ul>
|
||||
<p>Most of the time you’ll likely spend your time searching for Objects and the occasional Accounts.</p>
|
||||
<p>So to find an entity, what can be searched for?</p>
|
||||
|
|
@ -226,8 +234,7 @@ yourself and what you get back is now a list of zero, one or more matches!</p>
|
|||
</section>
|
||||
<section id="search-by-aliases">
|
||||
<h3><span class="section-number">11.3.2. </span>Search by aliases<a class="headerlink" href="#search-by-aliases" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Objects and Accounts can have any number of aliases. When searching for <code class="docutils literal notranslate"><span class="pre">key</span></code> these will searched too,
|
||||
you can’t easily search only for aliases.</p>
|
||||
<p>Objects and Accounts can have any number of aliases. When searching for <code class="docutils literal notranslate"><span class="pre">key</span></code> these will searched too, you can’t easily search only for aliases.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rose.aliases.add("flower")
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -236,26 +243,26 @@ you can assign new aliases to things with the <code class="docutils literal notr
|
|||
</section>
|
||||
<section id="search-by-location">
|
||||
<h3><span class="section-number">11.3.3. </span>Search by location<a class="headerlink" href="#search-by-location" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Only Objects (things inheriting from <code class="docutils literal notranslate"><span class="pre">evennia.DefaultObject</span></code>) has a location. This is usually a room.
|
||||
The <code class="docutils literal notranslate"><span class="pre">Object.search</span></code> method will automatically limit it search by location, but it also works for the
|
||||
general search function. If we assume <code class="docutils literal notranslate"><span class="pre">room</span></code> is a particular Room instance,</p>
|
||||
<p>Only Objects (things inheriting from <code class="docutils literal notranslate"><span class="pre">evennia.DefaultObject</span></code>) has a location. The location is usually a room. The <code class="docutils literal notranslate"><span class="pre">Object.search</span></code> method will automatically limit it search by location, but it also works for the general search function. If we assume <code class="docutils literal notranslate"><span class="pre">room</span></code> is a particular Room instance,</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>chest = evennia.search_object("Treasure chest", location=room)
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="search-by-tags">
|
||||
<h3><span class="section-number">11.3.4. </span>Search by Tags<a class="headerlink" href="#search-by-tags" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Think of a <a class="reference internal" href="../../../Components/Tags.html"><span class="doc std std-doc">Tag</span></a> as the label the airport puts on your luggage when flying.
|
||||
Everyone going on the same plane gets a tag grouping them together so the airport can know what should
|
||||
go to which plane. Entities in Evennia can be grouped in the same way. Any number of tags can be attached
|
||||
<p>Think of a <a class="reference internal" href="../../../Components/Tags.html"><span class="doc std std-doc">Tag</span></a> as the label the airport puts on your luggage when flying. Everyone going on the same plane gets a tag grouping them together so the airport can know what should go to which plane. Entities in Evennia can be grouped in the same way. Any number of tags can be attached
|
||||
to each object.</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>rose.tags.add("flowers")
|
||||
rose.tags.add("thorny")
|
||||
daffodil.tags.add("flowers")
|
||||
tulip.tags.add("flowers")
|
||||
cactus.tags.add("flowers")
|
||||
cactus.tags.add("thorny")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>You can now find all flowers using the <code class="docutils literal notranslate"><span class="pre">search_tag</span></code> function:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>all_flowers = evennia.search_tag("flowers")
|
||||
roses_and_cactii = evennia.search_tag("thorny")
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Tags can also have categories. By default this category is <code class="docutils literal notranslate"><span class="pre">None</span></code> which is also considered a category.</p>
|
||||
|
|
@ -310,13 +317,15 @@ by-tag is generally faster.</p>
|
|||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>all_roses = Rose.objects.all()
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This last way of searching is a simple form of a Django <em>query</em>. This is a way to express SQL queries using
|
||||
Python.</p>
|
||||
<p>This last way of searching is a simple form of a Django <em>query</em>. This is a way to express SQL queries using Python. See <a class="reference internal" href="Beginner-Tutorial-Django-queries.html"><span class="doc std std-doc">the next lesson</span></a>, where we’ll explore this way to searching in more detail.</p>
|
||||
</section>
|
||||
<section id="search-by-dbref">
|
||||
<h3><span class="section-number">11.3.7. </span>Search by dbref<a class="headerlink" href="#search-by-dbref" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The database id or <code class="docutils literal notranslate"><span class="pre">#dbref</span></code> is unique and never-reused within each database table. In search methods you can
|
||||
replace the search for <code class="docutils literal notranslate"><span class="pre">key</span></code> with the dbref to search for. This must be written as a string <code class="docutils literal notranslate"><span class="pre">#dbref</span></code>:</p>
|
||||
<aside class="sidebar">
|
||||
<p class="sidebar-title">Will I run out of dbrefs?</p>
|
||||
<p>Since dbrefs are not reused, do you need to worry about your database ids ‘running out’ in the future? <a class="reference internal" href="../../../Components/Typeclasses.html#will-i-run-out-of-dbrefs"><span class="std std-doc">No, and here’s why</span></a>.</p>
|
||||
</aside>
|
||||
<p>The database id or <code class="docutils literal notranslate"><span class="pre">#dbref</span></code> is unique and never-reused within each database table. In search methods you can replace the search for <code class="docutils literal notranslate"><span class="pre">key</span></code> with the dbref to search for. This must be written as a string <code class="docutils literal notranslate"><span class="pre">#dbref</span></code>:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>the_answer = self.caller.search("#42")
|
||||
eightball = evennia.search_object("#8")
|
||||
</pre></div>
|
||||
|
|
@ -325,19 +334,27 @@ eightball = evennia.search_object("#8")
|
|||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>Relying on #dbrefs</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>You may be used to using #dbrefs a lot from other codebases. It is however considered
|
||||
`bad practice` in Evennia to rely on hard-coded #dbrefs. It makes your code hard to maintain
|
||||
and tied to the exact layout of the database. In 99% of cases you should pass the actual objects
|
||||
around and search by key/tags/attribute instead.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>In legacy code bases you may be used to relying a lot on #dbrefs to find and track things. Looking something up by #dbref can be practical - if used occationally. It is however considered <strong>bad practice</strong> to <em>rely</em> on hard-coded #dbrefs in Evennia. Especially to expect end users to know them. It makes your code fragile and hard to maintain, while tying your code to the exact layout of the database. In 99% of use cases you should organize your code such that you pass the actual objects around and search by key/tags/attribute instead.</p>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<section id="finding-objects-relative-each-other">
|
||||
<h2><span class="section-number">11.4. </span>Finding objects relative each other<a class="headerlink" href="#finding-objects-relative-each-other" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Let’s consider a <code class="docutils literal notranslate"><span class="pre">chest</span></code> with a <code class="docutils literal notranslate"><span class="pre">coin</span></code> inside it. The chests stand in a room <code class="docutils literal notranslate"><span class="pre">dungeon</span></code>. In the dungeon is also
|
||||
a <code class="docutils literal notranslate"><span class="pre">door</span></code>. This is an exit leading outside.</p>
|
||||
<p>It’s important to understand how objects relate to one another when searching.
|
||||
Let’s consider a <code class="docutils literal notranslate"><span class="pre">chest</span></code> with a <code class="docutils literal notranslate"><span class="pre">coin</span></code> inside it. The chests stand in a room <code class="docutils literal notranslate"><span class="pre">dungeon</span></code>. In the dungeon is also a <code class="docutils literal notranslate"><span class="pre">door</span></code>. This is an exit leading outside.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>┌───────────────────────┐
|
||||
│dungeon │
|
||||
│ ┌─────────┐ │
|
||||
│ │chest │ ┌────┐ │
|
||||
│ │ ┌────┐ │ │door│ │
|
||||
│ │ │coin│ │ └────┘ │
|
||||
│ │ └────┘ │ │
|
||||
│ │ │ │
|
||||
│ └─────────┘ │
|
||||
│ │
|
||||
└───────────────────────┘
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">coin.location</span></code> is <code class="docutils literal notranslate"><span class="pre">chest</span></code>.</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">chest.location</span></code> is <code class="docutils literal notranslate"><span class="pre">dungeon</span></code>.</p></li>
|
||||
|
|
@ -366,13 +383,22 @@ We can also find what is inside each object. This is a list of things.</p>
|
|||
<li><p><code class="docutils literal notranslate"><span class="pre">door.destination</span></code> is <code class="docutils literal notranslate"><span class="pre">outside</span></code> (or wherever the door leads)</p></li>
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">room.destination</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code> (same for all the other non-exit objects)</p></li>
|
||||
</ul>
|
||||
<p>You can also include this information in searches:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">search_object</span>
|
||||
|
||||
<span class="c1"># we assume only one match of each </span>
|
||||
<span class="n">dungeons</span> <span class="o">=</span> <span class="n">search_object</span><span class="p">(</span><span class="s2">"dungeon"</span><span class="p">,</span> <span class="n">typeclass</span><span class="o">=</span><span class="s2">"typeclasses.rooms.Room"</span><span class="p">)</span>
|
||||
<span class="n">chests</span> <span class="o">=</span> <span class="n">search_object</span><span class="p">(</span><span class="s2">"chest"</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="n">dungeons</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||
<span class="c1"># find if there are any skulls in the chest </span>
|
||||
<span class="n">skulls</span> <span class="o">=</span> <span class="n">search_object</span><span class="p">(</span><span class="s2">"Skull"</span><span class="p">,</span> <span class="n">candidates</span><span class="o">=</span><span class="n">chests</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">contents</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>More advanced, nested queries like this can however often be made more efficient by using the hints in the next lesson.</p>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2><span class="section-number">11.5. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Knowing how to find things is important and the tools from this section will serve you well. For most of your needs
|
||||
these tools will be all you need …</p>
|
||||
<p>… but not always. In the next lesson we will dive further into more complex searching when we look at
|
||||
Django queries and querysets in earnest.</p>
|
||||
<p>Knowing how to find things is important and the tools from this section will serve you well. These tools will cover most of your needs …</p>
|
||||
<p>… but not always. In the next lesson we will dive further into more complex searching when we look at Django queries and querysets in earnest.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>On Planning a Game — Evennia 1.0-dev documentation</title>
|
||||
<title>2. On Planning a Game — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Planning our tutorial game" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" />
|
||||
<link rel="prev" title="Where do I begin?" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" />
|
||||
<link rel="next" title="3. Planning our tutorial game" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" />
|
||||
<link rel="prev" title="1. Where do I begin?" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
|
||||
<a href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="3. Planning our tutorial game"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="Where do I begin?"
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="1. Where do I begin?"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" accesskey="U">Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">On Planning a Game</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>On Planning a Game</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,33 +64,33 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">On Planning a Game</a><ul>
|
||||
<li><a class="reference internal" href="#the-steps">The steps</a></li>
|
||||
<li><a class="reference internal" href="#planning">Planning</a><ul>
|
||||
<li><a class="reference internal" href="#administration">Administration</a></li>
|
||||
<li><a class="reference internal" href="#building">Building</a></li>
|
||||
<li><a class="reference internal" href="#systems">Systems</a></li>
|
||||
<li><a class="reference internal" href="#rooms">Rooms</a></li>
|
||||
<li><a class="reference internal" href="#objects-items">Objects / items</a></li>
|
||||
<li><a class="reference internal" href="#characters">Characters</a></li>
|
||||
<li><a class="reference internal" href="#">2. On Planning a Game</a><ul>
|
||||
<li><a class="reference internal" href="#the-steps">2.1. The steps</a></li>
|
||||
<li><a class="reference internal" href="#planning">2.2. Planning</a><ul>
|
||||
<li><a class="reference internal" href="#administration">2.2.1. Administration</a></li>
|
||||
<li><a class="reference internal" href="#building">2.2.2. Building</a></li>
|
||||
<li><a class="reference internal" href="#systems">2.2.3. Systems</a></li>
|
||||
<li><a class="reference internal" href="#rooms">2.2.4. Rooms</a></li>
|
||||
<li><a class="reference internal" href="#objects-items">2.2.5. Objects / items</a></li>
|
||||
<li><a class="reference internal" href="#characters">2.2.6. Characters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#coding-and-tech-demo">Coding and Tech demo</a></li>
|
||||
<li><a class="reference internal" href="#world-building">World Building</a></li>
|
||||
<li><a class="reference internal" href="#alpha-release">Alpha Release</a></li>
|
||||
<li><a class="reference internal" href="#beta-release-perpetual-beta">Beta Release/Perpetual Beta</a></li>
|
||||
<li><a class="reference internal" href="#congratulate-yourself">Congratulate yourself!</a></li>
|
||||
<li><a class="reference internal" href="#planning-our-tutorial-game">Planning our tutorial game</a></li>
|
||||
<li><a class="reference internal" href="#coding-and-tech-demo">2.3. Coding and Tech demo</a></li>
|
||||
<li><a class="reference internal" href="#world-building">2.4. World Building</a></li>
|
||||
<li><a class="reference internal" href="#alpha-release">2.5. Alpha Release</a></li>
|
||||
<li><a class="reference internal" href="#beta-release-perpetual-beta">2.6. Beta Release/Perpetual Beta</a></li>
|
||||
<li><a class="reference internal" href="#congratulate-yourself">2.7. Congratulate yourself!</a></li>
|
||||
<li><a class="reference internal" href="#planning-our-tutorial-game">2.8. Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html"
|
||||
title="previous chapter">Where do I begin?</a></p>
|
||||
title="previous chapter"><span class="section-number">1. </span>Where do I begin?</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Planning-The-Tutorial-Game.html"
|
||||
title="next chapter">Planning our tutorial game</a></p>
|
||||
title="next chapter"><span class="section-number">3. </span>Planning our tutorial game</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="on-planning-a-game">
|
||||
<h1>On Planning a Game<a class="headerlink" href="#on-planning-a-game" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">2. </span>On Planning a Game<a class="headerlink" href="#on-planning-a-game" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Last lesson we asked ourselves some questions about our motivation. In this one we’ll present
|
||||
some more technical questions to consider. In the next lesson we’ll answer them for the sake of
|
||||
our tutorial game.</p>
|
||||
|
|
@ -143,7 +143,7 @@ later than to code in isolation until you burn out, lose interest or your hard d
|
|||
<li><p>Keep having <em>fun</em>. You must keep your motivation up, whichever way works for <em>you</em>.</p></li>
|
||||
</ul>
|
||||
<section id="the-steps">
|
||||
<h2>The steps<a class="headerlink" href="#the-steps" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.1. </span>The steps<a class="headerlink" href="#the-steps" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Here are the rough steps towards your goal.</p>
|
||||
<ol class="simple">
|
||||
<li><p>Planning</p></li>
|
||||
|
|
@ -154,7 +154,7 @@ later than to code in isolation until you burn out, lose interest or your hard d
|
|||
</ol>
|
||||
</section>
|
||||
<section id="planning">
|
||||
<h2>Planning<a class="headerlink" href="#planning" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.2. </span>Planning<a class="headerlink" href="#planning" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You need to have at least a rough idea about what you want to create. Some like a lot of planning, others
|
||||
do it more seat-of-the-pants style. Regardless, while <em>some</em> planning is always good to do, it’s common
|
||||
to have your plans change on you as you create your code prototypes. So don’t get <em>too</em> bogged down in
|
||||
|
|
@ -166,7 +166,7 @@ Evennia.</p>
|
|||
<p>Below are some questions to get you going. In the next lesson we will try to answer them for our particular
|
||||
tutorial game. There are of course many more questions you could be asking yourself.</p>
|
||||
<section id="administration">
|
||||
<h3>Administration<a class="headerlink" href="#administration" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.1. </span>Administration<a class="headerlink" href="#administration" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>Should your game rules be enforced by coded systems or by human game masters?</p></li>
|
||||
<li><p>What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</p></li>
|
||||
|
|
@ -174,7 +174,7 @@ tutorial game. There are of course many more questions you could be asking yours
|
|||
</ul>
|
||||
</section>
|
||||
<section id="building">
|
||||
<h3>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.2. </span>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>How will the world be built? Traditionally (from in-game with build-commands) or externally (by batchcmds/code
|
||||
or directly with custom code)?</p></li>
|
||||
|
|
@ -182,7 +182,7 @@ or directly with custom code)?</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="systems">
|
||||
<h3>Systems<a class="headerlink" href="#systems" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.3. </span>Systems<a class="headerlink" href="#systems" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>Do you base your game off an existing RPG system or make up your own?</p></li>
|
||||
<li><p>What are the game mechanics? How do you decide if an action succeeds or fails?</p></li>
|
||||
|
|
@ -194,7 +194,7 @@ or directly with custom code)?</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="rooms">
|
||||
<h3>Rooms<a class="headerlink" href="#rooms" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.4. </span>Rooms<a class="headerlink" href="#rooms" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>Is a simple room description enough or should the description be able to change (such as with time, by
|
||||
light conditions, weather or season)?</p></li>
|
||||
|
|
@ -205,7 +205,7 @@ these things something admins/game masters should handle manually?</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="objects-items">
|
||||
<h3>Objects / items<a class="headerlink" href="#objects-items" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.5. </span>Objects / items<a class="headerlink" href="#objects-items" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>How numerous are your objects? Do you want large loot-lists or are objects just role playing props
|
||||
created on demand?</p></li>
|
||||
|
|
@ -221,7 +221,7 @@ created on demand?</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="characters">
|
||||
<h3>Characters<a class="headerlink" href="#characters" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.2.6. </span>Characters<a class="headerlink" href="#characters" title="Permalink to this headline">¶</a></h3>
|
||||
<ul class="simple">
|
||||
<li><p>Can players have more than one Character active at a time or are they allowed to multi-play?</p></li>
|
||||
<li><p>How does the character-generation work? Walk from room-to-room? A menu?</p></li>
|
||||
|
|
@ -240,7 +240,7 @@ release. Make a list. Keep future expansions in mind but limit yourself.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="coding-and-tech-demo">
|
||||
<h2>Coding and Tech demo<a class="headerlink" href="#coding-and-tech-demo" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.3. </span>Coding and Tech demo<a class="headerlink" href="#coding-and-tech-demo" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This is the actual work of creating the “game” part of your game. As you code and test systems you should
|
||||
build a little “tech demo” along the way.</p>
|
||||
<aside class="sidebar">
|
||||
|
|
@ -268,7 +268,7 @@ your work is backed up at all times. The page on <a class="reference internal" h
|
|||
will help you to setting up a sane developer environment with proper version control.</p>
|
||||
</section>
|
||||
<section id="world-building">
|
||||
<h2>World Building<a class="headerlink" href="#world-building" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.4. </span>World Building<a class="headerlink" href="#world-building" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Up until this point we’ve only had a few tech-demo objects in the database. This step is the act of
|
||||
populating the database with a larger, thematic world. Too many would-be developers jump to this
|
||||
stage too soon (skipping the <strong>Coding</strong> or even <strong>Planning</strong> stages). What if the rooms you build
|
||||
|
|
@ -289,7 +289,7 @@ get a chance to hear if some things are hard to understand or non-intuitive. Ma
|
|||
to this feedback.</p>
|
||||
</section>
|
||||
<section id="alpha-release">
|
||||
<h2>Alpha Release<a class="headerlink" href="#alpha-release" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.5. </span>Alpha Release<a class="headerlink" href="#alpha-release" title="Permalink to this headline">¶</a></h2>
|
||||
<p>As mentioned, don’t hold onto your world more than necessary. <em>Get it out there</em> with a huge <em>Alpha</em>
|
||||
flag and let people try it!</p>
|
||||
<p>Call upon your alpha-players to try everything - they <em>will</em> find ways to break your game in ways that
|
||||
|
|
@ -303,7 +303,7 @@ game visible online.</p>
|
|||
pre-alpha games are allowed in the index so don’t be shy)!</p>
|
||||
</section>
|
||||
<section id="beta-release-perpetual-beta">
|
||||
<h2>Beta Release/Perpetual Beta<a class="headerlink" href="#beta-release-perpetual-beta" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.6. </span>Beta Release/Perpetual Beta<a class="headerlink" href="#beta-release-perpetual-beta" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Once things stabilize in Alpha you can move to <em>Beta</em> and let more people in. Many MUDs are in
|
||||
<a class="reference external" href="https://en.wikipedia.org/wiki/Perpetual_beta">perpetual beta</a>, meaning they are never considered
|
||||
“finished”, but just repeat the cycle of Planning, Coding, Testing and Building over and over as new
|
||||
|
|
@ -311,12 +311,12 @@ features get implemented or Players come with suggestions. As the game designer
|
|||
to gradually perfect your vision.</p>
|
||||
</section>
|
||||
<section id="congratulate-yourself">
|
||||
<h2>Congratulate yourself!<a class="headerlink" href="#congratulate-yourself" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.7. </span>Congratulate yourself!<a class="headerlink" href="#congratulate-yourself" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You are worthy of a celebration since at this point you have joined the small, exclusive crowd who
|
||||
have made their dream game a reality!</p>
|
||||
</section>
|
||||
<section id="planning-our-tutorial-game">
|
||||
<h2>Planning our tutorial game<a class="headerlink" href="#planning-our-tutorial-game" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.8. </span>Planning our tutorial game<a class="headerlink" href="#planning-our-tutorial-game" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In the next lesson we’ll make use of these general points and try to plan out our tutorial game.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -337,16 +337,16 @@ have made their dream game a reality!</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
|
||||
<a href="Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="3. Planning our tutorial game"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="Where do I begin?"
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="1. Where do I begin?"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" >Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">On Planning a Game</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>On Planning a Game</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Where do I begin?" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" />
|
||||
<link rel="prev" title="12. Advanced searching - Django Database queries" href="../Part1/Beginner-Tutorial-Django-queries.html" />
|
||||
<link rel="next" title="1. Where do I begin?" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" />
|
||||
<link rel="prev" title="13. Building a chair you can sit on" href="../Part1/Beginner-Tutorial-Making-A-Sittable-Object.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,10 +30,10 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="Where do I begin?"
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="1. Where do I begin?"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part1/Beginner-Tutorial-Django-queries.html" title="12. Advanced searching - Django Database queries"
|
||||
<a href="../Part1/Beginner-Tutorial-Making-A-Sittable-Object.html" title="13. Building a chair you can sit on"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
@ -65,17 +65,16 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">Part 2: What we want</a><ul>
|
||||
<li><a class="reference internal" href="#lessons">Lessons</a></li>
|
||||
<li><a class="reference internal" href="#table-of-contents">Table of Contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../Part1/Beginner-Tutorial-Django-queries.html"
|
||||
title="previous chapter"><span class="section-number">12. </span>Advanced searching - Django Database queries</a></p>
|
||||
<p class="topless"><a href="../Part1/Beginner-Tutorial-Making-A-Sittable-Object.html"
|
||||
title="previous chapter"><span class="section-number">13. </span>Building a chair you can sit on</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html"
|
||||
title="next chapter">Where do I begin?</a></p>
|
||||
title="next chapter"><span class="section-number">1. </span>Where do I begin?</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -133,99 +132,33 @@ and “what to think about” when creating a multiplayer online text game.</p>
|
|||
<h2>Lessons<a class="headerlink" href="#lessons" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html">Where do I begin?</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html">On Planning a Game</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html">Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="table-of-contents">
|
||||
<h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html">Where do I begin?</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-is-your-motivation-for-doing-this">What is your motivation for doing this?</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-are-your-skills">What are your skills?</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#the-game-engine">The game engine</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#asset-creation">Asset creation</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html">1. Where do I begin?</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-is-your-motivation-for-doing-this">1.1. What is your motivation for doing this?</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#what-are-your-skills">1.2. What are your skills?</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#so-where-do-i-begin-then">1.3. So, where do I begin, then?</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#conclusions">1.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#so-where-do-i-begin-then">So, where do I begin, then?</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html#conclusions">Conclusions</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html">2. On Planning a Game</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#the-steps">2.1. The steps</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#planning">2.2. Planning</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#coding-and-tech-demo">2.3. Coding and Tech demo</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#world-building">2.4. World Building</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#alpha-release">2.5. Alpha Release</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#beta-release-perpetual-beta">2.6. Beta Release/Perpetual Beta</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#congratulate-yourself">2.7. Congratulate yourself!</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#planning-our-tutorial-game">2.8. Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html">On Planning a Game</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#the-steps">The steps</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#planning">Planning</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#administration">Administration</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#building">Building</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#systems">Systems</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#rooms">Rooms</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#objects-items">Objects / items</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#characters">Characters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#coding-and-tech-demo">Coding and Tech demo</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#world-building">World Building</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#alpha-release">Alpha Release</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#beta-release-perpetual-beta">Beta Release/Perpetual Beta</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#congratulate-yourself">Congratulate yourself!</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Game-Planning.html#planning-our-tutorial-game">Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html">Planning our tutorial game</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#game-concept">Game concept</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#administration">Administration</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#building">Building</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-will-the-world-be-built">How will the world be built?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#systems">Systems</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-you-have-concepts-like-reputation-and-influence">Do you have concepts like reputation and influence?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#rooms">Rooms</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-the-room-have-different-statuses">Should the room have different statuses?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#objects">Objects</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-objects-be-broken-can-they-be-repaired">Can objects be broken? Can they be repaired?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#will-characters-be-able-to-craft-new-objects">Will characters be able to craft new objects?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-mobs-npcs-have-some-sort-of-ai">Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#are-npcs-and-mobs-different-entities-how-do-they-differ">Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">_Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#characters">Characters</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-does-the-character-generation-work">How does the character-generation work?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#how-do-you-implement-different-classes-or-races">How do you implement different “classes” or “races”?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#may-player-characters-attack-each-other-pvp">May player-characters attack each other (PvP)?</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#conclusions">Conclusions</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html">3. Planning our tutorial game</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#game-concept">3.1. Game concept</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#administration">3.2. Administration</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#building">3.3. Building</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#systems">3.4. Systems</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#rooms">3.5. Rooms</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#objects">3.6. Objects</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#characters">3.7. Characters</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Planning-The-Tutorial-Game.html#conclusions">3.8. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -249,10 +182,10 @@ and “what to think about” when creating a multiplayer online text game.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="Where do I begin?"
|
||||
<a href="Beginner-Tutorial-Planning-Where-Do-I-Begin.html" title="1. Where do I begin?"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part1/Beginner-Tutorial-Django-queries.html" title="12. Advanced searching - Django Database queries"
|
||||
<a href="../Part1/Beginner-Tutorial-Making-A-Sittable-Object.html" title="13. Building a chair you can sit on"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Planning our tutorial game — Evennia 1.0-dev documentation</title>
|
||||
<title>3. Planning our tutorial game — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Part 3: How we get there" href="../Part3/Beginner-Tutorial-Part3-Intro.html" />
|
||||
<link rel="prev" title="On Planning a Game" href="Beginner-Tutorial-Game-Planning.html" />
|
||||
<link rel="next" title="Part 3: How we get there (example game)" href="../Part3/Beginner-Tutorial-Part3-Intro.html" />
|
||||
<link rel="prev" title="2. On Planning a Game" href="Beginner-Tutorial-Game-Planning.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part3/Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there"
|
||||
<a href="../Part3/Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there (example game)"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="On Planning a Game"
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="2. On Planning a Game"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" accesskey="U">Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Planning our tutorial game</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,69 +64,69 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Planning our tutorial game</a><ul>
|
||||
<li><a class="reference internal" href="#game-concept">Game concept</a></li>
|
||||
<li><a class="reference internal" href="#administration">Administration</a><ul>
|
||||
<li><a class="reference internal" href="#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li><a class="reference internal" href="#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li><a class="reference internal" href="#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
<li><a class="reference internal" href="#">3. Planning our tutorial game</a><ul>
|
||||
<li><a class="reference internal" href="#game-concept">3.1. Game concept</a></li>
|
||||
<li><a class="reference internal" href="#administration">3.2. Administration</a><ul>
|
||||
<li><a class="reference internal" href="#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">3.2.1. Should your game rules be enforced by coded systems by human game masters?</a></li>
|
||||
<li><a class="reference internal" href="#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">3.2.2. What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?</a></li>
|
||||
<li><a class="reference internal" href="#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">3.2.3. Should players be able to post out-of-characters on channels and via other means like bulletin-boards?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#building">Building</a><ul>
|
||||
<li><a class="reference internal" href="#how-will-the-world-be-built">How will the world be built?</a></li>
|
||||
<li><a class="reference internal" href="#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
<li><a class="reference internal" href="#building">3.3. Building</a><ul>
|
||||
<li><a class="reference internal" href="#how-will-the-world-be-built">3.3.1. How will the world be built?</a></li>
|
||||
<li><a class="reference internal" href="#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">3.3.2. Can only privileged Builders create things or should regular players also have limited build-capability?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#systems">Systems</a><ul>
|
||||
<li><a class="reference internal" href="#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li><a class="reference internal" href="#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-have-concepts-like-reputation-and-influence">Do you have concepts like reputation and influence?</a></li>
|
||||
<li><a class="reference internal" href="#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
<li><a class="reference internal" href="#systems">3.4. Systems</a><ul>
|
||||
<li><a class="reference internal" href="#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">3.4.1. Do you base your game off an existing RPG system or make up your own?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">3.4.2. What are the game mechanics? How do you decide if an action succeeds or fails?</a></li>
|
||||
<li><a class="reference internal" href="#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">3.4.3. Does the flow of time matter in your game - does night and day change? What about seasons?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">3.4.4. Do you want changing, global weather or should weather just be set manually in roleplay?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">3.4.5. Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?</a></li>
|
||||
<li><a class="reference internal" href="#do-you-have-concepts-like-reputation-and-influence">3.4.6. Do you have concepts like reputation and influence?</a></li>
|
||||
<li><a class="reference internal" href="#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">3.4.7. Will your characters be known by their name or only by their physical appearance?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#rooms">Rooms</a><ul>
|
||||
<li><a class="reference internal" href="#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li><a class="reference internal" href="#should-the-room-have-different-statuses">Should the room have different statuses?</a></li>
|
||||
<li><a class="reference internal" href="#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
<li><a class="reference internal" href="#rooms">3.5. Rooms</a><ul>
|
||||
<li><a class="reference internal" href="#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">3.5.1. Is a simple room description enough or should the description be able to change?</a></li>
|
||||
<li><a class="reference internal" href="#should-the-room-have-different-statuses">3.5.2. Should the room have different statuses?</a></li>
|
||||
<li><a class="reference internal" href="#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">3.5.3. Can objects be hidden in the room? Can a person hide in the room?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#objects">Objects</a><ul>
|
||||
<li><a class="reference internal" href="#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li><a class="reference internal" href="#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li><a class="reference internal" href="#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li><a class="reference internal" href="#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li><a class="reference internal" href="#can-objects-be-broken-can-they-be-repaired">Can objects be broken? Can they be repaired?</a></li>
|
||||
<li><a class="reference internal" href="#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li><a class="reference internal" href="#will-characters-be-able-to-craft-new-objects">Will characters be able to craft new objects?</a></li>
|
||||
<li><a class="reference internal" href="#should-mobs-npcs-have-some-sort-of-ai">Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li><a class="reference internal" href="#are-npcs-and-mobs-different-entities-how-do-they-differ">Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li><a class="reference internal" href="#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">_Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
<li><a class="reference internal" href="#objects">3.6. Objects</a><ul>
|
||||
<li><a class="reference internal" href="#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">3.6.1. How numerous are your objects? Do you want large loot-lists or are objects just role playing props?</a></li>
|
||||
<li><a class="reference internal" href="#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">3.6.2. Is each coin a separate object or do you just store a bank account value?</a></li>
|
||||
<li><a class="reference internal" href="#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">3.6.3. Do multiple similar objects form stack and how are those stacks handled in that case?</a></li>
|
||||
<li><a class="reference internal" href="#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">3.6.4. Does an object have weight or volume (so you cannot carry an infinite amount of them)?</a></li>
|
||||
<li><a class="reference internal" href="#can-objects-be-broken-can-they-be-repaired">3.6.5. Can objects be broken? Can they be repaired?</a></li>
|
||||
<li><a class="reference internal" href="#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">3.6.6. Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?</a></li>
|
||||
<li><a class="reference internal" href="#will-characters-be-able-to-craft-new-objects">3.6.7. Will characters be able to craft new objects?</a></li>
|
||||
<li><a class="reference internal" href="#should-mobs-npcs-have-some-sort-of-ai">3.6.8. Should mobs/NPCs have some sort of AI?</a></li>
|
||||
<li><a class="reference internal" href="#are-npcs-and-mobs-different-entities-how-do-they-differ">3.6.9. Are NPCs and mobs different entities? How do they differ?</a></li>
|
||||
<li><a class="reference internal" href="#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">3.6.10. _Should there be NPCs giving quests? If so, how do you track Quest status?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#characters">Characters</a><ul>
|
||||
<li><a class="reference internal" href="#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li><a class="reference internal" href="#how-does-the-character-generation-work">How does the character-generation work?</a></li>
|
||||
<li><a class="reference internal" href="#how-do-you-implement-different-classes-or-races">How do you implement different “classes” or “races”?</a></li>
|
||||
<li><a class="reference internal" href="#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li><a class="reference internal" href="#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li><a class="reference internal" href="#may-player-characters-attack-each-other-pvp">May player-characters attack each other (PvP)?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
<li><a class="reference internal" href="#characters">3.7. Characters</a><ul>
|
||||
<li><a class="reference internal" href="#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">3.7.1. Can players have more than one Character active at a time or are they allowed to multi-play?</a></li>
|
||||
<li><a class="reference internal" href="#how-does-the-character-generation-work">3.7.2. How does the character-generation work?</a></li>
|
||||
<li><a class="reference internal" href="#how-do-you-implement-different-classes-or-races">3.7.3. How do you implement different “classes” or “races”?</a></li>
|
||||
<li><a class="reference internal" href="#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">3.7.4. If a Character can hide in a room, what skill will decide if they are detected?</a></li>
|
||||
<li><a class="reference internal" href="#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">3.7.5. What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?</a></li>
|
||||
<li><a class="reference internal" href="#may-player-characters-attack-each-other-pvp">3.7.6. May player-characters attack each other (PvP)?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">3.7.7. What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#conclusions">Conclusions</a></li>
|
||||
<li><a class="reference internal" href="#conclusions">3.8. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Game-Planning.html"
|
||||
title="previous chapter">On Planning a Game</a></p>
|
||||
title="previous chapter"><span class="section-number">2. </span>On Planning a Game</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../Part3/Beginner-Tutorial-Part3-Intro.html"
|
||||
title="next chapter">Part 3: How we get there</a></p>
|
||||
title="next chapter">Part 3: How we get there (example game)</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="planning-our-tutorial-game">
|
||||
<h1>Planning our tutorial game<a class="headerlink" href="#planning-our-tutorial-game" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">3. </span>Planning our tutorial game<a class="headerlink" href="#planning-our-tutorial-game" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Using the general plan from last lesson we’ll now establish what kind of game we want to create for this tutorial. We’ll call it … <em>EvAdventure</em>.
|
||||
Remembering that we need to keep the scope down, let’s establish some parameters.</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -173,7 +173,7 @@ Remembering that we need to keep the scope down, let’s establish some paramete
|
|||
<li><p>We want some sort of quest system and merchants to buy stuff from.</p></li>
|
||||
</ul>
|
||||
<section id="game-concept">
|
||||
<h2>Game concept<a class="headerlink" href="#game-concept" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.1. </span>Game concept<a class="headerlink" href="#game-concept" title="Permalink to this headline">¶</a></h2>
|
||||
<p>With these points in mind, here’s a quick blurb for our game:</p>
|
||||
<p><em>Recently, the nearby village discovered that the old abandoned well contained a dark secret. The bottom of the well led to a previously undiscovered dungeon of ever shifting passages. No one knew why it was there or what its purpose was, but local rumors abound. The first adventurer that went down didn’t come back. The second … brought back a handful of glittering riches.</em></p>
|
||||
<p><em>Now the rush is on - there’s a dungeon to explore and coin to earn. Knaves, cutthroats, adventurers and maybe even a hero or two are coming from all over the realm to challenge whatever lurks at the bottom of that well.</em></p>
|
||||
|
|
@ -188,9 +188,9 @@ Remembering that we need to keep the scope down, let’s establish some paramete
|
|||
<p>For the rest of this lesson we’ll answer and reason around the specific questions posed in the previous <a class="reference internal" href="Beginner-Tutorial-Game-Planning.html"><span class="doc std std-doc">Game Planning</span></a> lesson.</p>
|
||||
</section>
|
||||
<section id="administration">
|
||||
<h2>Administration<a class="headerlink" href="#administration" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.2. </span>Administration<a class="headerlink" href="#administration" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters">
|
||||
<h3>Should your game rules be enforced by coded systems by human game masters?<a class="headerlink" href="#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.2.1. </span>Should your game rules be enforced by coded systems by human game masters?<a class="headerlink" href="#should-your-game-rules-be-enforced-by-coded-systems-by-human-game-masters" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Generally, the more work you expect human staffers/GMs to do, the less your code needs to work. To support GMs you’d need to design commands to support GM-specific actions and the type of game-mastering you want them to do. You may need to expand communication channels so you can easily talk to groups people in private and split off gaming groups from each other. RPG rules could be as simple
|
||||
as the GM sitting with the rule books and using a dice-roller for visibility.</p>
|
||||
<p>GM:ing is work-intensive however, and even the most skilled and enthusiastic GM can’t be awake all hours of the day to serve an international player base. The computer never needs sleep, so having the ability for players to “self-serve” their RP itch when no GMs are around is a good idea even for the most GM-heavy games.</p>
|
||||
|
|
@ -200,7 +200,7 @@ players is low.</p>
|
|||
<p>We want EvAdventure to work entirely without depending on human GMs. That said, there’d be nothing stopping a GM from stepping in and run an adventure for some players should they want to.</p>
|
||||
</section>
|
||||
<section id="what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else">
|
||||
<h3>What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?<a class="headerlink" href="#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.2.2. </span>What is the staff hierarchy in your game? Is vanilla Evennia roles enough or do you need something else?<a class="headerlink" href="#what-is-the-staff-hierarchy-in-your-game-is-vanilla-evennia-roles-enough-or-do-you-need-something-else" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The default hierarchy is</p>
|
||||
<ul class="simple">
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">Player</span></code> - regular players</p></li>
|
||||
|
|
@ -215,7 +215,7 @@ goes outside the regular hierarchy and should usually only.</p>
|
|||
<p>We are okay with keeping the default permission structure for our game.</p>
|
||||
</section>
|
||||
<section id="should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards">
|
||||
<h3>Should players be able to post out-of-characters on channels and via other means like bulletin-boards?<a class="headerlink" href="#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.2.3. </span>Should players be able to post out-of-characters on channels and via other means like bulletin-boards?<a class="headerlink" href="#should-players-be-able-to-post-out-of-characters-on-channels-and-via-other-means-like-bulletin-boards" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Evennia’s <em>Channels</em> are by default only available between <em>Accounts</em>. That is, for players to communicate with each
|
||||
other. By default, the <code class="docutils literal notranslate"><span class="pre">public</span></code> channel is created for general discourse.
|
||||
Channels are logged to a file and when you are coming back to the game you can view the history of a channel in case you missed something.</p>
|
||||
|
|
@ -235,9 +235,9 @@ Channels are logged to a file and when you are coming back to the game you can v
|
|||
</section>
|
||||
</section>
|
||||
<section id="building">
|
||||
<h2>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.3. </span>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="how-will-the-world-be-built">
|
||||
<h3>How will the world be built?<a class="headerlink" href="#how-will-the-world-be-built" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.3.1. </span>How will the world be built?<a class="headerlink" href="#how-will-the-world-be-built" title="Permalink to this headline">¶</a></h3>
|
||||
<p>There are two main ways to handle this:</p>
|
||||
<ul class="simple">
|
||||
<li><p>Traditionally, from in-game with build-commands: This means builders creating content in their game client. This has the advantage of not requiring Python skills nor server access. This can often be a quite intuitive way to build since you are sort-of walking around in your creation as you build it. However, the developer (you) must make sure to provide build-commands that are flexible enough for builders to be able to create the content you want for your game.</p></li>
|
||||
|
|
@ -250,7 +250,7 @@ allows Evennia to apply and re-apply build-scripts that are raw Python modules.
|
|||
<p>For EvAdventure, we will build the above-ground part of the game world using batch-scripts. The world below-ground we will build procedurally, using raw code.</p>
|
||||
</section>
|
||||
<section id="can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability">
|
||||
<h3>Can only privileged Builders create things or should regular players also have limited build-capability?<a class="headerlink" href="#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.3.2. </span>Can only privileged Builders create things or should regular players also have limited build-capability?<a class="headerlink" href="#can-only-privileged-builders-create-things-or-should-regular-players-also-have-limited-build-capability" title="Permalink to this headline">¶</a></h3>
|
||||
<p>In some game styles, players have the ability to create objects and even script them. While giving regular users the ability to create objects with in-built commands is easy and safe, actual code-creation (aka <em>softcode</em> ) is not something Evennia supports natively.</p>
|
||||
<p>Regular, untrusted users should never be allowed to execute raw Python
|
||||
code (such as what you can do with the <code class="docutils literal notranslate"><span class="pre">py</span></code> command). You can
|
||||
|
|
@ -260,9 +260,9 @@ code (such as what you can do with the <code class="docutils literal notranslate
|
|||
</section>
|
||||
</section>
|
||||
<section id="systems">
|
||||
<h2>Systems<a class="headerlink" href="#systems" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.4. </span>Systems<a class="headerlink" href="#systems" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own">
|
||||
<h3>Do you base your game off an existing RPG system or make up your own?<a class="headerlink" href="#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.1. </span>Do you base your game off an existing RPG system or make up your own?<a class="headerlink" href="#do-you-base-your-game-off-an-existing-rpg-system-or-make-up-your-own" title="Permalink to this headline">¶</a></h3>
|
||||
<p>There is a plethora of options out there, and what you choose depends on the game you want. It can be tempting to grab a short free-form ruleset, but remember that the computer does not have any intuitiion or common sense to interpret the rules like a human GM could. Conversely, if you pick a very ‘crunchy’ game system, with detailed simulation of the real world, remember that you’ll need to actually <em>code</em> all those exceptions and tables yourself.</p>
|
||||
<p>For speediest development, what you want is a game with a <em>consolidated</em> resolution mechanic - one you can code once and then use in a lot of situations. But you still want enough rules to help telling the computer how various situations should be resolved (combat is the most common system that needs such structure).</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
|
|
@ -270,7 +270,7 @@ code (such as what you can do with the <code class="docutils literal notranslate
|
|||
<p><em>Knave</em> is available under a Creative Commons Attributions 4.0 License, meaning it can be used for derivative work (even commercially). The above link allows you to purchase the PDF and supporting the author. Alternatively you can find unofficial fan releases of the rules <a class="reference external" href="https://dungeonsandpossums.com/2020/04/some-great-knave-rpg-resources/">on this page</a>.</p>
|
||||
</section>
|
||||
<section id="what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails">
|
||||
<h3>What are the game mechanics? How do you decide if an action succeeds or fails?<a class="headerlink" href="#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.2. </span>What are the game mechanics? How do you decide if an action succeeds or fails?<a class="headerlink" href="#what-are-the-game-mechanics-how-do-you-decide-if-an-action-succeeds-or-fails" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This follows from the RPG system decided upon in the previous question.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p><em>Knave</em> gives every character a set of six traditional stats: Strength, Intelligence, Dexterity, Constitution, Intelligence, Wisdom and Charisma. Each has a value from +1 to +10. To find its “Defense” value, you add 10.</p>
|
||||
|
|
@ -290,7 +290,7 @@ You can have <em>advantage</em> or <em>disadvantage</em> on a roll. This means r
|
|||
</div></blockquote>
|
||||
</section>
|
||||
<section id="does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons">
|
||||
<h3>Does the flow of time matter in your game - does night and day change? What about seasons?<a class="headerlink" href="#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.3. </span>Does the flow of time matter in your game - does night and day change? What about seasons?<a class="headerlink" href="#does-the-flow-of-time-matter-in-your-game-does-night-and-day-change-what-about-seasons" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Most commonly, game-time runs faster than real-world time. There are
|
||||
a few advantages with this:</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -303,27 +303,27 @@ a few advantages with this:</p>
|
|||
<p>The passage of time will have no impact on our particular game example, so we’ll go with Evennia’s default, which is that the game-time runs two times faster than real time.</p>
|
||||
</section>
|
||||
<section id="do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay">
|
||||
<h3>Do you want changing, global weather or should weather just be set manually in roleplay?<a class="headerlink" href="#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.4. </span>Do you want changing, global weather or should weather just be set manually in roleplay?<a class="headerlink" href="#do-you-want-changing-global-weather-or-should-weather-just-be-set-manually-in-roleplay" title="Permalink to this headline">¶</a></h3>
|
||||
<p>A weather system is a good example of a game-global system that affects a subset of game entities (outdoor rooms).</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We’ll not change the weather, but will add some random messages to echo through
|
||||
the game world at random intervals just to show the principle.</p>
|
||||
</section>
|
||||
<section id="do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all">
|
||||
<h3>Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?<a class="headerlink" href="#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.5. </span>Do you want a coded world-economy or just a simple barter system? Or no formal economy at all?<a class="headerlink" href="#do-you-want-a-coded-world-economy-or-just-a-simple-barter-system-or-no-formal-economy-at-all" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This is a big question and depends on how deep and interconnected the virtual transactions are that are happening in the game. Shop prices could rice and drop due to supply and demand, supply chains could involve crafting and production. One also could consider adding money sinks and manipulate the in-game market to combat inflation.</p>
|
||||
<p>The <a class="reference internal" href="../../../Contribs/Contrib-Barter.html"><span class="doc std std-doc">Barter</span></a> contrib provides a full interface for trading with another player in a safe way.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will not deal with any of this complexity. We will allow for players to buy from npc sellers and players will be able to trade using the normal <code class="docutils literal notranslate"><span class="pre">give</span></code> command.</p>
|
||||
</section>
|
||||
<section id="do-you-have-concepts-like-reputation-and-influence">
|
||||
<h3>Do you have concepts like reputation and influence?<a class="headerlink" href="#do-you-have-concepts-like-reputation-and-influence" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.6. </span>Do you have concepts like reputation and influence?<a class="headerlink" href="#do-you-have-concepts-like-reputation-and-influence" title="Permalink to this headline">¶</a></h3>
|
||||
<p>These are useful things for a more social-interaction heavy game.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will not include them for this tutorial. Adding the Barter contrib is simple though.</p>
|
||||
</section>
|
||||
<section id="will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance">
|
||||
<h3>Will your characters be known by their name or only by their physical appearance?<a class="headerlink" href="#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.4.7. </span>Will your characters be known by their name or only by their physical appearance?<a class="headerlink" href="#will-your-characters-be-known-by-their-name-or-only-by-their-physical-appearance" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This is a common thing in RP-heavy games. Others will only see you as “The tall woman” until you introduce yourself and they ‘recognize’ you with a name. Linked to this is the concept of more complex emoting and posing.</p>
|
||||
<p>Implementing such a system is not trivial, but the <a class="reference internal" href="../../../Contribs/Contrib-RPSystem.html"><span class="doc std std-doc">RPsystem</span></a> Evennia contrib offers a ready system with everything needed for free emoting, recognizing people by their appearance and more.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
|
|
@ -331,69 +331,69 @@ the game world at random intervals just to show the principle.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="rooms">
|
||||
<h2>Rooms<a class="headerlink" href="#rooms" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.5. </span>Rooms<a class="headerlink" href="#rooms" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="is-a-simple-room-description-enough-or-should-the-description-be-able-to-change">
|
||||
<h3>Is a simple room description enough or should the description be able to change?<a class="headerlink" href="#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.5.1. </span>Is a simple room description enough or should the description be able to change?<a class="headerlink" href="#is-a-simple-room-description-enough-or-should-the-description-be-able-to-change" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Changing room descriptions for day and night, winder and summer is actually quite easy to do, but looks very impressive. We happen to know there is also a contrib that helps with this, so we’ll show how to include that.</p>
|
||||
<p>There is an <a class="reference internal" href="../../../Contribs/Contrib-Extended-Room.html"><span class="doc std std-doc">Extended Room</span></a> contrib that adds a Room type that is aware of the time-of-day as well as seasonal variations.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will stick to a normal room in this tutorial and let the world be in a perpetual daylight. Making Rooms into ExtendedRooms is not hard though.</p>
|
||||
</section>
|
||||
<section id="should-the-room-have-different-statuses">
|
||||
<h3>Should the room have different statuses?<a class="headerlink" href="#should-the-room-have-different-statuses" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.5.2. </span>Should the room have different statuses?<a class="headerlink" href="#should-the-room-have-different-statuses" title="Permalink to this headline">¶</a></h3>
|
||||
<p>One could picture weather making outdoor rooms wet, cold or burnt. In rain, bow strings could get wet and fireballs fizz out. In a hot room, characters could require drinking more water, or even take damage if not finding shelter.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>For the above-ground we need to be able to disable combat all rooms except for the PvP location. We also need to consider how to auto-generate the rooms under ground. So we probably will need some statuses to control that.</p>
|
||||
<p>Since each room under ground should present some sort of challenge, we may need a few different room types different from the above-ground Rooms.</p>
|
||||
</section>
|
||||
<section id="can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room">
|
||||
<h3>Can objects be hidden in the room? Can a person hide in the room?<a class="headerlink" href="#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.5.3. </span>Can objects be hidden in the room? Can a person hide in the room?<a class="headerlink" href="#can-objects-be-hidden-in-the-room-can-a-person-hide-in-the-room" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This ties into if you have hide/stealth mechanics. Maybe you could evesdrop or attack out of hiding.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will not model hiding and stealth. This will be a game of honorable face-to-face conflict.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="objects">
|
||||
<h2>Objects<a class="headerlink" href="#objects" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.6. </span>Objects<a class="headerlink" href="#objects" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props">
|
||||
<h3>How numerous are your objects? Do you want large loot-lists or are objects just role playing props?<a class="headerlink" href="#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.1. </span>How numerous are your objects? Do you want large loot-lists or are objects just role playing props?<a class="headerlink" href="#how-numerous-are-your-objects-do-you-want-large-loot-lists-or-are-objects-just-role-playing-props" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This also depends on the type of game. In a pure freeform RPG, most objects may be ‘imaginary’ and just appearing in fiction. If the game is more coded, you want objects with properties that the computer can measure, track and calculate. In many roleplaying-heavy games, you find a mixture of the two, with players imagining items for roleplaying scenes, but only using ‘real’ objects to resolve conflicts.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will want objects with properties, like weapons and potions and such. Monsters should drop loot even though our list of objects will not be huge in this example game.</p>
|
||||
</section>
|
||||
<section id="is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value">
|
||||
<h3>Is each coin a separate object or do you just store a bank account value?<a class="headerlink" href="#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.2. </span>Is each coin a separate object or do you just store a bank account value?<a class="headerlink" href="#is-each-coin-a-separate-object-or-do-you-just-store-a-bank-account-value" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The advantage of having multiple items is that it can be more immersive. The drawback is that it’s also very fiddly to deal with individual coins, especially if you have to deal with different currencies.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p><em>Knave</em> uses the “copper” as the base coin and so will we. Knave considers the weight of coin and one inventory “slot” can hold 100 coins. So we’ll implement a “coin item” to represent many coins.</p>
|
||||
</section>
|
||||
<section id="do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case">
|
||||
<h3>Do multiple similar objects form stack and how are those stacks handled in that case?<a class="headerlink" href="#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.3. </span>Do multiple similar objects form stack and how are those stacks handled in that case?<a class="headerlink" href="#do-multiple-similar-objects-form-stack-and-how-are-those-stacks-handled-in-that-case" title="Permalink to this headline">¶</a></h3>
|
||||
<p>If you drop two identical apples on the ground, Evennia will default to show this in the room as “two apples”, but this is just a visual effect - there are still two apple-objects in the room. One could picture instead merging the two into a single object “X nr of apples” when you drop the apples.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will keep Evennia’s default.</p>
|
||||
</section>
|
||||
<section id="does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them">
|
||||
<h3>Does an object have weight or volume (so you cannot carry an infinite amount of them)?<a class="headerlink" href="#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.4. </span>Does an object have weight or volume (so you cannot carry an infinite amount of them)?<a class="headerlink" href="#does-an-object-have-weight-or-volume-so-you-cannot-carry-an-infinite-amount-of-them" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Limiting carrying weight is one way to stop players from hoarding. It also makes it more important for players to pick only the equipment they need. Carrying limits can easily come across as annoying to players though, so one needs to be careful with it.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p><em>Knave</em> limits your inventory to <code class="docutils literal notranslate"><span class="pre">Constitution</span> <span class="pre">+</span> <span class="pre">10</span></code> “slots”, where most items take up one slot and some large things, like armor, uses two. Small items (like rings) can fit 2-10 per slot and you can fit 100 coins in a slot. This is an important game mechanic to limit players from hoarding. Especially since you need coin to level up.</p>
|
||||
</section>
|
||||
<section id="can-objects-be-broken-can-they-be-repaired">
|
||||
<h3>Can objects be broken? Can they be repaired?<a class="headerlink" href="#can-objects-be-broken-can-they-be-repaired" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.5. </span>Can objects be broken? Can they be repaired?<a class="headerlink" href="#can-objects-be-broken-can-they-be-repaired" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Item breakage is very useful for a game economy; breaking weapons adds tactical considerations (if it’s not too common, then it becomes annoying) and repairing things gives work for crafting players.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>In <em>Knave</em>, items will break if you make a critical failure on using them (rolls a native 1 on d20). This means they lose a level of <code class="docutils literal notranslate"><span class="pre">quality</span></code> and once at 0, it’s unusable. We will not allow players to repair, but we could allow merchants to repair items for a fee.</p>
|
||||
</section>
|
||||
<section id="can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing">
|
||||
<h3>Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?<a class="headerlink" href="#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.6. </span>Can you fight with a chair or a flower or must you use a special ‘weapon’ kind of thing?<a class="headerlink" href="#can-you-fight-with-a-chair-or-a-flower-or-must-you-use-a-special-weapon-kind-of-thing" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Traditionally, only ‘weapons’ could be used to fight with. In the past this was a useful
|
||||
simplification, but with Python classes and inheritance, it’s not actually more work to just let all items in game work as a weapon in a pinch.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>Since <em>Knave</em> deals with weapon lists and positions where items can be wielded, we will have a separate “Weapon” class for everything you can use for fighting. So, you won’t be able to fight with a chair (unless we make it a weapon-inherited chair).</p>
|
||||
</section>
|
||||
<section id="will-characters-be-able-to-craft-new-objects">
|
||||
<h3>Will characters be able to craft new objects?<a class="headerlink" href="#will-characters-be-able-to-craft-new-objects" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.7. </span>Will characters be able to craft new objects?<a class="headerlink" href="#will-characters-be-able-to-craft-new-objects" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Crafting is a common feature in multiplayer games. In code it usually means using a skill-check to combine base ingredients from a fixed recipe in order to create a new item. The classic example is to combine <em>leather straps</em>, a <em>hilt</em>, a <em>pommel</em> and a <em>blade</em> to make a new <em>sword</em>.</p>
|
||||
<p>A full-fledged crafting system could require multiple levels of crafting, including having to mine for ore or cut down trees for wood.</p>
|
||||
<p>Evennia’s <a class="reference internal" href="../../../Contribs/Contrib-Crafting.html"><span class="doc std std-doc">Crafting</span></a> contrib adds a full crafting system to any game. It’s based on <a class="reference internal" href="../../../Components/Tags.html"><span class="doc std std-doc">Tags</span></a>, meaning that pretty much any object can be made usable for crafting, even used in an unexpected way.</p>
|
||||
|
|
@ -401,29 +401,29 @@ simplification, but with Python classes and inheritance, it’s not actually mor
|
|||
<p>In our case we will not add any crafting in order to limit the scope of our game. Maybe NPCs will be able to repair items - for a cost?</p>
|
||||
</section>
|
||||
<section id="should-mobs-npcs-have-some-sort-of-ai">
|
||||
<h3>Should mobs/NPCs have some sort of AI?<a class="headerlink" href="#should-mobs-npcs-have-some-sort-of-ai" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.8. </span>Should mobs/NPCs have some sort of AI?<a class="headerlink" href="#should-mobs-npcs-have-some-sort-of-ai" title="Permalink to this headline">¶</a></h3>
|
||||
<p>As a rule, you should not hope to fool anyone into thinking your AI is actually intelligent. The best you will be able to do is to give interesting results and unless you have a side-gig as an AI researcher, users will likely not notice any practical difference between a simple state-machine and you spending a lot of time learning
|
||||
how to train a neural net.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>For this tutorial, we will show how to add a simple state-machine AI for monsters. NPCs will only be shop-keepers and quest-gives so they won’t need any real AI to speak of.</p>
|
||||
</section>
|
||||
<section id="are-npcs-and-mobs-different-entities-how-do-they-differ">
|
||||
<h3>Are NPCs and mobs different entities? How do they differ?<a class="headerlink" href="#are-npcs-and-mobs-different-entities-how-do-they-differ" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.9. </span>Are NPCs and mobs different entities? How do they differ?<a class="headerlink" href="#are-npcs-and-mobs-different-entities-how-do-they-differ" title="Permalink to this headline">¶</a></h3>
|
||||
<p>“Mobs” or “mobiles” are things that move around. This is traditionally monsters you can fight with, but could also be city guards or the baker going to chat with the neighbor. Back in the day, they were often fundamentally different these days it’s often easier to just make NPCs and mobs essentially the same thing.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>In EvAdventure, Monsters and NPCs do very different things, so they will be different classes, sharing some code where possible.</p>
|
||||
</section>
|
||||
<section id="should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status">
|
||||
<h3>_Should there be NPCs giving quests? If so, how do you track Quest status?<a class="headerlink" href="#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.6.10. </span>_Should there be NPCs giving quests? If so, how do you track Quest status?<a class="headerlink" href="#should-there-be-npcs-giving-quests-if-so-how-do-you-track-quest-status" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Quests are a staple of many classic RPGs.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>We will design a simple quest system with some simple conditions for success, like carrying the right item or items back to the quest giver.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="characters">
|
||||
<h2>Characters<a class="headerlink" href="#characters" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.7. </span>Characters<a class="headerlink" href="#characters" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play">
|
||||
<h3>Can players have more than one Character active at a time or are they allowed to multi-play?<a class="headerlink" href="#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.1. </span>Can players have more than one Character active at a time or are they allowed to multi-play?<a class="headerlink" href="#can-players-have-more-than-one-character-active-at-a-time-or-are-they-allowed-to-multi-play" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Since Evennia differentiates between <code class="docutils literal notranslate"><span class="pre">Sessions</span></code> (the client-connection to the game), <code class="docutils literal notranslate"><span class="pre">Accounts</span></code> and <code class="docutils literal notranslate"><span class="pre">Character</span></code>s, it natively supports multi-play. This is controlled by the <code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE</span></code> setting, which has a value from <code class="docutils literal notranslate"><span class="pre">0</span></code> (default) to <code class="docutils literal notranslate"><span class="pre">3</span></code>.</p>
|
||||
<ul class="simple">
|
||||
<li><p><code class="docutils literal notranslate"><span class="pre">0</span></code>- One Character per Account and one Session per Account. This means that if you login to the same
|
||||
|
|
@ -443,7 +443,7 @@ can control each Character from multiple clients, seeing the same output from ea
|
|||
<p>Due to the nature of <em>Knave</em>, characters are squishy and probably short-lived. So it makes little sense to keep a stable of them. We’ll use use mode 0 or 1.</p>
|
||||
</section>
|
||||
<section id="how-does-the-character-generation-work">
|
||||
<h3>How does the character-generation work?<a class="headerlink" href="#how-does-the-character-generation-work" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.2. </span>How does the character-generation work?<a class="headerlink" href="#how-does-the-character-generation-work" title="Permalink to this headline">¶</a></h3>
|
||||
<p>There are a few common ways to do character generation:</p>
|
||||
<ul class="simple">
|
||||
<li><p>Rooms. This is the traditional way. Each room’s description tells you what command to use to modify your character. When you are done you move to the next room. Only use this if you have another reason for using a room, like having a training dummy to test skills on, for example.</p></li>
|
||||
|
|
@ -456,14 +456,14 @@ using custom commands they will likely never use again after this.</p></li>
|
|||
<p>Knave randomizes almost aspects of the Character generation. We’ll use a menu to let the player add their name and sex as well as do the minor re-assignment of stats allowed by the rules.</p>
|
||||
</section>
|
||||
<section id="how-do-you-implement-different-classes-or-races">
|
||||
<h3>How do you implement different “classes” or “races”?<a class="headerlink" href="#how-do-you-implement-different-classes-or-races" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.3. </span>How do you implement different “classes” or “races”?<a class="headerlink" href="#how-do-you-implement-different-classes-or-races" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The way classes and races work in most RPGs is that they act as static ‘templates’ that inform which bonuses and special abilities you have. Much of this only comes into play during character generation or when leveling up.</p>
|
||||
<p>Often all we need to store on the Character is <em>which</em> class and <em>which</em> race they have; the actual logic can sit in Python code and just be looked up when we need it.</p>
|
||||
<p><strong>EvAdventure Answer</strong></p>
|
||||
<p>There are no races and no classes in <em>Knave</em>. Every character is a human.</p>
|
||||
</section>
|
||||
<section id="if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected">
|
||||
<h3>If a Character can hide in a room, what skill will decide if they are detected?<a class="headerlink" href="#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.4. </span>If a Character can hide in a room, what skill will decide if they are detected?<a class="headerlink" href="#if-a-character-can-hide-in-a-room-what-skill-will-decide-if-they-are-detected" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Hiding means a few things.</p>
|
||||
<ul class="simple">
|
||||
<li><p>The Character should not appear in the room’s description / character list</p></li>
|
||||
|
|
@ -477,7 +477,7 @@ find the person (probably based on skill checks).</p></li>
|
|||
<p>We will not be including a hide-mechanic in EvAdventure.</p>
|
||||
</section>
|
||||
<section id="what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying">
|
||||
<h3>What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?<a class="headerlink" href="#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.5. </span>What does the skill tree look like? Can a Character gain experience to improve? By killing enemies? Solving quests? By roleplaying?<a class="headerlink" href="#what-does-the-skill-tree-look-like-can-a-character-gain-experience-to-improve-by-killing-enemies-solving-quests-by-roleplaying" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Gaining experience points (XP) and improving one’s character is a staple of roleplaying games. There are many
|
||||
ways to implement this:</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -500,7 +500,7 @@ you gain XP only for running when you run, XP for your axe skill when you fight
|
|||
<p>We will use an alternative rule in <em>Knave</em>, where Characters gain XP by spending coins they carry back from their adventures. The above-ground merchants will allow you to spend your coins and exchange them for XP 1:1. Each level costs 1000 coins. Every level you have <code class="docutils literal notranslate"><span class="pre">1d8</span>  <span class="pre">*</span> <span class="pre">new</span> <span class="pre">level</span></code> (minimum what you had before + 1) HP, and can raise 3 different ability scores by 1 (max +10). There are no skills in <em>Knave</em>, but the principle of increasing them would be the same.</p>
|
||||
</section>
|
||||
<section id="may-player-characters-attack-each-other-pvp">
|
||||
<h3>May player-characters attack each other (PvP)?<a class="headerlink" href="#may-player-characters-attack-each-other-pvp" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.6. </span>May player-characters attack each other (PvP)?<a class="headerlink" href="#may-player-characters-attack-each-other-pvp" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Deciding this affects the style of your entire game. PvP makes for exciting gameplay but it opens a whole new can of worms when it comes to “fairness”. Players will usually accept dying to an overpowered NPC dragon. They will not be as accepting if they perceive another player as being overpowered. PvP means that you
|
||||
have to be very careful to balance the game - all characters does not have to be exactly equal but they should all be viable to play a fun game with.</p>
|
||||
<p>PvP does not only mean combat though. Players can compete in all sorts of ways, including gaining influence in a political game or gaining market share when selling their crafted merchandise.</p>
|
||||
|
|
@ -508,7 +508,7 @@ have to be very careful to balance the game - all characters does not have to be
|
|||
<p>We will allow PvP only in one place - a special Dueling location where players can play-fight each other for training and prestige, but not actually get killed. Otherwise no PvP will be allowed. Note that without a full Barter system in place (just regular <code class="docutils literal notranslate"><span class="pre">give</span></code>, it makes it theoretically easier for players to scam one another.</p>
|
||||
</section>
|
||||
<section id="what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison">
|
||||
<h3>What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?<a class="headerlink" href="#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.7.7. </span>What are the penalties of defeat? Permanent death? Quick respawn? Time in prison?<a class="headerlink" href="#what-are-the-penalties-of-defeat-permanent-death-quick-respawn-time-in-prison" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This is another big decision that strongly affects the mood and style of your game.</p>
|
||||
<p>Perma-death means that once your character dies, it’s gone and you have to make a new one.</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -546,7 +546,7 @@ randomized).</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="conclusions">
|
||||
<h2>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.8. </span>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Going through the questions has helped us get a little bit more of a feel for the game we want to do. There are many, many other things we could ask ourselves, but if we can cover these points we will be a good way towards a complete,
|
||||
playable game!</p>
|
||||
<p>In the last of these planning lessons we’ll sketch out how these ideas will map to Evennia.</p>
|
||||
|
|
@ -569,16 +569,16 @@ playable game!</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part3/Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there"
|
||||
<a href="../Part3/Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there (example game)"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="On Planning a Game"
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="2. On Planning a Game"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" >Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Planning our tutorial game</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Planning our tutorial game</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Where do I begin? — Evennia 1.0-dev documentation</title>
|
||||
<title>1. Where do I begin? — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="On Planning a Game" href="Beginner-Tutorial-Game-Planning.html" />
|
||||
<link rel="next" title="2. On Planning a Game" href="Beginner-Tutorial-Game-Planning.html" />
|
||||
<link rel="prev" title="Part 2: What we want" href="Beginner-Tutorial-Part2-Intro.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="On Planning a Game"
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="2. On Planning a Game"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" accesskey="U">Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Where do I begin?</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Where do I begin?</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,15 +64,15 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Where do I begin?</a><ul>
|
||||
<li><a class="reference internal" href="#what-is-your-motivation-for-doing-this">What is your motivation for doing this?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-your-skills">What are your skills?</a><ul>
|
||||
<li><a class="reference internal" href="#the-game-engine">The game engine</a></li>
|
||||
<li><a class="reference internal" href="#asset-creation">Asset creation</a></li>
|
||||
<li><a class="reference internal" href="#">1. Where do I begin?</a><ul>
|
||||
<li><a class="reference internal" href="#what-is-your-motivation-for-doing-this">1.1. What is your motivation for doing this?</a></li>
|
||||
<li><a class="reference internal" href="#what-are-your-skills">1.2. What are your skills?</a><ul>
|
||||
<li><a class="reference internal" href="#the-game-engine">1.2.1. The game engine</a></li>
|
||||
<li><a class="reference internal" href="#asset-creation">1.2.2. Asset creation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#so-where-do-i-begin-then">So, where do I begin, then?</a></li>
|
||||
<li><a class="reference internal" href="#conclusions">Conclusions</a></li>
|
||||
<li><a class="reference internal" href="#so-where-do-i-begin-then">1.3. So, where do I begin, then?</a></li>
|
||||
<li><a class="reference internal" href="#conclusions">1.4. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
title="previous chapter">Part 2: What we want</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Game-Planning.html"
|
||||
title="next chapter">On Planning a Game</a></p>
|
||||
title="next chapter"><span class="section-number">2. </span>On Planning a Game</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="where-do-i-begin">
|
||||
<h1>Where do I begin?<a class="headerlink" href="#where-do-i-begin" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">1. </span>Where do I begin?<a class="headerlink" href="#where-do-i-begin" title="Permalink to this headline">¶</a></h1>
|
||||
<p>The good news is that following this Starting tutorial is a great way to begin making an Evennia game.</p>
|
||||
<p>The bad news is that everyone’s different and when it comes to starting your own game there is no
|
||||
one-size-fits-all answer. Instead we will ask a series of questions
|
||||
|
|
@ -126,7 +126,7 @@ to learn Evennia. If you just want to follow along with the technical bits you c
|
|||
come back later when you feel ready to take on making your own game.</p>
|
||||
</div></blockquote>
|
||||
<section id="what-is-your-motivation-for-doing-this">
|
||||
<h2>What is your motivation for doing this?<a class="headerlink" href="#what-is-your-motivation-for-doing-this" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.1. </span>What is your motivation for doing this?<a class="headerlink" href="#what-is-your-motivation-for-doing-this" title="Permalink to this headline">¶</a></h2>
|
||||
<p>So you want to make a game. First you need to make a few things clear to yourself.</p>
|
||||
<p>Making a multiplayer online game is a <em>big</em> undertaking. You will (if you are like most of us) be
|
||||
doing it as a hobby, without getting paid. And you’ll be doing it for a long time.</p>
|
||||
|
|
@ -163,7 +163,7 @@ timeline for release.</p>
|
|||
sure your eventual team is on the same page too.</p>
|
||||
</section>
|
||||
<section id="what-are-your-skills">
|
||||
<h2>What are your skills?<a class="headerlink" href="#what-are-your-skills" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.2. </span>What are your skills?<a class="headerlink" href="#what-are-your-skills" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Once you have your motivations straight you need to take a stock of your own skills and the skills
|
||||
available in your team, if you have any.</p>
|
||||
<p>Your game will have two principal components and you will need skills to cater for both:</p>
|
||||
|
|
@ -172,7 +172,7 @@ available in your team, if you have any.</p>
|
|||
<li><p>The assets created for using the game engine (“the game world”)</p></li>
|
||||
</ul>
|
||||
<section id="the-game-engine">
|
||||
<h3>The game engine<a class="headerlink" href="#the-game-engine" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">1.2.1. </span>The game engine<a class="headerlink" href="#the-game-engine" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The game engine is maintained and modified by programmers (coders). It represents the infrastructure
|
||||
that runs the game - the network code, the protocol support, the handling of commands, scripting and
|
||||
data storage.</p>
|
||||
|
|
@ -190,7 +190,7 @@ covered.</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="asset-creation">
|
||||
<h3>Asset creation<a class="headerlink" href="#asset-creation" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">1.2.2. </span>Asset creation<a class="headerlink" href="#asset-creation" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Compared to the level of work needed to produce professional graphics for an MMORPG, detailed text
|
||||
assets for a mud are cheap to create. This is one of the many reasons muds are so well suited for a
|
||||
small team.</p>
|
||||
|
|
@ -209,7 +209,7 @@ build-tools and commands for them.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="so-where-do-i-begin-then">
|
||||
<h2>So, where do I begin, then?<a class="headerlink" href="#so-where-do-i-begin-then" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.3. </span>So, where do I begin, then?<a class="headerlink" href="#so-where-do-i-begin-then" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Right, after all this soul-searching and skill-inventory-checking, let’s go back to the original
|
||||
question. And maybe you’ll find that you have a better feeling for the answer yourself already:</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -239,7 +239,7 @@ If they build anything at all, it should be small test areas to agree on a homog
|
|||
and literary style.</p>
|
||||
</section>
|
||||
<section id="conclusions">
|
||||
<h2>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.4. </span>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Remember that what kills a hobby game project will usually be your own lack of
|
||||
motivation. So do whatever you can to keep that motivation burning strong! Even if it means
|
||||
deviating from what you read in a tutorial like this one. Just get that game out there, whichever way
|
||||
|
|
@ -266,7 +266,7 @@ then try to answer those questions for the sake of creating our little tutorial
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="On Planning a Game"
|
||||
<a href="Beginner-Tutorial-Game-Planning.html" title="2. On Planning a Game"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part2-Intro.html" title="Part 2: What we want"
|
||||
|
|
@ -275,7 +275,7 @@ then try to answer those questions for the sake of creating our little tutorial
|
|||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" >Part 2: What we want</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Where do I begin?</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Where do I begin?</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Player Characters — Evennia 1.0-dev documentation</title>
|
||||
<title>3. Player Characters — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="In-game Objects and items" href="Beginner-Tutorial-Objects.html" />
|
||||
<link rel="prev" title="Rules and dice rolling" href="Beginner-Tutorial-Rules.html" />
|
||||
<link rel="next" title="4. In-game Objects and items" href="Beginner-Tutorial-Objects.html" />
|
||||
<link rel="prev" title="2. Rules and dice rolling" href="Beginner-Tutorial-Rules.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Objects.html" title="In-game Objects and items"
|
||||
<a href="Beginner-Tutorial-Objects.html" title="4. In-game Objects and items"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rules.html" title="Rules and dice rolling"
|
||||
<a href="Beginner-Tutorial-Rules.html" title="2. Rules and dice rolling"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Player Characters</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Player Characters</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,28 +64,28 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Player Characters</a><ul>
|
||||
<li><a class="reference internal" href="#inheritance-structure">Inheritance structure</a></li>
|
||||
<li><a class="reference internal" href="#living-mixin-class">Living mixin class</a></li>
|
||||
<li><a class="reference internal" href="#character-class">Character class</a><ul>
|
||||
<li><a class="reference internal" href="#funcparser-inlines">Funcparser inlines</a></li>
|
||||
<li><a class="reference internal" href="#backtracking">Backtracking</a></li>
|
||||
<li><a class="reference internal" href="#">3. Player Characters</a><ul>
|
||||
<li><a class="reference internal" href="#inheritance-structure">3.1. Inheritance structure</a></li>
|
||||
<li><a class="reference internal" href="#living-mixin-class">3.2. Living mixin class</a></li>
|
||||
<li><a class="reference internal" href="#character-class">3.3. Character class</a><ul>
|
||||
<li><a class="reference internal" href="#funcparser-inlines">3.3.1. Funcparser inlines</a></li>
|
||||
<li><a class="reference internal" href="#backtracking">3.3.2. Backtracking</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#connecting-the-character-with-evennia">Connecting the Character with Evennia</a></li>
|
||||
<li><a class="reference internal" href="#unit-testing">Unit Testing</a></li>
|
||||
<li><a class="reference internal" href="#about-races-and-classes">About races and classes</a></li>
|
||||
<li><a class="reference internal" href="#summary">Summary</a></li>
|
||||
<li><a class="reference internal" href="#connecting-the-character-with-evennia">3.4. Connecting the Character with Evennia</a></li>
|
||||
<li><a class="reference internal" href="#unit-testing">3.5. Unit Testing</a></li>
|
||||
<li><a class="reference internal" href="#about-races-and-classes">3.6. About races and classes</a></li>
|
||||
<li><a class="reference internal" href="#summary">3.7. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Rules.html"
|
||||
title="previous chapter">Rules and dice rolling</a></p>
|
||||
title="previous chapter"><span class="section-number">2. </span>Rules and dice rolling</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Objects.html"
|
||||
title="next chapter">In-game Objects and items</a></p>
|
||||
title="next chapter"><span class="section-number">4. </span>In-game Objects and items</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="player-characters">
|
||||
<h1>Player Characters<a class="headerlink" href="#player-characters" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">3. </span>Player Characters<a class="headerlink" href="#player-characters" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In the <a class="reference internal" href="Beginner-Tutorial-Rules.html"><span class="doc std std-doc">previous lesson about rules and dice rolling</span></a> we made some
|
||||
assumptions about the “Player Character” entity:</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -129,7 +129,7 @@ should be able to be changed over time. It makes sense to base it off Evennia’
|
|||
<a class="reference internal" href="../../../Components/Typeclasses.html"><span class="doc std std-doc">DefaultCharacter Typeclass</span></a>. The Character class is like a ‘character sheet’ in a tabletop
|
||||
RPG, it will hold everything relevant to that PC.</p>
|
||||
<section id="inheritance-structure">
|
||||
<h2>Inheritance structure<a class="headerlink" href="#inheritance-structure" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.1. </span>Inheritance structure<a class="headerlink" href="#inheritance-structure" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Player Characters (PCs) are not the only “living” things in our world. We also have <em>NPCs</em>
|
||||
(like shopkeepers and other friendlies) as well as <em>monsters</em> (mobs) that can attack us.</p>
|
||||
<p>In code, there are a few ways we could structure this. If NPCs/monsters were just special cases of PCs,
|
||||
|
|
@ -198,7 +198,7 @@ extra functionality all living things should be able to do. This is an example o
|
|||
since it can also get confusing to follow the code.</p>
|
||||
</section>
|
||||
<section id="living-mixin-class">
|
||||
<h2>Living mixin class<a class="headerlink" href="#living-mixin-class" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.2. </span>Living mixin class<a class="headerlink" href="#living-mixin-class" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/characters.py</span></code></p>
|
||||
</div></blockquote>
|
||||
|
|
@ -260,7 +260,7 @@ since it can also get confusing to follow the code.</p>
|
|||
in the mixin means we can expect these methods to be available for all living things.</p>
|
||||
</section>
|
||||
<section id="character-class">
|
||||
<h2>Character class<a class="headerlink" href="#character-class" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.3. </span>Character class<a class="headerlink" href="#character-class" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We will now start making the basic Character class, based on what we need from <em>Knave</em>.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/characters.py</span>
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ this makes it easier to handle barter and trading later.</p>
|
|||
<p>We implement the Player Character versions of <code class="docutils literal notranslate"><span class="pre">at_defeat</span></code> and <code class="docutils literal notranslate"><span class="pre">at_death</span></code>. We also make use of <code class="docutils literal notranslate"><span class="pre">.heal()</span></code>
|
||||
from the <code class="docutils literal notranslate"><span class="pre">LivingMixin</span></code> class.</p>
|
||||
<section id="funcparser-inlines">
|
||||
<h3>Funcparser inlines<a class="headerlink" href="#funcparser-inlines" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.3.1. </span>Funcparser inlines<a class="headerlink" href="#funcparser-inlines" title="Permalink to this headline">¶</a></h3>
|
||||
<p>This piece of code is worth some more explanation:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">location</span><span class="o">.</span><span class="n">msg_contents</span><span class="p">(</span>
|
||||
<span class="s2">"$You() $conj(collapse) in a heap, alive but beaten."</span><span class="p">,</span>
|
||||
|
|
@ -348,7 +348,7 @@ The <code class="docutils literal notranslate"><span class="pre">$conj()</span><
|
|||
<p>Note how <code class="docutils literal notranslate"><span class="pre">$conj()</span></code> chose <code class="docutils literal notranslate"><span class="pre">collapse/collapses</span></code> to make the sentences grammatically correct.</p>
|
||||
</section>
|
||||
<section id="backtracking">
|
||||
<h3>Backtracking<a class="headerlink" href="#backtracking" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">3.3.2. </span>Backtracking<a class="headerlink" href="#backtracking" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We make our first use of the <code class="docutils literal notranslate"><span class="pre">rules.dice</span></code> roller to roll on the death table! As you may recall, in the
|
||||
previous lesson, we didn’t know just what to do when rolling ‘dead’ on this table. Now we know - we
|
||||
should be calling <code class="docutils literal notranslate"><span class="pre">at_death</span></code> on the character. So let’s add that where we had TODOs before:</p>
|
||||
|
|
@ -377,7 +377,7 @@ should be calling <code class="docutils literal notranslate"><span class="pre">a
|
|||
</section>
|
||||
</section>
|
||||
<section id="connecting-the-character-with-evennia">
|
||||
<h2>Connecting the Character with Evennia<a class="headerlink" href="#connecting-the-character-with-evennia" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.4. </span>Connecting the Character with Evennia<a class="headerlink" href="#connecting-the-character-with-evennia" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You can easily make yourself an <code class="docutils literal notranslate"><span class="pre">EvAdventureCharacter</span></code> in-game by using the
|
||||
<code class="docutils literal notranslate"><span class="pre">type</span></code> command:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>type self = evadventure.characters.EvAdventureCharacter
|
||||
|
|
@ -403,7 +403,7 @@ instead.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="unit-testing">
|
||||
<h2>Unit Testing<a class="headerlink" href="#unit-testing" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.5. </span>Unit Testing<a class="headerlink" href="#unit-testing" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/tests/test_characters.py</span></code></p>
|
||||
</div></blockquote>
|
||||
|
|
@ -455,7 +455,7 @@ tests for other methods as practice. Refer to previous lessons for details.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="about-races-and-classes">
|
||||
<h2>About races and classes<a class="headerlink" href="#about-races-and-classes" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.6. </span>About races and classes<a class="headerlink" href="#about-races-and-classes" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>Knave</em> doesn’t have any D&D-style <em>classes</em> (like Thief, Fighter etc). It also does not bother with
|
||||
<em>races</em> (like dwarves, elves etc). This makes the tutorial shorter, but you may ask yourself how you’d
|
||||
add these functions.</p>
|
||||
|
|
@ -481,7 +481,7 @@ an Attribute on your Character:</p>
|
|||
<a class="reference internal" href="Beginner-Tutorial-Chargen.html"><span class="doc std std-doc">character generation</span></a> to check and include what these classes mean.</p>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">3.7. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p>With the <code class="docutils literal notranslate"><span class="pre">EvAdventureCharacter</span></code> class in place, we have a better understanding of how our PCs will look
|
||||
like under <em>Knave</em>.</p>
|
||||
<p>For now, we only have bits and pieces and haven’t been testing this code in-game. But if you want
|
||||
|
|
@ -521,16 +521,16 @@ then on.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Objects.html" title="In-game Objects and items"
|
||||
<a href="Beginner-Tutorial-Objects.html" title="4. In-game Objects and items"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rules.html" title="Rules and dice rolling"
|
||||
<a href="Beginner-Tutorial-Rules.html" title="2. Rules and dice rolling"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Player Characters</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">3. </span>Player Characters</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Character Generation — Evennia 1.0-dev documentation</title>
|
||||
<title>6. Character Generation — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="In-game Rooms" href="Beginner-Tutorial-Rooms.html" />
|
||||
<link rel="prev" title="Handling Equipment" href="Beginner-Tutorial-Equipment.html" />
|
||||
<link rel="next" title="7. In-game Rooms" href="Beginner-Tutorial-Rooms.html" />
|
||||
<link rel="prev" title="5. Handling Equipment" href="Beginner-Tutorial-Equipment.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="In-game Rooms"
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="7. In-game Rooms"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="Handling Equipment"
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="5. Handling Equipment"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Character Generation</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">6. </span>Character Generation</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,31 +64,31 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Character Generation</a><ul>
|
||||
<li><a class="reference internal" href="#how-it-will-work">How it will work</a></li>
|
||||
<li><a class="reference internal" href="#random-tables">Random tables</a></li>
|
||||
<li><a class="reference internal" href="#storing-state-of-the-menu">Storing state of the menu</a><ul>
|
||||
<li><a class="reference internal" href="#showing-the-sheet">Showing the sheet</a></li>
|
||||
<li><a class="reference internal" href="#apply-character">Apply character</a></li>
|
||||
<li><a class="reference internal" href="#">6. Character Generation</a><ul>
|
||||
<li><a class="reference internal" href="#how-it-will-work">6.1. How it will work</a></li>
|
||||
<li><a class="reference internal" href="#random-tables">6.2. Random tables</a></li>
|
||||
<li><a class="reference internal" href="#storing-state-of-the-menu">6.3. Storing state of the menu</a><ul>
|
||||
<li><a class="reference internal" href="#showing-the-sheet">6.3.1. Showing the sheet</a></li>
|
||||
<li><a class="reference internal" href="#apply-character">6.3.2. Apply character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#initializing-evmenu">Initializing EvMenu</a></li>
|
||||
<li><a class="reference internal" href="#main-node-choosing-what-to-do">Main Node: Choosing what to do</a></li>
|
||||
<li><a class="reference internal" href="#node-changing-your-name">Node: Changing your name</a></li>
|
||||
<li><a class="reference internal" href="#node-swapping-abilities-around">Node: Swapping Abilities around</a></li>
|
||||
<li><a class="reference internal" href="#node-creating-the-character">Node: Creating the Character</a></li>
|
||||
<li><a class="reference internal" href="#tying-the-nodes-together">Tying the nodes together</a></li>
|
||||
<li><a class="reference internal" href="#conclusions">Conclusions</a></li>
|
||||
<li><a class="reference internal" href="#initializing-evmenu">6.4. Initializing EvMenu</a></li>
|
||||
<li><a class="reference internal" href="#main-node-choosing-what-to-do">6.5. Main Node: Choosing what to do</a></li>
|
||||
<li><a class="reference internal" href="#node-changing-your-name">6.6. Node: Changing your name</a></li>
|
||||
<li><a class="reference internal" href="#node-swapping-abilities-around">6.7. Node: Swapping Abilities around</a></li>
|
||||
<li><a class="reference internal" href="#node-creating-the-character">6.8. Node: Creating the Character</a></li>
|
||||
<li><a class="reference internal" href="#tying-the-nodes-together">6.9. Tying the nodes together</a></li>
|
||||
<li><a class="reference internal" href="#conclusions">6.10. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Equipment.html"
|
||||
title="previous chapter">Handling Equipment</a></p>
|
||||
title="previous chapter"><span class="section-number">5. </span>Handling Equipment</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Rooms.html"
|
||||
title="next chapter">In-game Rooms</a></p>
|
||||
title="next chapter"><span class="section-number">7. </span>In-game Rooms</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -120,11 +120,11 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="character-generation">
|
||||
<h1>Character Generation<a class="headerlink" href="#character-generation" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">6. </span>Character Generation<a class="headerlink" href="#character-generation" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In previous lessons we have established how a character looks. Now we need to give the player a
|
||||
chance to create one.</p>
|
||||
<section id="how-it-will-work">
|
||||
<h2>How it will work<a class="headerlink" href="#how-it-will-work" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.1. </span>How it will work<a class="headerlink" href="#how-it-will-work" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A fresh Evennia install will automatically create a new Character with the same name as your
|
||||
Account when you log in. This is quick and simple and mimics older MUD styles. You could picture
|
||||
doing this, and then customizing the Character in-place.</p>
|
||||
|
|
@ -199,7 +199,7 @@ and you’ll leave the menu;</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="random-tables">
|
||||
<h2>Random tables<a class="headerlink" href="#random-tables" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.2. </span>Random tables<a class="headerlink" href="#random-tables" title="Permalink to this headline">¶</a></h2>
|
||||
<aside class="sidebar">
|
||||
<p>Full Knave random tables are found in
|
||||
<a class="reference internal" href="../../../api/evennia.contrib.tutorials.evadventure.random_tables.html"><span class="doc std std-doc">evennia/contrib/tutorials/evadventure/random_tables.py</span></a>.</p>
|
||||
|
|
@ -230,7 +230,7 @@ from the <em>Knave</em> rulebook. While we added the ability to roll on a random
|
|||
keep in here.</p>
|
||||
</section>
|
||||
<section id="storing-state-of-the-menu">
|
||||
<h2>Storing state of the menu<a class="headerlink" href="#storing-state-of-the-menu" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.3. </span>Storing state of the menu<a class="headerlink" href="#storing-state-of-the-menu" title="Permalink to this headline">¶</a></h2>
|
||||
<aside class="sidebar">
|
||||
<p>There is a full implementation of the chargen in
|
||||
<a class="reference internal" href="../../../api/evennia.contrib.tutorials.evadventure.chargen.html"><span class="doc std std-doc">evennia/contrib/tutorials/evadventure/chargen.py</span></a>.</p>
|
||||
|
|
@ -317,7 +317,7 @@ you can pick whatever you like).</p>
|
|||
<p>We also initialize <code class="docutils literal notranslate"><span class="pre">.ability_changes</span> <span class="pre">=</span> <span class="pre">0</span></code>. Knave only allows us to swap the values of two
|
||||
Abilities <em>once</em>. We will use this to know if it has been done or not.</p>
|
||||
<section id="showing-the-sheet">
|
||||
<h3>Showing the sheet<a class="headerlink" href="#showing-the-sheet" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">6.3.1. </span>Showing the sheet<a class="headerlink" href="#showing-the-sheet" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Now that we have our temporary character sheet, we should make it easy to visualize it.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py </span>
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ form. Making a ‘template’ string like <code class="docutils literal notransl
|
|||
to change how things look.</p>
|
||||
</section>
|
||||
<section id="apply-character">
|
||||
<h3>Apply character<a class="headerlink" href="#apply-character" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">6.3.2. </span>Apply character<a class="headerlink" href="#apply-character" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Once we are happy with our character, we need to actually create it with the stats we chose.
|
||||
This is a bit more involved.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py </span>
|
||||
|
|
@ -437,7 +437,7 @@ created in the <a class="reference internal" href="Beginner-Tutorial-Equipment.h
|
|||
</section>
|
||||
</section>
|
||||
<section id="initializing-evmenu">
|
||||
<h2>Initializing EvMenu<a class="headerlink" href="#initializing-evmenu" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.4. </span>Initializing EvMenu<a class="headerlink" href="#initializing-evmenu" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Evennia comes with a full menu-generation system based on <a class="reference internal" href="../../../Components/Command-Sets.html"><span class="doc std std-doc">Command sets</span></a>, called
|
||||
<a class="reference internal" href="../../../Components/EvMenu.html"><span class="doc std std-doc">EvMenu</span></a>.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py</span>
|
||||
|
|
@ -478,7 +478,7 @@ feed all this into <code class="docutils literal notranslate"><span class="pre">
|
|||
between.</p>
|
||||
</section>
|
||||
<section id="main-node-choosing-what-to-do">
|
||||
<h2>Main Node: Choosing what to do<a class="headerlink" href="#main-node-choosing-what-to-do" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.5. </span>Main Node: Choosing what to do<a class="headerlink" href="#main-node-choosing-what-to-do" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This is the first menu node. It will act as a central hub, from which one can choose different
|
||||
actions.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py </span>
|
||||
|
|
@ -550,7 +550,7 @@ to each node, since that contains our temporary character sheet.</p>
|
|||
know this, we check the <code class="docutils literal notranslate"><span class="pre">.ability_changes</span></code> property to make sure it’s still 0.</p>
|
||||
</section>
|
||||
<section id="node-changing-your-name">
|
||||
<h2>Node: Changing your name<a class="headerlink" href="#node-changing-your-name" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.6. </span>Node: Changing your name<a class="headerlink" href="#node-changing-your-name" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This is where you end up if you opted to change your name in <code class="docutils literal notranslate"><span class="pre">node_chargen</span></code>.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py</span>
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ were at.</p>
|
|||
</div></blockquote>
|
||||
</section>
|
||||
<section id="node-swapping-abilities-around">
|
||||
<h2>Node: Swapping Abilities around<a class="headerlink" href="#node-swapping-abilities-around" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.7. </span>Node: Swapping Abilities around<a class="headerlink" href="#node-swapping-abilities-around" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You get here by selecting the second option from the <code class="docutils literal notranslate"><span class="pre">node_chargen</span></code> node.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/chargen.py </span>
|
||||
|
||||
|
|
@ -708,7 +708,7 @@ node.</p>
|
|||
<p>Finally, we return to <code class="docutils literal notranslate"><span class="pre">node_chargen</span></code> again.</p>
|
||||
</section>
|
||||
<section id="node-creating-the-character">
|
||||
<h2>Node: Creating the Character<a class="headerlink" href="#node-creating-the-character" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.8. </span>Node: Creating the Character<a class="headerlink" href="#node-creating-the-character" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We get here from the main node by opting to finish chargen.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">node_apply_character</span><span class="p">(</span><span class="n">caller</span><span class="p">,</span> <span class="n">raw_string</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="sd">""" </span>
|
||||
|
|
@ -733,7 +733,7 @@ found on that screen are the ones listed in the <code class="docutils literal no
|
|||
also the new character to it.</p>
|
||||
</section>
|
||||
<section id="tying-the-nodes-together">
|
||||
<h2>Tying the nodes together<a class="headerlink" href="#tying-the-nodes-together" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.9. </span>Tying the nodes together<a class="headerlink" href="#tying-the-nodes-together" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">start_chargen</span><span class="p">(</span><span class="n">caller</span><span class="p">,</span> <span class="n">session</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd">This is a start point for spinning up the chargen from a command later.</span>
|
||||
|
|
@ -763,7 +763,7 @@ should use to point to nodes from inside the menu (and we did).</p>
|
|||
to first jump into that node when the menu is starting up.</p>
|
||||
</section>
|
||||
<section id="conclusions">
|
||||
<h2>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">6.10. </span>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This lesson taught us how to use <code class="docutils literal notranslate"><span class="pre">EvMenu</span></code> to make an interactive character generator. In an RPG
|
||||
more complex than <em>Knave</em>, the menu would be bigger and more intricate, but the same principles
|
||||
apply.</p>
|
||||
|
|
@ -789,16 +789,16 @@ characters - how they store their stats, handle their equipment and how to creat
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="In-game Rooms"
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="7. In-game Rooms"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="Handling Equipment"
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="5. Handling Equipment"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Character Generation</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">6. </span>Character Generation</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>In-game Commands — Evennia 1.0-dev documentation</title>
|
||||
<title>12. In-game Commands — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Part 4: Using what we created" href="../Part4/Beginner-Tutorial-Part4-Intro.html" />
|
||||
<link rel="prev" title="Dynamically generated Dungeon" href="Beginner-Tutorial-Dungeon.html" />
|
||||
<link rel="prev" title="11. Dynamically generated Dungeon" href="Beginner-Tutorial-Dungeon.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -33,13 +33,13 @@
|
|||
<a href="../Part4/Beginner-Tutorial-Part4-Intro.html" title="Part 4: Using what we created"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="Dynamically generated Dungeon"
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="11. Dynamically generated Dungeon"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Commands</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">12. </span>In-game Commands</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Dungeon.html"
|
||||
title="previous chapter">Dynamically generated Dungeon</a></p>
|
||||
title="previous chapter"><span class="section-number">11. </span>Dynamically generated Dungeon</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../Part4/Beginner-Tutorial-Part4-Intro.html"
|
||||
title="next chapter">Part 4: Using what we created</a></p>
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="in-game-commands">
|
||||
<h1>In-game Commands<a class="headerlink" href="#in-game-commands" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">12. </span>In-game Commands<a class="headerlink" href="#in-game-commands" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -125,13 +125,13 @@
|
|||
<a href="../Part4/Beginner-Tutorial-Part4-Intro.html" title="Part 4: Using what we created"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="Dynamically generated Dungeon"
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="11. Dynamically generated Dungeon"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Commands</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">12. </span>In-game Commands</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Dynamically generated Dungeon — Evennia 1.0-dev documentation</title>
|
||||
<title>11. Dynamically generated Dungeon — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="In-game Commands" href="Beginner-Tutorial-Commands.html" />
|
||||
<link rel="prev" title="In-game Shops" href="Beginner-Tutorial-Shops.html" />
|
||||
<link rel="next" title="12. In-game Commands" href="Beginner-Tutorial-Commands.html" />
|
||||
<link rel="prev" title="10. In-game Shops" href="Beginner-Tutorial-Shops.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Commands.html" title="In-game Commands"
|
||||
<a href="Beginner-Tutorial-Commands.html" title="12. In-game Commands"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Shops.html" title="In-game Shops"
|
||||
<a href="Beginner-Tutorial-Shops.html" title="10. In-game Shops"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Dynamically generated Dungeon</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">11. </span>Dynamically generated Dungeon</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Shops.html"
|
||||
title="previous chapter">In-game Shops</a></p>
|
||||
title="previous chapter"><span class="section-number">10. </span>In-game Shops</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Commands.html"
|
||||
title="next chapter">In-game Commands</a></p>
|
||||
title="next chapter"><span class="section-number">12. </span>In-game Commands</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="dynamically-generated-dungeon">
|
||||
<h1>Dynamically generated Dungeon<a class="headerlink" href="#dynamically-generated-dungeon" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">11. </span>Dynamically generated Dungeon<a class="headerlink" href="#dynamically-generated-dungeon" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -122,16 +122,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Commands.html" title="In-game Commands"
|
||||
<a href="Beginner-Tutorial-Commands.html" title="12. In-game Commands"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Shops.html" title="In-game Shops"
|
||||
<a href="Beginner-Tutorial-Shops.html" title="10. In-game Shops"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Dynamically generated Dungeon</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">11. </span>Dynamically generated Dungeon</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Handling Equipment — Evennia 1.0-dev documentation</title>
|
||||
<title>5. Handling Equipment — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Character Generation" href="Beginner-Tutorial-Chargen.html" />
|
||||
<link rel="prev" title="In-game Objects and items" href="Beginner-Tutorial-Objects.html" />
|
||||
<link rel="next" title="6. Character Generation" href="Beginner-Tutorial-Chargen.html" />
|
||||
<link rel="prev" title="4. In-game Objects and items" href="Beginner-Tutorial-Objects.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="Character Generation"
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="6. Character Generation"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Objects.html" title="In-game Objects and items"
|
||||
<a href="Beginner-Tutorial-Objects.html" title="4. In-game Objects and items"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Handling Equipment</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">5. </span>Handling Equipment</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,33 +64,33 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Handling Equipment</a><ul>
|
||||
<li><a class="reference internal" href="#equipmenthandler-that-saves">EquipmentHandler that saves</a></li>
|
||||
<li><a class="reference internal" href="#connecting-the-equipmenthandler">Connecting the EquipmentHandler</a></li>
|
||||
<li><a class="reference internal" href="#expanding-the-equipmenthandler">Expanding the Equipmenthandler</a></li>
|
||||
<li><a class="reference internal" href="#validate-slot-usage"><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li><a class="reference internal" href="#max-slots"><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li><a class="reference internal" href="#count-slots"><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li><a class="reference internal" href="#validating-slots">Validating slots</a></li>
|
||||
<li><a class="reference internal" href="#">5. Handling Equipment</a><ul>
|
||||
<li><a class="reference internal" href="#equipmenthandler-that-saves">5.1. EquipmentHandler that saves</a></li>
|
||||
<li><a class="reference internal" href="#connecting-the-equipmenthandler">5.2. Connecting the EquipmentHandler</a></li>
|
||||
<li><a class="reference internal" href="#expanding-the-equipmenthandler">5.3. Expanding the Equipmenthandler</a></li>
|
||||
<li><a class="reference internal" href="#validate-slot-usage">5.4. <code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li><a class="reference internal" href="#max-slots">5.4.1. <code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li><a class="reference internal" href="#count-slots">5.4.2. <code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li><a class="reference internal" href="#validating-slots">5.4.3. Validating slots</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#add-and-remove"><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li><a class="reference internal" href="#moving-things-around">Moving things around</a></li>
|
||||
<li><a class="reference internal" href="#get-everything">Get everything</a></li>
|
||||
<li><a class="reference internal" href="#weapon-and-armor">Weapon and armor</a></li>
|
||||
<li><a class="reference internal" href="#extra-credits">Extra credits</a></li>
|
||||
<li><a class="reference internal" href="#unit-testing">Unit Testing</a></li>
|
||||
<li><a class="reference internal" href="#summary">Summary</a></li>
|
||||
<li><a class="reference internal" href="#add-and-remove">5.5. <code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li><a class="reference internal" href="#moving-things-around">5.6. Moving things around</a></li>
|
||||
<li><a class="reference internal" href="#get-everything">5.7. Get everything</a></li>
|
||||
<li><a class="reference internal" href="#weapon-and-armor">5.8. Weapon and armor</a></li>
|
||||
<li><a class="reference internal" href="#extra-credits">5.9. Extra credits</a></li>
|
||||
<li><a class="reference internal" href="#unit-testing">5.10. Unit Testing</a></li>
|
||||
<li><a class="reference internal" href="#summary">5.11. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Objects.html"
|
||||
title="previous chapter">In-game Objects and items</a></p>
|
||||
title="previous chapter"><span class="section-number">4. </span>In-game Objects and items</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Chargen.html"
|
||||
title="next chapter">Character Generation</a></p>
|
||||
title="next chapter"><span class="section-number">6. </span>Character Generation</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="handling-equipment">
|
||||
<h1>Handling Equipment<a class="headerlink" href="#handling-equipment" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">5. </span>Handling Equipment<a class="headerlink" href="#handling-equipment" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In <em>Knave</em>, you have a certain number of inventory “slots”. The amount of slots is given by <code class="docutils literal notranslate"><span class="pre">CON</span> <span class="pre">+</span> <span class="pre">10</span></code>.
|
||||
All items (except coins) have a <code class="docutils literal notranslate"><span class="pre">size</span></code>, indicating how many slots it uses. You can’t carry more items
|
||||
than you have slot-space for. Also items wielded or worn count towards the slots.</p>
|
||||
|
|
@ -147,7 +147,7 @@ they can do. The shield, helmet and armor they use affects their defense.</p>
|
|||
<p>Basically, all the weapon/armor locations are exclusive - you can only have one item in each (or none).
|
||||
The BACKPACK is special - it contains any number of items (up to the maximum slot usage).</p>
|
||||
<section id="equipmenthandler-that-saves">
|
||||
<h2>EquipmentHandler that saves<a class="headerlink" href="#equipmenthandler-that-saves" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.1. </span>EquipmentHandler that saves<a class="headerlink" href="#equipmenthandler-that-saves" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/equipment.py</span></code>.</p>
|
||||
</div></blockquote>
|
||||
|
|
@ -233,7 +233,7 @@ other Attributes.</p>
|
|||
have one item except <code class="docutils literal notranslate"><span class="pre">WieldLocation.BACKPACK</span></code>, which is a list.</p>
|
||||
</section>
|
||||
<section id="connecting-the-equipmenthandler">
|
||||
<h2>Connecting the EquipmentHandler<a class="headerlink" href="#connecting-the-equipmenthandler" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.2. </span>Connecting the EquipmentHandler<a class="headerlink" href="#connecting-the-equipmenthandler" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Whenever an object leaves from one location to the next, Evennia will call a set of <em>hooks</em> (methods) on the
|
||||
object that moves, on the source-location and on its destination. This is the same for all moving things -
|
||||
whether it’s a character moving between rooms or an item being dropping from your hand to the ground.</p>
|
||||
|
|
@ -297,10 +297,10 @@ we will skip that for this tutorial.</p>
|
|||
we can use this, we need to go actually adding those methods.</p>
|
||||
</section>
|
||||
<section id="expanding-the-equipmenthandler">
|
||||
<h2>Expanding the Equipmenthandler<a class="headerlink" href="#expanding-the-equipmenthandler" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.3. </span>Expanding the Equipmenthandler<a class="headerlink" href="#expanding-the-equipmenthandler" title="Permalink to this headline">¶</a></h2>
|
||||
</section>
|
||||
<section id="validate-slot-usage">
|
||||
<h2><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code><a class="headerlink" href="#validate-slot-usage" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.4. </span><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code><a class="headerlink" href="#validate-slot-usage" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Let’s start with implementing the first method we came up with above, <code class="docutils literal notranslate"><span class="pre">validate_slot_usage</span></code>:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/equipment.py </span>
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ little less to type.</p>
|
|||
<p>We add two helpers - the <code class="docutils literal notranslate"><span class="pre">max_slots</span></code> <em>property</em> and <code class="docutils literal notranslate"><span class="pre">count_slots</span></code>, a method that calculate the current
|
||||
slots being in use. Let’s figure out how they work.</p>
|
||||
<section id="max-slots">
|
||||
<h3><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code><a class="headerlink" href="#max-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">5.4.1. </span><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code><a class="headerlink" href="#max-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<p>For <code class="docutils literal notranslate"><span class="pre">max_slots</span></code>, remember that <code class="docutils literal notranslate"><span class="pre">.obj</span></code> on the handler is a back-reference to the <code class="docutils literal notranslate"><span class="pre">EvAdventureCharacter</span></code> we
|
||||
put this handler on. <code class="docutils literal notranslate"><span class="pre">getattr</span></code> is a Python method for retrieving a named property on an object.
|
||||
The <code class="docutils literal notranslate"><span class="pre">Enum</span></code> <code class="docutils literal notranslate"><span class="pre">Ability.CON.value</span></code> is the string <code class="docutils literal notranslate"><span class="pre">Constitution</span></code> (check out the
|
||||
|
|
@ -378,7 +378,7 @@ should happen to <em>not</em> be a property “Constitution” on <code class="d
|
|||
return 1.</p>
|
||||
</section>
|
||||
<section id="count-slots">
|
||||
<h3><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code><a class="headerlink" href="#count-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">5.4.2. </span><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code><a class="headerlink" href="#count-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<p>In this helper we use two Python tools - the <code class="docutils literal notranslate"><span class="pre">sum()</span></code> function and a
|
||||
<a class="reference external" href="https://www.w3schools.com/python/python_lists_comprehension.asp">list comprehension</a>. The former
|
||||
simply adds the values of any iterable together. The latter is a more efficient way to create a list:</p>
|
||||
|
|
@ -416,14 +416,14 @@ sizes”.</p>
|
|||
together.</p>
|
||||
</section>
|
||||
<section id="validating-slots">
|
||||
<h3>Validating slots<a class="headerlink" href="#validating-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">5.4.3. </span>Validating slots<a class="headerlink" href="#validating-slots" title="Permalink to this headline">¶</a></h3>
|
||||
<p>With these helpers in place, <code class="docutils literal notranslate"><span class="pre">validate_slot_usage</span></code> now becomes simple. We use <code class="docutils literal notranslate"><span class="pre">max_slots</span></code> to see how much we can carry.
|
||||
We then get how many slots we are already using (with <code class="docutils literal notranslate"><span class="pre">count_slots</span></code>) and see if our new <code class="docutils literal notranslate"><span class="pre">obj</span></code>’s size
|
||||
would be too much for us.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section id="add-and-remove">
|
||||
<h2><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code><a class="headerlink" href="#add-and-remove" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.5. </span><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code><a class="headerlink" href="#add-and-remove" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We will make it so <code class="docutils literal notranslate"><span class="pre">.add</span></code> puts something in the <code class="docutils literal notranslate"><span class="pre">BACKPACK</span></code> location and <code class="docutils literal notranslate"><span class="pre">remove</span></code> drops it, wherever
|
||||
it is (even if it was in your hands).</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/equipment.py </span>
|
||||
|
|
@ -472,7 +472,7 @@ return all items.</p>
|
|||
be lost after a server reload.</p>
|
||||
</section>
|
||||
<section id="moving-things-around">
|
||||
<h2>Moving things around<a class="headerlink" href="#moving-things-around" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.6. </span>Moving things around<a class="headerlink" href="#moving-things-around" title="Permalink to this headline">¶</a></h2>
|
||||
<p>With the help of <code class="docutils literal notranslate"><span class="pre">.remove()</span></code> and <code class="docutils literal notranslate"><span class="pre">.add()</span></code> we can get things in and out of the <code class="docutils literal notranslate"><span class="pre">BACKPACK</span></code> equipment
|
||||
location. We also need to grab stuff from the backpack and wield or wear it. We add a <code class="docutils literal notranslate"><span class="pre">.move</span></code> method
|
||||
on the <code class="docutils literal notranslate"><span class="pre">EquipmentHandler</span></code> to do this:</p>
|
||||
|
|
@ -527,7 +527,7 @@ it goes. So we just need to move the object to that slot, replacing whatever is
|
|||
from before. Anything we replace goes back to the backpack.</p>
|
||||
</section>
|
||||
<section id="get-everything">
|
||||
<h2>Get everything<a class="headerlink" href="#get-everything" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.7. </span>Get everything<a class="headerlink" href="#get-everything" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In order to visualize our inventory, we need some method to get everything we are carrying.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/equipment.py </span>
|
||||
|
||||
|
|
@ -558,7 +558,7 @@ from before. Anything we replace goes back to the backpack.</p>
|
|||
<code class="docutils literal notranslate"><span class="pre">[(item,</span> <span class="pre">WieldLocation),</span> <span class="pre">...]</span></code>. This is convenient for display.</p>
|
||||
</section>
|
||||
<section id="weapon-and-armor">
|
||||
<h2>Weapon and armor<a class="headerlink" href="#weapon-and-armor" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.8. </span>Weapon and armor<a class="headerlink" href="#weapon-and-armor" title="Permalink to this headline">¶</a></h2>
|
||||
<p>It’s convenient to have the <code class="docutils literal notranslate"><span class="pre">EquipmentHandler</span></code> easily tell you what weapon is currently wielded
|
||||
and what <em>armor</em> level all worn equipment provides. Otherwise you’d need to figure out what item is
|
||||
in which wield-slot and to add up armor slots manually every time you need to know.</p>
|
||||
|
|
@ -609,7 +609,7 @@ object that represents your bare hands with damage and all.
|
|||
(created in <a class="reference internal" href="Beginner-Tutorial-Objects.html#your-bare-hands"><span class="std std-doc">The Object tutorial</span></a> earlier).</p>
|
||||
</section>
|
||||
<section id="extra-credits">
|
||||
<h2>Extra credits<a class="headerlink" href="#extra-credits" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.9. </span>Extra credits<a class="headerlink" href="#extra-credits" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This covers the basic functionality of the equipment handler. There are other useful methods that
|
||||
can be added:</p>
|
||||
<ul class="simple">
|
||||
|
|
@ -623,7 +623,7 @@ can be added:</p>
|
|||
<a class="reference internal" href="../../../api/evennia.contrib.tutorials.evadventure.equipment.html"><span class="doc std std-doc">evennia/contrib/tutorials/evadventure/equipment.py</span></a>.</p>
|
||||
</section>
|
||||
<section id="unit-testing">
|
||||
<h2>Unit Testing<a class="headerlink" href="#unit-testing" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.10. </span>Unit Testing<a class="headerlink" href="#unit-testing" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/tests/test_equipment.py</span></code>.</p>
|
||||
</div></blockquote>
|
||||
|
|
@ -663,7 +663,7 @@ passing these into the handler’s methods.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">5.11. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>Handlers</em> are useful for grouping functionality together. Now that we spent our time making the
|
||||
<code class="docutils literal notranslate"><span class="pre">EquipmentHandler</span></code>, we shouldn’t need to worry about item-slots anymore - the handler ‘handles’ all
|
||||
the details for us. As long as we call its methods, the details can be forgotten about.</p>
|
||||
|
|
@ -689,16 +689,16 @@ generation - where players get to make their own character!</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="Character Generation"
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="6. Character Generation"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Objects.html" title="In-game Objects and items"
|
||||
<a href="Beginner-Tutorial-Objects.html" title="4. In-game Objects and items"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Handling Equipment</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">5. </span>Handling Equipment</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Non-Player-Characters (NPCs) — Evennia 1.0-dev documentation</title>
|
||||
<title>8. Non-Player-Characters (NPCs) — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Game Quests" href="Beginner-Tutorial-Quests.html" />
|
||||
<link rel="prev" title="In-game Rooms" href="Beginner-Tutorial-Rooms.html" />
|
||||
<link rel="next" title="9. Game Quests" href="Beginner-Tutorial-Quests.html" />
|
||||
<link rel="prev" title="7. In-game Rooms" href="Beginner-Tutorial-Rooms.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Quests.html" title="Game Quests"
|
||||
<a href="Beginner-Tutorial-Quests.html" title="9. Game Quests"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="In-game Rooms"
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="7. In-game Rooms"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">8. </span>Non-Player-Characters (NPCs)</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Rooms.html"
|
||||
title="previous chapter">In-game Rooms</a></p>
|
||||
title="previous chapter"><span class="section-number">7. </span>In-game Rooms</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Quests.html"
|
||||
title="next chapter">Game Quests</a></p>
|
||||
title="next chapter"><span class="section-number">9. </span>Game Quests</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="non-player-characters-npcs">
|
||||
<h1>Non-Player-Characters (NPCs)<a class="headerlink" href="#non-player-characters-npcs" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">8. </span>Non-Player-Characters (NPCs)<a class="headerlink" href="#non-player-characters-npcs" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -122,16 +122,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Quests.html" title="Game Quests"
|
||||
<a href="Beginner-Tutorial-Quests.html" title="9. Game Quests"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="In-game Rooms"
|
||||
<a href="Beginner-Tutorial-Rooms.html" title="7. In-game Rooms"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">8. </span>Non-Player-Characters (NPCs)</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>In-game Objects and items — Evennia 1.0-dev documentation</title>
|
||||
<title>4. In-game Objects and items — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Handling Equipment" href="Beginner-Tutorial-Equipment.html" />
|
||||
<link rel="prev" title="Player Characters" href="Beginner-Tutorial-Characters.html" />
|
||||
<link rel="next" title="5. Handling Equipment" href="Beginner-Tutorial-Equipment.html" />
|
||||
<link rel="prev" title="3. Player Characters" href="Beginner-Tutorial-Characters.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="Handling Equipment"
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="5. Handling Equipment"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Characters.html" title="Player Characters"
|
||||
<a href="Beginner-Tutorial-Characters.html" title="3. Player Characters"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Objects and items</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">4. </span>In-game Objects and items</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,30 +64,30 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">In-game Objects and items</a><ul>
|
||||
<li><a class="reference internal" href="#new-enums">New Enums</a></li>
|
||||
<li><a class="reference internal" href="#the-base-object">The base object</a><ul>
|
||||
<li><a class="reference internal" href="#using-attributes-or-not">Using Attributes or not</a></li>
|
||||
<li><a class="reference internal" href="#creating-tags-in-at-object-creation">Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
<li><a class="reference internal" href="#">4. In-game Objects and items</a><ul>
|
||||
<li><a class="reference internal" href="#new-enums">4.1. New Enums</a></li>
|
||||
<li><a class="reference internal" href="#the-base-object">4.2. The base object</a><ul>
|
||||
<li><a class="reference internal" href="#using-attributes-or-not">4.2.1. Using Attributes or not</a></li>
|
||||
<li><a class="reference internal" href="#creating-tags-in-at-object-creation">4.2.2. Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#other-object-types">Other object types</a></li>
|
||||
<li><a class="reference internal" href="#consumables">Consumables</a></li>
|
||||
<li><a class="reference internal" href="#weapons">Weapons</a></li>
|
||||
<li><a class="reference internal" href="#magic">Magic</a></li>
|
||||
<li><a class="reference internal" href="#armor">Armor</a></li>
|
||||
<li><a class="reference internal" href="#your-bare-hands">Your Bare hands</a></li>
|
||||
<li><a class="reference internal" href="#testing-and-extra-credits">Testing and Extra credits</a></li>
|
||||
<li><a class="reference internal" href="#other-object-types">4.3. Other object types</a></li>
|
||||
<li><a class="reference internal" href="#consumables">4.4. Consumables</a></li>
|
||||
<li><a class="reference internal" href="#weapons">4.5. Weapons</a></li>
|
||||
<li><a class="reference internal" href="#magic">4.6. Magic</a></li>
|
||||
<li><a class="reference internal" href="#armor">4.7. Armor</a></li>
|
||||
<li><a class="reference internal" href="#your-bare-hands">4.8. Your Bare hands</a></li>
|
||||
<li><a class="reference internal" href="#testing-and-extra-credits">4.9. Testing and Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Characters.html"
|
||||
title="previous chapter">Player Characters</a></p>
|
||||
title="previous chapter"><span class="section-number">3. </span>Player Characters</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Equipment.html"
|
||||
title="next chapter">Handling Equipment</a></p>
|
||||
title="next chapter"><span class="section-number">5. </span>Handling Equipment</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="in-game-objects-and-items">
|
||||
<h1>In-game Objects and items<a class="headerlink" href="#in-game-objects-and-items" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">4. </span>In-game Objects and items<a class="headerlink" href="#in-game-objects-and-items" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In the previous lesson we established what a ‘Character’ is in our game. Before we continue
|
||||
we also need to have a notion what an ‘item’ or ‘object’ is.</p>
|
||||
<p>Looking at <em>Knave</em>’s item lists, we can get some ideas of what we need to track:</p>
|
||||
|
|
@ -132,7 +132,7 @@ only belong in the backpack.</p></li>
|
|||
<li><p><code class="docutils literal notranslate"><span class="pre">obj_type</span></code> - Which ‘type’ of item this is.</p></li>
|
||||
</ul>
|
||||
<section id="new-enums">
|
||||
<h2>New Enums<a class="headerlink" href="#new-enums" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.1. </span>New Enums<a class="headerlink" href="#new-enums" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We added a few enumberations for Abilities back in the <a class="reference internal" href="Beginner-Tutorial-Utilities.html"><span class="doc std std-doc">Utilities tutorial</span></a>.
|
||||
Before we continue, let’s expand with enums for use-slots and object types.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/enums.py</span>
|
||||
|
|
@ -164,7 +164,7 @@ Before we continue, let’s expand with enums for use-slots and object types.</p
|
|||
<p>Once we have these enums, we will use them for referencing things.</p>
|
||||
</section>
|
||||
<section id="the-base-object">
|
||||
<h2>The base object<a class="headerlink" href="#the-base-object" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.2. </span>The base object<a class="headerlink" href="#the-base-object" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/objects.py</span></code></p>
|
||||
</div></blockquote>
|
||||
|
|
@ -209,7 +209,7 @@ child classes to represent the relevant types:</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<section id="using-attributes-or-not">
|
||||
<h3>Using Attributes or not<a class="headerlink" href="#using-attributes-or-not" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">4.2.1. </span>Using Attributes or not<a class="headerlink" href="#using-attributes-or-not" title="Permalink to this headline">¶</a></h3>
|
||||
<p>In theory, <code class="docutils literal notranslate"><span class="pre">size</span></code> and <code class="docutils literal notranslate"><span class="pre">value</span></code> does not change and <em>could</em> also be just set as a regular Python
|
||||
property on the class:</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">EvAdventureObject</span><span class="p">(</span><span class="n">DefaultObject</span><span class="p">):</span>
|
||||
|
|
@ -237,7 +237,7 @@ the database for all objects with <code class="docutils literal notranslate"><sp
|
|||
all objects of a particular size. So we should be safe.</p>
|
||||
</section>
|
||||
<section id="creating-tags-in-at-object-creation">
|
||||
<h3>Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code><a class="headerlink" href="#creating-tags-in-at-object-creation" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">4.2.2. </span>Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code><a class="headerlink" href="#creating-tags-in-at-object-creation" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code> is a method Evennia calls on every child of <code class="docutils literal notranslate"><span class="pre">DefaultObject</span></code> whenever it is
|
||||
first created.</p>
|
||||
<p>We do a tricky thing here, converting our <code class="docutils literal notranslate"><span class="pre">.obj_type</span></code> to one or more <a class="reference internal" href="../../../Components/Tags.html"><span class="doc std std-doc">Tags</span></a>. Tagging the
|
||||
|
|
@ -256,7 +256,7 @@ is also Magical, for example.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="other-object-types">
|
||||
<h2>Other object types<a class="headerlink" href="#other-object-types" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.3. </span>Other object types<a class="headerlink" href="#other-object-types" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Some of the other object types are very simple so far.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/objects.py </span>
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ is also Magical, for example.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="consumables">
|
||||
<h2>Consumables<a class="headerlink" href="#consumables" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.4. </span>Consumables<a class="headerlink" href="#consumables" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A ‘consumable’ is an item that has a certain number of ‘uses’. Once fully consumed, it can’t be used
|
||||
anymore. An example would be a health potion.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/objects.py </span>
|
||||
|
|
@ -315,7 +315,7 @@ anymore. An example would be a health potion.</p>
|
|||
later, overriding <code class="docutils literal notranslate"><span class="pre">at_use</span></code> with different effects.</p>
|
||||
</section>
|
||||
<section id="weapons">
|
||||
<h2>Weapons<a class="headerlink" href="#weapons" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.5. </span>Weapons<a class="headerlink" href="#weapons" title="Permalink to this headline">¶</a></h2>
|
||||
<p>All weapons need properties that describe how efficient they are in battle.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># mygame/evadventure/objects.py </span>
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ a weapon’s quality will go down. When it reaches 0, it will break.</p>
|
|||
<p>The attack/defend type tracks how we resolve attacks with the weapon, like <code class="docutils literal notranslate"><span class="pre">roll</span> <span class="pre">+</span> <span class="pre">STR</span> <span class="pre">vs</span> <span class="pre">ARMOR</span> <span class="pre">+</span> <span class="pre">10</span></code>.</p>
|
||||
</section>
|
||||
<section id="magic">
|
||||
<h2>Magic<a class="headerlink" href="#magic" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.6. </span>Magic<a class="headerlink" href="#magic" title="Permalink to this headline">¶</a></h2>
|
||||
<p>In <em>Knave</em>, anyone can use magic if they are wielding a rune stone (our name for spell books) in both
|
||||
hands. You can only use a rune stone once per rest. So a rune stone is an example of a ‘magical weapon’
|
||||
that is also a ‘consumable’ of sorts.</p>
|
||||
|
|
@ -388,7 +388,7 @@ base class. Since magic in <em>Knave</em> tends to be pretty custom, it makes se
|
|||
of custom code.</p>
|
||||
</section>
|
||||
<section id="armor">
|
||||
<h2>Armor<a class="headerlink" href="#armor" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.7. </span>Armor<a class="headerlink" href="#armor" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Armor, shields and helmets increase the <code class="docutils literal notranslate"><span class="pre">ARMOR</span></code> stat of the character. In <em>Knave</em>, what is stored is the
|
||||
defense value of the armor (values 11-20). We will instead store the ‘armor bonus’ (1-10). As we know,
|
||||
defending is always <code class="docutils literal notranslate"><span class="pre">bonus</span> <span class="pre">+</span> <span class="pre">10</span></code>, so the result will be the same - this means
|
||||
|
|
@ -418,7 +418,7 @@ we can use <code class="docutils literal notranslate"><span class="pre">Ability.
|
|||
</div>
|
||||
</section>
|
||||
<section id="your-bare-hands">
|
||||
<h2>Your Bare hands<a class="headerlink" href="#your-bare-hands" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.8. </span>Your Bare hands<a class="headerlink" href="#your-bare-hands" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This is a ‘dummy’ object that is not stored in the database. We will use this in the upcoming
|
||||
<a class="reference internal" href="Beginner-Tutorial-Equipment.html"><span class="doc std std-doc">Equipment tutorial lesson</span></a> to represent when you have ‘nothing’
|
||||
in your hands. This way we don’t need to add any special case for this.</p>
|
||||
|
|
@ -437,7 +437,7 @@ in your hands. This way we don’t need to add any special case for this.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="testing-and-extra-credits">
|
||||
<h2>Testing and Extra credits<a class="headerlink" href="#testing-and-extra-credits" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">4.9. </span>Testing and Extra credits<a class="headerlink" href="#testing-and-extra-credits" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Remember the <code class="docutils literal notranslate"><span class="pre">get_obj_stats</span></code> function from the <a class="reference internal" href="Beginner-Tutorial-Utilities.html"><span class="doc std std-doc">Utility Tutorial</span></a> earlier?
|
||||
We had to use dummy-values since we didn’t yet know how we would store properties on Objects in the game.</p>
|
||||
<p>Well, we just figured out all we need! You can go back and update <code class="docutils literal notranslate"><span class="pre">get_obj_stats</span></code> to properly read the data
|
||||
|
|
@ -465,16 +465,16 @@ to <code class="docutils literal notranslate"><span class="pre">get_obj_stats</s
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="Handling Equipment"
|
||||
<a href="Beginner-Tutorial-Equipment.html" title="5. Handling Equipment"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Characters.html" title="Player Characters"
|
||||
<a href="Beginner-Tutorial-Characters.html" title="3. Player Characters"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Objects and items</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">4. </span>In-game Objects and items</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Part 3: How we get there — Evennia 1.0-dev documentation</title>
|
||||
<title>Part 3: How we get there (example game) — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Code structure and Utilities" href="Beginner-Tutorial-Utilities.html" />
|
||||
<link rel="prev" title="Planning our tutorial game" href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" />
|
||||
<link rel="next" title="1. Code structure and Utilities" href="Beginner-Tutorial-Utilities.html" />
|
||||
<link rel="prev" title="3. Planning our tutorial game" href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,15 +30,15 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="Code structure and Utilities"
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="1. Code structure and Utilities"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
|
||||
<a href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="3. Planning our tutorial game"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" accesskey="U">Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Part 3: How we get there</a></li>
|
||||
<li class="nav-item nav-item-this"><a href="">Part 3: How we get there (example game)</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -63,19 +63,18 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Part 3: How we get there</a><ul>
|
||||
<li><a class="reference internal" href="#">Part 3: How we get there (example game)</a><ul>
|
||||
<li><a class="reference internal" href="#lessons">Lessons</a></li>
|
||||
<li><a class="reference internal" href="#table-of-contents">Table of Contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html"
|
||||
title="previous chapter">Planning our tutorial game</a></p>
|
||||
title="previous chapter"><span class="section-number">3. </span>Planning our tutorial game</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Utilities.html"
|
||||
title="next chapter">Code structure and Utilities</a></p>
|
||||
title="next chapter"><span class="section-number">1. </span>Code structure and Utilities</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -106,8 +105,8 @@
|
|||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="part-3-how-we-get-there">
|
||||
<h1>Part 3: How we get there<a class="headerlink" href="#part-3-how-we-get-there" title="Permalink to this headline">¶</a></h1>
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="part-3-how-we-get-there-example-game">
|
||||
<h1>Part 3: How we get there (example game)<a class="headerlink" href="#part-3-how-we-get-there-example-game" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>The tutorial game is under development and is not yet complete, nor tested. Use the existing
|
||||
|
|
@ -147,129 +146,77 @@ of experience using Evennia and be really helpful for doing your own thing later
|
|||
<h2>Lessons<a class="headerlink" href="#lessons" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Utilities.html">Code structure and Utilities</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rules.html">Rules and dice rolling</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Characters.html">Player Characters</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Objects.html">In-game Objects and items</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Equipment.html">Handling Equipment</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Chargen.html">Character Generation</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rooms.html">In-game Rooms</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-NPCs.html">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Quests.html">Game Quests</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Shops.html">In-game Shops</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Dungeon.html">Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Commands.html">In-game Commands</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="table-of-contents">
|
||||
<h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Utilities.html">Code structure and Utilities</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#folder-structure">Folder structure</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#enums">Enums</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#utility-module">Utility module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#running-your-test">Running your test</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Utilities.html">1. Code structure and Utilities</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#folder-structure">1.1. Folder structure</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#enums">1.2. Enums</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#utility-module">1.3. Utility module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#testing">1.4. Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#summary">1.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Utilities.html#summary">Summary</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rules.html">2. Rules and dice rolling</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#summary-of-knave-rules">2.1. Summary of <em>Knave</em> rules</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#making-a-rule-module">2.2. Making a rule module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#rolling-dice">2.3. Rolling dice</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#testing">2.4. Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#summary">2.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rules.html">Rules and dice rolling</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#summary-of-knave-rules">Summary of <em>Knave</em> rules</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#making-a-rule-module">Making a rule module</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#rolling-dice">Rolling dice</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#generic-dice-roller">Generic dice roller</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#rolling-with-advantage">Rolling with advantage</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#saving-throws">Saving throws</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#opposed-saving-throw">Opposed saving throw</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#morale-check">Morale check</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#roll-for-healing">Roll for Healing</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#rolling-on-a-table">Rolling on a table</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#roll-for-death">Roll for death</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Characters.html">3. Player Characters</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#inheritance-structure">3.1. Inheritance structure</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#living-mixin-class">3.2. Living mixin class</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#character-class">3.3. Character class</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#connecting-the-character-with-evennia">3.4. Connecting the Character with Evennia</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#unit-testing">3.5. Unit Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#about-races-and-classes">3.6. About races and classes</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#summary">3.7. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#testing">Testing</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Rules.html#mocking-and-patching">Mocking and patching</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Objects.html">4. In-game Objects and items</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#new-enums">4.1. New Enums</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#the-base-object">4.2. The base object</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#other-object-types">4.3. Other object types</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#consumables">4.4. Consumables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#weapons">4.5. Weapons</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#magic">4.6. Magic</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#armor">4.7. Armor</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#your-bare-hands">4.8. Your Bare hands</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#testing-and-extra-credits">4.9. Testing and Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Rules.html#summary">Summary</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Equipment.html">5. Handling Equipment</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#equipmenthandler-that-saves">5.1. EquipmentHandler that saves</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#connecting-the-equipmenthandler">5.2. Connecting the EquipmentHandler</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#expanding-the-equipmenthandler">5.3. Expanding the Equipmenthandler</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#validate-slot-usage">5.4. <code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#add-and-remove">5.5. <code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#moving-things-around">5.6. Moving things around</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#get-everything">5.7. Get everything</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#weapon-and-armor">5.8. Weapon and armor</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#extra-credits">5.9. Extra credits</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#unit-testing">5.10. Unit Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#summary">5.11. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Characters.html">Player Characters</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#inheritance-structure">Inheritance structure</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#living-mixin-class">Living mixin class</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#character-class">Character class</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Characters.html#funcparser-inlines">Funcparser inlines</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Characters.html#backtracking">Backtracking</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Chargen.html">6. Character Generation</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#how-it-will-work">6.1. How it will work</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#random-tables">6.2. Random tables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#storing-state-of-the-menu">6.3. Storing state of the menu</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#initializing-evmenu">6.4. Initializing EvMenu</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#main-node-choosing-what-to-do">6.5. Main Node: Choosing what to do</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-changing-your-name">6.6. Node: Changing your name</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-swapping-abilities-around">6.7. Node: Swapping Abilities around</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-creating-the-character">6.8. Node: Creating the Character</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#tying-the-nodes-together">6.9. Tying the nodes together</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#conclusions">6.10. Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#connecting-the-character-with-evennia">Connecting the Character with Evennia</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#about-races-and-classes">About races and classes</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Characters.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Objects.html">In-game Objects and items</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#new-enums">New Enums</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#the-base-object">The base object</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Objects.html#using-attributes-or-not">Using Attributes or not</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Objects.html#creating-tags-in-at-object-creation">Creating tags in <code class="docutils literal notranslate"><span class="pre">at_object_creation</span></code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#other-object-types">Other object types</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#consumables">Consumables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#weapons">Weapons</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#magic">Magic</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#armor">Armor</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#your-bare-hands">Your Bare hands</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Objects.html#testing-and-extra-credits">Testing and Extra credits</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Equipment.html">Handling Equipment</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#equipmenthandler-that-saves">EquipmentHandler that saves</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#connecting-the-equipmenthandler">Connecting the EquipmentHandler</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#expanding-the-equipmenthandler">Expanding the Equipmenthandler</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#validate-slot-usage"><code class="docutils literal notranslate"><span class="pre">.validate_slot_usage</span></code></a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#max-slots"><code class="docutils literal notranslate"><span class="pre">.max_slots</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#count-slots"><code class="docutils literal notranslate"><span class="pre">.count_slots</span></code></a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#validating-slots">Validating slots</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#add-and-remove"><code class="docutils literal notranslate"><span class="pre">.add</span></code> and <code class="docutils literal notranslate"><span class="pre">.remove</span></code></a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#moving-things-around">Moving things around</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#get-everything">Get everything</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#weapon-and-armor">Weapon and armor</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#extra-credits">Extra credits</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#unit-testing">Unit Testing</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Equipment.html#summary">Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Chargen.html">Character Generation</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#how-it-will-work">How it will work</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#random-tables">Random tables</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#storing-state-of-the-menu">Storing state of the menu</a><ul>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#showing-the-sheet">Showing the sheet</a></li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#apply-character">Apply character</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#initializing-evmenu">Initializing EvMenu</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#main-node-choosing-what-to-do">Main Node: Choosing what to do</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-changing-your-name">Node: Changing your name</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-swapping-abilities-around">Node: Swapping Abilities around</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#node-creating-the-character">Node: Creating the Character</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#tying-the-nodes-together">Tying the nodes together</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Beginner-Tutorial-Chargen.html#conclusions">Conclusions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rooms.html">In-game Rooms</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-NPCs.html">Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Quests.html">Game Quests</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Shops.html">In-game Shops</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Dungeon.html">Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Commands.html">In-game Commands</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Rooms.html">7. In-game Rooms</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-NPCs.html">8. Non-Player-Characters (NPCs)</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Quests.html">9. Game Quests</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Shops.html">10. In-game Shops</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Dungeon.html">11. Dynamically generated Dungeon</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Beginner-Tutorial-Commands.html">12. In-game Commands</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -291,15 +238,15 @@ of experience using Evennia and be really helpful for doing your own thing later
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="Code structure and Utilities"
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="1. Code structure and Utilities"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
|
||||
<a href="../Part2/Beginner-Tutorial-Planning-The-Tutorial-Game.html" title="3. Planning our tutorial game"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Part 3: How we get there</a></li>
|
||||
<li class="nav-item nav-item-this"><a href="">Part 3: How we get there (example game)</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Game Quests — Evennia 1.0-dev documentation</title>
|
||||
<title>9. Game Quests — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="In-game Shops" href="Beginner-Tutorial-Shops.html" />
|
||||
<link rel="prev" title="Non-Player-Characters (NPCs)" href="Beginner-Tutorial-NPCs.html" />
|
||||
<link rel="next" title="10. In-game Shops" href="Beginner-Tutorial-Shops.html" />
|
||||
<link rel="prev" title="8. Non-Player-Characters (NPCs)" href="Beginner-Tutorial-NPCs.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Shops.html" title="In-game Shops"
|
||||
<a href="Beginner-Tutorial-Shops.html" title="10. In-game Shops"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="Non-Player-Characters (NPCs)"
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="8. Non-Player-Characters (NPCs)"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Game Quests</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">9. </span>Game Quests</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-NPCs.html"
|
||||
title="previous chapter">Non-Player-Characters (NPCs)</a></p>
|
||||
title="previous chapter"><span class="section-number">8. </span>Non-Player-Characters (NPCs)</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Shops.html"
|
||||
title="next chapter">In-game Shops</a></p>
|
||||
title="next chapter"><span class="section-number">10. </span>In-game Shops</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="game-quests">
|
||||
<h1>Game Quests<a class="headerlink" href="#game-quests" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">9. </span>Game Quests<a class="headerlink" href="#game-quests" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -122,16 +122,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Shops.html" title="In-game Shops"
|
||||
<a href="Beginner-Tutorial-Shops.html" title="10. In-game Shops"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="Non-Player-Characters (NPCs)"
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="8. Non-Player-Characters (NPCs)"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Game Quests</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">9. </span>Game Quests</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>In-game Rooms — Evennia 1.0-dev documentation</title>
|
||||
<title>7. In-game Rooms — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Non-Player-Characters (NPCs)" href="Beginner-Tutorial-NPCs.html" />
|
||||
<link rel="prev" title="Character Generation" href="Beginner-Tutorial-Chargen.html" />
|
||||
<link rel="next" title="8. Non-Player-Characters (NPCs)" href="Beginner-Tutorial-NPCs.html" />
|
||||
<link rel="prev" title="6. Character Generation" href="Beginner-Tutorial-Chargen.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="Non-Player-Characters (NPCs)"
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="8. Non-Player-Characters (NPCs)"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="Character Generation"
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="6. Character Generation"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Rooms</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">7. </span>In-game Rooms</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Chargen.html"
|
||||
title="previous chapter">Character Generation</a></p>
|
||||
title="previous chapter"><span class="section-number">6. </span>Character Generation</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-NPCs.html"
|
||||
title="next chapter">Non-Player-Characters (NPCs)</a></p>
|
||||
title="next chapter"><span class="section-number">8. </span>Non-Player-Characters (NPCs)</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="in-game-rooms">
|
||||
<h1>In-game Rooms<a class="headerlink" href="#in-game-rooms" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">7. </span>In-game Rooms<a class="headerlink" href="#in-game-rooms" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -122,16 +122,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="Non-Player-Characters (NPCs)"
|
||||
<a href="Beginner-Tutorial-NPCs.html" title="8. Non-Player-Characters (NPCs)"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="Character Generation"
|
||||
<a href="Beginner-Tutorial-Chargen.html" title="6. Character Generation"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Rooms</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">7. </span>In-game Rooms</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Rules and dice rolling — Evennia 1.0-dev documentation</title>
|
||||
<title>2. Rules and dice rolling — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Player Characters" href="Beginner-Tutorial-Characters.html" />
|
||||
<link rel="prev" title="Code structure and Utilities" href="Beginner-Tutorial-Utilities.html" />
|
||||
<link rel="next" title="3. Player Characters" href="Beginner-Tutorial-Characters.html" />
|
||||
<link rel="prev" title="1. Code structure and Utilities" href="Beginner-Tutorial-Utilities.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Characters.html" title="Player Characters"
|
||||
<a href="Beginner-Tutorial-Characters.html" title="3. Player Characters"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="Code structure and Utilities"
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="1. Code structure and Utilities"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Rules and dice rolling</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Rules and dice rolling</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,35 +64,35 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Rules and dice rolling</a><ul>
|
||||
<li><a class="reference internal" href="#summary-of-knave-rules">Summary of <em>Knave</em> rules</a></li>
|
||||
<li><a class="reference internal" href="#making-a-rule-module">Making a rule module</a></li>
|
||||
<li><a class="reference internal" href="#rolling-dice">Rolling dice</a><ul>
|
||||
<li><a class="reference internal" href="#generic-dice-roller">Generic dice roller</a></li>
|
||||
<li><a class="reference internal" href="#rolling-with-advantage">Rolling with advantage</a></li>
|
||||
<li><a class="reference internal" href="#saving-throws">Saving throws</a></li>
|
||||
<li><a class="reference internal" href="#opposed-saving-throw">Opposed saving throw</a></li>
|
||||
<li><a class="reference internal" href="#morale-check">Morale check</a></li>
|
||||
<li><a class="reference internal" href="#roll-for-healing">Roll for Healing</a></li>
|
||||
<li><a class="reference internal" href="#rolling-on-a-table">Rolling on a table</a></li>
|
||||
<li><a class="reference internal" href="#roll-for-death">Roll for death</a></li>
|
||||
<li><a class="reference internal" href="#">2. Rules and dice rolling</a><ul>
|
||||
<li><a class="reference internal" href="#summary-of-knave-rules">2.1. Summary of <em>Knave</em> rules</a></li>
|
||||
<li><a class="reference internal" href="#making-a-rule-module">2.2. Making a rule module</a></li>
|
||||
<li><a class="reference internal" href="#rolling-dice">2.3. Rolling dice</a><ul>
|
||||
<li><a class="reference internal" href="#generic-dice-roller">2.3.1. Generic dice roller</a></li>
|
||||
<li><a class="reference internal" href="#rolling-with-advantage">2.3.2. Rolling with advantage</a></li>
|
||||
<li><a class="reference internal" href="#saving-throws">2.3.3. Saving throws</a></li>
|
||||
<li><a class="reference internal" href="#opposed-saving-throw">2.3.4. Opposed saving throw</a></li>
|
||||
<li><a class="reference internal" href="#morale-check">2.3.5. Morale check</a></li>
|
||||
<li><a class="reference internal" href="#roll-for-healing">2.3.6. Roll for Healing</a></li>
|
||||
<li><a class="reference internal" href="#rolling-on-a-table">2.3.7. Rolling on a table</a></li>
|
||||
<li><a class="reference internal" href="#roll-for-death">2.3.8. Roll for death</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#testing">Testing</a><ul>
|
||||
<li><a class="reference internal" href="#mocking-and-patching">Mocking and patching</a></li>
|
||||
<li><a class="reference internal" href="#testing">2.4. Testing</a><ul>
|
||||
<li><a class="reference internal" href="#mocking-and-patching">2.4.1. Mocking and patching</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#summary">Summary</a></li>
|
||||
<li><a class="reference internal" href="#summary">2.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Utilities.html"
|
||||
title="previous chapter">Code structure and Utilities</a></p>
|
||||
title="previous chapter"><span class="section-number">1. </span>Code structure and Utilities</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Characters.html"
|
||||
title="next chapter">Player Characters</a></p>
|
||||
title="next chapter"><span class="section-number">3. </span>Player Characters</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -124,13 +124,13 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="rules-and-dice-rolling">
|
||||
<h1>Rules and dice rolling<a class="headerlink" href="#rules-and-dice-rolling" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">2. </span>Rules and dice rolling<a class="headerlink" href="#rules-and-dice-rolling" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In <em>EvAdventure</em> we have decided to use the <a class="reference external" href="https://www.drivethrurpg.com/product/250888/Knave">Knave</a>
|
||||
RPG ruleset. This is commercial, but released under Creative Commons 4.0, meaning it’s okay to share and
|
||||
adapt <em>Knave</em> for any purpose, even commercially. If you don’t want to buy it but still follow
|
||||
along, you can find a <a class="reference external" href="http://abominablefancy.blogspot.com/2018/10/knaves-fancypants.html">free fan-version here</a>.</p>
|
||||
<section id="summary-of-knave-rules">
|
||||
<h2>Summary of <em>Knave</em> rules<a class="headerlink" href="#summary-of-knave-rules" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.1. </span>Summary of <em>Knave</em> rules<a class="headerlink" href="#summary-of-knave-rules" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Knave, being inspired by early Dungeons & Dragons, is very simple.</p>
|
||||
<ul class="simple">
|
||||
<li><p>It uses six Ability bonuses
|
||||
|
|
@ -165,7 +165,7 @@ hitting 0. Death, if it happens, is permanent.</p></li>
|
|||
</ul>
|
||||
</section>
|
||||
<section id="making-a-rule-module">
|
||||
<h2>Making a rule module<a class="headerlink" href="#making-a-rule-module" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.2. </span>Making a rule module<a class="headerlink" href="#making-a-rule-module" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module mygame/evadventure/rules.py</p>
|
||||
</div></blockquote>
|
||||
|
|
@ -183,7 +183,7 @@ hitting 0. Death, if it happens, is permanent.</p></li>
|
|||
in a rulebook.</p>
|
||||
</section>
|
||||
<section id="rolling-dice">
|
||||
<h2>Rolling dice<a class="headerlink" href="#rolling-dice" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.3. </span>Rolling dice<a class="headerlink" href="#rolling-dice" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We will start by making a dice roller. Let’s group all of our dice rolling into a structure like this
|
||||
(not functional code yet):</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">EvAdventureRollEngine</span><span class="p">:</span>
|
||||
|
|
@ -231,7 +231,7 @@ modules:</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<section id="generic-dice-roller">
|
||||
<h3>Generic dice roller<a class="headerlink" href="#generic-dice-roller" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.1. </span>Generic dice roller<a class="headerlink" href="#generic-dice-roller" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We want to be able to do <code class="docutils literal notranslate"><span class="pre">roll("1d20")</span></code> and get a random result back from the roll.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/rules.py </span>
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ much more - We would have to make sure that <code class="docutils literal notran
|
|||
crazy big so the loop takes forever!</p>
|
||||
</section>
|
||||
<section id="rolling-with-advantage">
|
||||
<h3>Rolling with advantage<a class="headerlink" href="#rolling-with-advantage" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.2. </span>Rolling with advantage<a class="headerlink" href="#rolling-with-advantage" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Now that we have the generic roller, we can start using it to do a more complex roll.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/evadventure/rules.py </span>
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ crazy big so the loop takes forever!</p>
|
|||
of two arguments.</p>
|
||||
</section>
|
||||
<section id="saving-throws">
|
||||
<h3>Saving throws<a class="headerlink" href="#saving-throws" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.3. </span>Saving throws<a class="headerlink" href="#saving-throws" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We want the saving throw to itself figure out if it succeeded or not. This means it needs to know
|
||||
the Ability bonus (like STR <code class="docutils literal notranslate"><span class="pre">+1</span></code>). It would be convenient if we could just pass the entity
|
||||
doing the saving throw to this method, tell it what type of save was needed, and then
|
||||
|
|
@ -397,7 +397,7 @@ Attribute is available as <code class="docutils literal notranslate"><span class
|
|||
off an object and getting a default value if the attribute is not defined.</p>
|
||||
</section>
|
||||
<section id="opposed-saving-throw">
|
||||
<h3>Opposed saving throw<a class="headerlink" href="#opposed-saving-throw" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.4. </span>Opposed saving throw<a class="headerlink" href="#opposed-saving-throw" title="Permalink to this headline">¶</a></h3>
|
||||
<p>With the building pieces we already created, this method is simple. Remember that the defense you have
|
||||
to beat is always the relevant bonus + 10 in <em>Knave</em>. So if the enemy defends with <code class="docutils literal notranslate"><span class="pre">STR</span> <span class="pre">+3</span></code>, you must
|
||||
roll higher than <code class="docutils literal notranslate"><span class="pre">13</span></code>.</p>
|
||||
|
|
@ -429,7 +429,7 @@ roll higher than <code class="docutils literal notranslate"><span class="pre">13
|
|||
</div>
|
||||
</section>
|
||||
<section id="morale-check">
|
||||
<h3>Morale check<a class="headerlink" href="#morale-check" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.5. </span>Morale check<a class="headerlink" href="#morale-check" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We will make the assumption that the <code class="docutils literal notranslate"><span class="pre">morale</span></code> value is available from the creature simply as
|
||||
<code class="docutils literal notranslate"><span class="pre">monster.morale</span></code> - we need to remember to make this so later!</p>
|
||||
<p>In <em>Knave</em>, a creature have roll with <code class="docutils literal notranslate"><span class="pre">2d6</span></code> equal or under its morale to not flee or surrender
|
||||
|
|
@ -447,7 +447,7 @@ when things go south. The standard morale value is 9.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="roll-for-healing">
|
||||
<h3>Roll for Healing<a class="headerlink" href="#roll-for-healing" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.6. </span>Roll for Healing<a class="headerlink" href="#roll-for-healing" title="Permalink to this headline">¶</a></h3>
|
||||
<p>To be able to handle healing, we need to make some more assumptions about how we store
|
||||
health on game entities. We will need <code class="docutils literal notranslate"><span class="pre">hp_max</span></code> (the total amount of available HP) and <code class="docutils literal notranslate"><span class="pre">hp</span></code>
|
||||
(the current health value). We again assume these will be available as <code class="docutils literal notranslate"><span class="pre">obj.hp</span></code> and <code class="docutils literal notranslate"><span class="pre">obj.hp_max</span></code>.</p>
|
||||
|
|
@ -479,7 +479,7 @@ problem. We will make sure to implement the matching <em>Character</em> class ne
|
|||
</div></blockquote>
|
||||
</section>
|
||||
<section id="rolling-on-a-table">
|
||||
<h3>Rolling on a table<a class="headerlink" href="#rolling-on-a-table" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.7. </span>Rolling on a table<a class="headerlink" href="#rolling-on-a-table" title="Permalink to this headline">¶</a></h3>
|
||||
<p>We occasionally need to roll on a ‘table’ - a selection of choices. There are two main table-types
|
||||
we need to support:</p>
|
||||
<p>Simply one element per row of the table (same odds to get each result).</p>
|
||||
|
|
@ -593,7 +593,7 @@ So the result for <code class="docutils literal notranslate"><span class="pre">1
|
|||
<code class="docutils literal notranslate"><span class="pre">"5"</span></code> or the value of <code class="docutils literal notranslate"><span class="pre">minval</span></code>.</p>
|
||||
</section>
|
||||
<section id="roll-for-death">
|
||||
<h3>Roll for death<a class="headerlink" href="#roll-for-death" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.3.8. </span>Roll for death<a class="headerlink" href="#roll-for-death" title="Permalink to this headline">¶</a></h3>
|
||||
<p>While original Knave suggests hitting 0 HP means insta-death, we will grab the optional “death table”
|
||||
from the “prettified” Knave’s optional rules to make it a little less punishing. We also changed the
|
||||
result of <code class="docutils literal notranslate"><span class="pre">2</span></code> to ‘dead’ since we don’t simulate ‘dismemberment’ in this tutorial:</p>
|
||||
|
|
@ -694,7 +694,7 @@ character!</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="testing">
|
||||
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.4. </span>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Make a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/tests/test_rules.py</span></code></p>
|
||||
</div></blockquote>
|
||||
|
|
@ -726,7 +726,7 @@ character!</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<section id="mocking-and-patching">
|
||||
<h3>Mocking and patching<a class="headerlink" href="#mocking-and-patching" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">2.4.1. </span>Mocking and patching<a class="headerlink" href="#mocking-and-patching" title="Permalink to this headline">¶</a></h3>
|
||||
<aside class="sidebar">
|
||||
<p>In <a class="reference internal" href="../../../api/evennia.contrib.tutorials.evadventure.tests.test_rules.html"><span class="doc std std-doc">evennia/contrib/tutorials/evadventure/tests/test_rules.py</span></a>
|
||||
has a complete example of rule testing.</p>
|
||||
|
|
@ -751,7 +751,7 @@ them for further help.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.5. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p>This concludes all the core rule mechanics of <em>Knave</em> - the rules used during play. We noticed here
|
||||
that we are going to soon need to establish how our <em>Character</em> actually stores data. So we will
|
||||
address that next.</p>
|
||||
|
|
@ -774,16 +774,16 @@ address that next.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Characters.html" title="Player Characters"
|
||||
<a href="Beginner-Tutorial-Characters.html" title="3. Player Characters"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="Code structure and Utilities"
|
||||
<a href="Beginner-Tutorial-Utilities.html" title="1. Code structure and Utilities"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Rules and dice rolling</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Rules and dice rolling</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>In-game Shops — Evennia 1.0-dev documentation</title>
|
||||
<title>10. In-game Shops — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Dynamically generated Dungeon" href="Beginner-Tutorial-Dungeon.html" />
|
||||
<link rel="prev" title="Game Quests" href="Beginner-Tutorial-Quests.html" />
|
||||
<link rel="next" title="11. Dynamically generated Dungeon" href="Beginner-Tutorial-Dungeon.html" />
|
||||
<link rel="prev" title="9. Game Quests" href="Beginner-Tutorial-Quests.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="Dynamically generated Dungeon"
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="11. Dynamically generated Dungeon"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Quests.html" title="Game Quests"
|
||||
<a href="Beginner-Tutorial-Quests.html" title="9. Game Quests"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Shops</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">10. </span>In-game Shops</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Quests.html"
|
||||
title="previous chapter">Game Quests</a></p>
|
||||
title="previous chapter"><span class="section-number">9. </span>Game Quests</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Dungeon.html"
|
||||
title="next chapter">Dynamically generated Dungeon</a></p>
|
||||
title="next chapter"><span class="section-number">11. </span>Dynamically generated Dungeon</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="in-game-shops">
|
||||
<h1>In-game Shops<a class="headerlink" href="#in-game-shops" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">10. </span>In-game Shops<a class="headerlink" href="#in-game-shops" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<p>This part of the Beginner tutorial is still being developed.</p>
|
||||
|
|
@ -122,16 +122,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="Dynamically generated Dungeon"
|
||||
<a href="Beginner-Tutorial-Dungeon.html" title="11. Dynamically generated Dungeon"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Quests.html" title="Game Quests"
|
||||
<a href="Beginner-Tutorial-Quests.html" title="9. Game Quests"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">In-game Shops</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">10. </span>In-game Shops</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Code structure and Utilities — Evennia 1.0-dev documentation</title>
|
||||
<title>1. Code structure and Utilities — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Rules and dice rolling" href="Beginner-Tutorial-Rules.html" />
|
||||
<link rel="prev" title="Part 3: How we get there" href="Beginner-Tutorial-Part3-Intro.html" />
|
||||
<link rel="next" title="2. Rules and dice rolling" href="Beginner-Tutorial-Rules.html" />
|
||||
<link rel="prev" title="Part 3: How we get there (example game)" href="Beginner-Tutorial-Part3-Intro.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rules.html" title="Rules and dice rolling"
|
||||
<a href="Beginner-Tutorial-Rules.html" title="2. Rules and dice rolling"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there"
|
||||
<a href="Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there (example game)"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Code structure and Utilities</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" accesskey="U">Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Code structure and Utilities</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,25 +64,25 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Code structure and Utilities</a><ul>
|
||||
<li><a class="reference internal" href="#folder-structure">Folder structure</a></li>
|
||||
<li><a class="reference internal" href="#enums">Enums</a></li>
|
||||
<li><a class="reference internal" href="#utility-module">Utility module</a></li>
|
||||
<li><a class="reference internal" href="#testing">Testing</a><ul>
|
||||
<li><a class="reference internal" href="#running-your-test">Running your test</a></li>
|
||||
<li><a class="reference internal" href="#">1. Code structure and Utilities</a><ul>
|
||||
<li><a class="reference internal" href="#folder-structure">1.1. Folder structure</a></li>
|
||||
<li><a class="reference internal" href="#enums">1.2. Enums</a></li>
|
||||
<li><a class="reference internal" href="#utility-module">1.3. Utility module</a></li>
|
||||
<li><a class="reference internal" href="#testing">1.4. Testing</a><ul>
|
||||
<li><a class="reference internal" href="#running-your-test">1.4.1. Running your test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#summary">Summary</a></li>
|
||||
<li><a class="reference internal" href="#summary">1.5. Summary</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Part3-Intro.html"
|
||||
title="previous chapter">Part 3: How we get there</a></p>
|
||||
title="previous chapter">Part 3: How we get there (example game)</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Beginner-Tutorial-Rules.html"
|
||||
title="next chapter">Rules and dice rolling</a></p>
|
||||
title="next chapter"><span class="section-number">2. </span>Rules and dice rolling</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -114,11 +114,11 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="code-structure-and-utilities">
|
||||
<h1>Code structure and Utilities<a class="headerlink" href="#code-structure-and-utilities" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">1. </span>Code structure and Utilities<a class="headerlink" href="#code-structure-and-utilities" title="Permalink to this headline">¶</a></h1>
|
||||
<p>In this lesson we will set up the file structure for <em>EvAdventure</em>. We will make some
|
||||
utilities that will be useful later. We will also learn how to write <em>tests</em>.</p>
|
||||
<section id="folder-structure">
|
||||
<h2>Folder structure<a class="headerlink" href="#folder-structure" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.1. </span>Folder structure<a class="headerlink" href="#folder-structure" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Create a new folder under your <code class="docutils literal notranslate"><span class="pre">mygame</span></code> folder, named <code class="docutils literal notranslate"><span class="pre">evadventure</span></code>. Inside it, create
|
||||
another folder <code class="docutils literal notranslate"><span class="pre">tests/</span></code> and make sure to put empty <code class="docutils literal notranslate"><span class="pre">__init__.py</span></code> files in both. This turns both
|
||||
folders into packages Python understands to import from.</p>
|
||||
|
|
@ -155,7 +155,7 @@ folders into packages Python understands to import from.</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="enums">
|
||||
<h2>Enums<a class="headerlink" href="#enums" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.2. </span>Enums<a class="headerlink" href="#enums" title="Permalink to this headline">¶</a></h2>
|
||||
<aside class="sidebar">
|
||||
<p>A full example of the enum module is found in
|
||||
<a class="reference internal" href="../../../api/evennia.contrib.tutorials.evadventure.enums.html"><span class="doc std std-doc">evennia/contrib/tutorials/evadventure/enums.py</span></a>.</p>
|
||||
|
|
@ -227,7 +227,7 @@ likely gradually expand on your enums as you figure out what you’ll need).</p>
|
|||
<p>Here the <code class="docutils literal notranslate"><span class="pre">Ability</span></code> class holds basic properties of a character sheet.</p>
|
||||
</section>
|
||||
<section id="utility-module">
|
||||
<h2>Utility module<a class="headerlink" href="#utility-module" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.3. </span>Utility module<a class="headerlink" href="#utility-module" title="Permalink to this headline">¶</a></h2>
|
||||
<blockquote>
|
||||
<div><p>Create a new module <code class="docutils literal notranslate"><span class="pre">mygame/evadventure/utils.py</span></code></p>
|
||||
</div></blockquote>
|
||||
|
|
@ -302,7 +302,7 @@ hold its description (this is how it is in default Evennia).</p>
|
|||
So we just set them to dummy values. We’ll need to get back to this when we have more code in place!</p>
|
||||
</section>
|
||||
<section id="testing">
|
||||
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.4. </span>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>It’s useful for any game dev to know how to effectively test their code. So we’ll try to include a
|
||||
|
|
@ -377,7 +377,7 @@ tuple <code class="docutils literal notranslate"><span class="pre">(name,</span>
|
|||
to the string we specify. If they are the same, the test <em>passes</em>, otherwise it <em>fails</em> and we
|
||||
need to investigate what went wrong.</p>
|
||||
<section id="running-your-test">
|
||||
<h3>Running your test<a class="headerlink" href="#running-your-test" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><span class="section-number">1.4.1. </span>Running your test<a class="headerlink" href="#running-your-test" title="Permalink to this headline">¶</a></h3>
|
||||
<p>To run your test you need to stand inside your <code class="docutils literal notranslate"><span class="pre">mygame</span></code> folder and execute the following command:</p>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .evadventure.tests
|
||||
</pre></div>
|
||||
|
|
@ -392,7 +392,7 @@ your return string doesn’t quite match what you expected.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="summary">
|
||||
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.5. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
|
||||
<p>It’s very important to understand how you import code between modules in Python, so if this is still
|
||||
confusing to you, it’s worth to read up on this more.</p>
|
||||
<p>That said, many newcomers are confused with how to begin, so by creating the folder structure, some
|
||||
|
|
@ -416,16 +416,16 @@ small modules and even making your first unit test, you are off to a great start
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Rules.html" title="Rules and dice rolling"
|
||||
<a href="Beginner-Tutorial-Rules.html" title="2. Rules and dice rolling"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there"
|
||||
<a href="Beginner-Tutorial-Part3-Intro.html" title="Part 3: How we get there (example game)"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Code structure and Utilities</a></li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part3-Intro.html" >Part 3: How we get there (example game)</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Code structure and Utilities</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Part 5: Showing the world" href="../Part5/Beginner-Tutorial-Part5-Intro.html" />
|
||||
<link rel="prev" title="In-game Commands" href="../Part3/Beginner-Tutorial-Commands.html" />
|
||||
<link rel="next" title="1. Unimplemented" href="../../../Unimplemented.html" />
|
||||
<link rel="prev" title="12. In-game Commands" href="../Part3/Beginner-Tutorial-Commands.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,10 +30,10 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part5/Beginner-Tutorial-Part5-Intro.html" title="Part 5: Showing the world"
|
||||
<a href="../../../Unimplemented.html" title="1. Unimplemented"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part3/Beginner-Tutorial-Commands.html" title="In-game Commands"
|
||||
<a href="../Part3/Beginner-Tutorial-Commands.html" title="12. In-game Commands"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
@ -65,17 +65,16 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">Part 4: Using what we created</a><ul>
|
||||
<li><a class="reference internal" href="#lessons">Lessons</a></li>
|
||||
<li><a class="reference internal" href="#table-of-contents">Table of Contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../Part3/Beginner-Tutorial-Commands.html"
|
||||
title="previous chapter">In-game Commands</a></p>
|
||||
title="previous chapter"><span class="section-number">12. </span>In-game Commands</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../Part5/Beginner-Tutorial-Part5-Intro.html"
|
||||
title="next chapter">Part 5: Showing the world</a></p>
|
||||
<p class="topless"><a href="../../../Unimplemented.html"
|
||||
title="next chapter"><span class="section-number">1. </span>Unimplemented</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -134,12 +133,9 @@ and batchcode processors.</p>
|
|||
<h2>Lessons<a class="headerlink" href="#lessons" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>TODO</em></p>
|
||||
<div class="toctree-wrapper compound">
|
||||
</div>
|
||||
</section>
|
||||
<section id="table-of-contents">
|
||||
<h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>TODO</em></p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="../../../Unimplemented.html">1. Unimplemented</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
|
@ -160,10 +156,10 @@ and batchcode processors.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part5/Beginner-Tutorial-Part5-Intro.html" title="Part 5: Showing the world"
|
||||
<a href="../../../Unimplemented.html" title="1. Unimplemented"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part3/Beginner-Tutorial-Commands.html" title="In-game Commands"
|
||||
<a href="../Part3/Beginner-Tutorial-Commands.html" title="12. In-game Commands"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Add a simple new web page — Evennia 1.0-dev documentation</title>
|
||||
<title>1. Add a simple new web page — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Web Tutorial" href="Web-Tutorial.html" />
|
||||
<link rel="next" title="2. Web Tutorial" href="Web-Tutorial.html" />
|
||||
<link rel="prev" title="Part 5: Showing the world" href="Beginner-Tutorial-Part5-Intro.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Web-Tutorial.html" title="Web Tutorial"
|
||||
<a href="Web-Tutorial.html" title="2. Web Tutorial"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part5-Intro.html" title="Part 5: Showing the world"
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part5-Intro.html" accesskey="U">Part 5: Showing the world</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Add a simple new web page</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Add a simple new web page</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,10 +64,10 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Add a simple new web page</a><ul>
|
||||
<li><a class="reference internal" href="#create-the-view">Create the view</a></li>
|
||||
<li><a class="reference internal" href="#the-html-page">The HTML page</a></li>
|
||||
<li><a class="reference internal" href="#the-url">The URL</a></li>
|
||||
<li><a class="reference internal" href="#">1. Add a simple new web page</a><ul>
|
||||
<li><a class="reference internal" href="#create-the-view">1.1. Create the view</a></li>
|
||||
<li><a class="reference internal" href="#the-html-page">1.2. The HTML page</a></li>
|
||||
<li><a class="reference internal" href="#the-url">1.3. The URL</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
title="previous chapter">Part 5: Showing the world</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Web-Tutorial.html"
|
||||
title="next chapter">Web Tutorial</a></p>
|
||||
title="next chapter"><span class="section-number">2. </span>Web Tutorial</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="add-a-simple-new-web-page">
|
||||
<h1>Add a simple new web page<a class="headerlink" href="#add-a-simple-new-web-page" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">1. </span>Add a simple new web page<a class="headerlink" href="#add-a-simple-new-web-page" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Evennia leverages <a class="reference external" href="https://docs.djangoproject.com">Django</a> which is a web development framework.
|
||||
Huge professional websites are made in Django and there is extensive documentation (and books) on it
|
||||
. You are encouraged to at least look at the Django basic tutorials. Here we will just give a brief
|
||||
|
|
@ -119,7 +119,7 @@ box. You can get to that by entering <code class="docutils literal notranslate">
|
|||
welcome page with some game statistics and a link to the web client. Let us add a new page that you
|
||||
can get to by going to <code class="docutils literal notranslate"><span class="pre">http://localhost:4001/story</span></code>.</p>
|
||||
<section id="create-the-view">
|
||||
<h2>Create the view<a class="headerlink" href="#create-the-view" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.1. </span>Create the view<a class="headerlink" href="#create-the-view" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A django “view” is a normal Python function that django calls to render the HTML page you will see
|
||||
in the web browser. Here we will just have it spit back the raw html, but Django can do all sorts of
|
||||
cool stuff with the page in the view, like adding dynamic content or change it on the fly. Open
|
||||
|
|
@ -138,7 +138,7 @@ Python you can import from the new folder). Here’s how it looks:</p>
|
|||
template some information from the request, for instance, the game name, and then renders it.</p>
|
||||
</section>
|
||||
<section id="the-html-page">
|
||||
<h2>The HTML page<a class="headerlink" href="#the-html-page" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.2. </span>The HTML page<a class="headerlink" href="#the-html-page" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We need to find a place where Evennia (and Django) looks for html files (called <em>templates</em> in
|
||||
Django parlance). You can specify such places in your settings (see the <code class="docutils literal notranslate"><span class="pre">TEMPLATES</span></code> variable in
|
||||
<code class="docutils literal notranslate"><span class="pre">default_settings.py</span></code> for more info), but here we’ll use an existing one. Go to
|
||||
|
|
@ -170,7 +170,7 @@ Django parlance). You can specify such places in your settings (see the <code cl
|
|||
</div>
|
||||
</section>
|
||||
<section id="the-url">
|
||||
<h2>The URL<a class="headerlink" href="#the-url" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">1.3. </span>The URL<a class="headerlink" href="#the-url" title="Permalink to this headline">¶</a></h2>
|
||||
<p>When you enter the address <code class="docutils literal notranslate"><span class="pre">http://localhost:4001/story</span></code> in your web browser, Django will parse that
|
||||
field to figure out which page you want to go to. You tell it which patterns are relevant in the
|
||||
file
|
||||
|
|
@ -212,7 +212,7 @@ to.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Web-Tutorial.html" title="Web Tutorial"
|
||||
<a href="Web-Tutorial.html" title="2. Web Tutorial"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Beginner-Tutorial-Part5-Intro.html" title="Part 5: Showing the world"
|
||||
|
|
@ -221,7 +221,7 @@ to.</p>
|
|||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part5-Intro.html" >Part 5: Showing the world</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Add a simple new web page</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">1. </span>Add a simple new web page</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Add a simple new web page" href="Add-a-simple-new-web-page.html" />
|
||||
<link rel="prev" title="Part 4: Using what we created" href="../Part4/Beginner-Tutorial-Part4-Intro.html" />
|
||||
<link rel="next" title="1. Add a simple new web page" href="Add-a-simple-new-web-page.html" />
|
||||
<link rel="prev" title="1. Unimplemented" href="../../../Unimplemented.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,10 +30,10 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Add-a-simple-new-web-page.html" title="Add a simple new web page"
|
||||
<a href="Add-a-simple-new-web-page.html" title="1. Add a simple new web page"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part4/Beginner-Tutorial-Part4-Intro.html" title="Part 4: Using what we created"
|
||||
<a href="../../../Unimplemented.html" title="1. Unimplemented"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
@ -65,17 +65,16 @@
|
|||
<ul>
|
||||
<li><a class="reference internal" href="#">Part 5: Showing the world</a><ul>
|
||||
<li><a class="reference internal" href="#lessons">Lessons</a></li>
|
||||
<li><a class="reference internal" href="#table-of-contents">Table of Contents</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="../Part4/Beginner-Tutorial-Part4-Intro.html"
|
||||
title="previous chapter">Part 4: Using what we created</a></p>
|
||||
<p class="topless"><a href="../../../Unimplemented.html"
|
||||
title="previous chapter"><span class="section-number">1. </span>Unimplemented</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="Add-a-simple-new-web-page.html"
|
||||
title="next chapter">Add a simple new web page</a></p>
|
||||
title="next chapter"><span class="section-number">1. </span>Add a simple new web page</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -133,27 +132,17 @@ to bring your game online so you can invite your first players.</p>
|
|||
<p><em>TODO</em></p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Add-a-simple-new-web-page.html">Add a simple new web page</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Web-Tutorial.html">Web Tutorial</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section id="table-of-contents">
|
||||
<h2>Table of Contents<a class="headerlink" href="#table-of-contents" title="Permalink to this headline">¶</a></h2>
|
||||
<p><em>TODO</em></p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Add-a-simple-new-web-page.html">Add a simple new web page</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#create-the-view">Create the view</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#the-html-page">The HTML page</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#the-url">The URL</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Add-a-simple-new-web-page.html">1. Add a simple new web page</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#create-the-view">1.1. Create the view</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#the-html-page">1.2. The HTML page</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Add-a-simple-new-web-page.html#the-url">1.3. The URL</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Web-Tutorial.html">Web Tutorial</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#a-basic-overview">A Basic Overview</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#changing-the-logo-on-the-front-page">Changing the logo on the front page</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#changing-the-front-pages-text">Changing the Front Page’s Text</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#further-reading">Further reading</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="Web-Tutorial.html">2. Web Tutorial</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#a-basic-overview">2.1. A Basic Overview</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#changing-the-logo-on-the-front-page">2.2. Changing the logo on the front page</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#changing-the-front-pages-text">2.3. Changing the Front Page’s Text</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="Web-Tutorial.html#further-reading">2.4. Further reading</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -177,10 +166,10 @@ to bring your game online so you can invite your first players.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Add-a-simple-new-web-page.html" title="Add a simple new web page"
|
||||
<a href="Add-a-simple-new-web-page.html" title="1. Add a simple new web page"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../Part4/Beginner-Tutorial-Part4-Intro.html" title="Part 4: Using what we created"
|
||||
<a href="../../../Unimplemented.html" title="1. Unimplemented"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Web Tutorial — Evennia 1.0-dev documentation</title>
|
||||
<title>2. Web Tutorial — Evennia 1.0-dev documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
<link rel="search" title="Search" href="../../../search.html" />
|
||||
<link rel="next" title="Coding FAQ" href="../../Coding-FAQ.html" />
|
||||
<link rel="prev" title="Add a simple new web page" href="Add-a-simple-new-web-page.html" />
|
||||
<link rel="next" title="Command Prompt" href="../../Howto-Command-Prompt.html" />
|
||||
<link rel="prev" title="1. Add a simple new web page" href="Add-a-simple-new-web-page.html" />
|
||||
</head><body>
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
|
|
@ -30,16 +30,16 @@
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../Coding-FAQ.html" title="Coding FAQ"
|
||||
<a href="../../Howto-Command-Prompt.html" title="Command Prompt"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Add-a-simple-new-web-page.html" title="Add a simple new web page"
|
||||
<a href="Add-a-simple-new-web-page.html" title="1. Add a simple new web page"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part5-Intro.html" accesskey="U">Part 5: Showing the world</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Web Tutorial</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Web Tutorial</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
@ -64,21 +64,21 @@
|
|||
<script>$('#searchbox').show(0);</script>
|
||||
<h3><a href="../../../index.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Web Tutorial</a><ul>
|
||||
<li><a class="reference internal" href="#a-basic-overview">A Basic Overview</a></li>
|
||||
<li><a class="reference internal" href="#changing-the-logo-on-the-front-page">Changing the logo on the front page</a></li>
|
||||
<li><a class="reference internal" href="#changing-the-front-pages-text">Changing the Front Page’s Text</a></li>
|
||||
<li><a class="reference internal" href="#further-reading">Further reading</a></li>
|
||||
<li><a class="reference internal" href="#">2. Web Tutorial</a><ul>
|
||||
<li><a class="reference internal" href="#a-basic-overview">2.1. A Basic Overview</a></li>
|
||||
<li><a class="reference internal" href="#changing-the-logo-on-the-front-page">2.2. Changing the logo on the front page</a></li>
|
||||
<li><a class="reference internal" href="#changing-the-front-pages-text">2.3. Changing the Front Page’s Text</a></li>
|
||||
<li><a class="reference internal" href="#further-reading">2.4. Further reading</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="Add-a-simple-new-web-page.html"
|
||||
title="previous chapter">Add a simple new web page</a></p>
|
||||
title="previous chapter"><span class="section-number">1. </span>Add a simple new web page</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="../../Coding-FAQ.html"
|
||||
title="next chapter">Coding FAQ</a></p>
|
||||
<p class="topless"><a href="../../Howto-Command-Prompt.html"
|
||||
title="next chapter">Command Prompt</a></p>
|
||||
<div role="note" aria-label="source link">
|
||||
<!--h3>This Page</h3-->
|
||||
<ul class="this-page-menu">
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<section class="tex2jax_ignore mathjax_ignore" id="web-tutorial">
|
||||
<h1>Web Tutorial<a class="headerlink" href="#web-tutorial" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><span class="section-number">2. </span>Web Tutorial<a class="headerlink" href="#web-tutorial" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Evennia uses the <a class="reference external" href="https://www.djangoproject.com/">Django</a> web framework as the basis of both its
|
||||
database configuration and the website it provides. While a full understanding of Django requires
|
||||
reading the Django documentation, we have provided this tutorial to get you running with the basics
|
||||
|
|
@ -118,7 +118,7 @@ and how they pertain to Evennia. This text details getting everything set up. Th
|
|||
<a class="reference internal" href="../../Web-Character-View-Tutorial.html"><span class="doc std std-doc">Web-based Character view Tutorial</span></a> gives a more explicit example of making a
|
||||
custom web page connected to your game, and you may want to read that after finishing this guide.</p>
|
||||
<section id="a-basic-overview">
|
||||
<h2>A Basic Overview<a class="headerlink" href="#a-basic-overview" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.1. </span>A Basic Overview<a class="headerlink" href="#a-basic-overview" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Django is a web framework. It gives you a set of development tools for building a website quickly
|
||||
and easily.</p>
|
||||
<p>Django projects are split up into <em>apps</em> and these apps all contribute to one project. For instance,
|
||||
|
|
@ -138,7 +138,7 @@ for storing information in the database. We will not change any models here, tak
|
|||
default URLs for you. This is located in <code class="docutils literal notranslate"><span class="pre">web/urls.py</span></code>.</p>
|
||||
</section>
|
||||
<section id="changing-the-logo-on-the-front-page">
|
||||
<h2>Changing the logo on the front page<a class="headerlink" href="#changing-the-logo-on-the-front-page" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.2. </span>Changing the logo on the front page<a class="headerlink" href="#changing-the-logo-on-the-front-page" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Evennia’s default logo is a fun little googly-eyed snake wrapped around a gear globe. As cute as it
|
||||
is, it probably doesn’t represent your game. So one of the first things you may wish to do is
|
||||
replace it with a logo of your own.</p>
|
||||
|
|
@ -187,7 +187,7 @@ scratch.</p>
|
|||
</div></blockquote>
|
||||
</section>
|
||||
<section id="changing-the-front-pages-text">
|
||||
<h2>Changing the Front Page’s Text<a class="headerlink" href="#changing-the-front-pages-text" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.3. </span>Changing the Front Page’s Text<a class="headerlink" href="#changing-the-front-pages-text" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The default front page for Evennia contains information about the Evennia project. You’ll probably
|
||||
want to replace this information with information about your own project. Changing the page template
|
||||
is done in a similar way to changing static resources.</p>
|
||||
|
|
@ -209,7 +209,7 @@ web/template_overrides<code class="docutils literal notranslate"><span class="pr
|
|||
original file already has all the markup and tags, ready for editing.</p>
|
||||
</section>
|
||||
<section id="further-reading">
|
||||
<h2>Further reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><span class="section-number">2.4. </span>Further reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
|
||||
<p>For further hints on working with the web presence, you could now continue to the
|
||||
<a class="reference internal" href="../../Web-Character-View-Tutorial.html"><span class="doc std std-doc">Web-based Character view Tutorial</span></a> where you learn to make a web page that
|
||||
displays in-game character stats. You can also look at <a class="reference external" href="https://docs.djangoproject.com/en/1.7/intro/tutorial01/">Django’s own
|
||||
|
|
@ -234,16 +234,16 @@ works and what possibilities exist.</p>
|
|||
<a href="../../../py-modindex.html" title="Python Module Index"
|
||||
>modules</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="../../Coding-FAQ.html" title="Coding FAQ"
|
||||
<a href="../../Howto-Command-Prompt.html" title="Command Prompt"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="Add-a-simple-new-web-page.html" title="Add a simple new web page"
|
||||
<a href="Add-a-simple-new-web-page.html" title="1. Add a simple new web page"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> »</li>
|
||||
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howto’s</a> »</li>
|
||||
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> »</li>
|
||||
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part5-Intro.html" >Part 5: Showing the world</a> »</li>
|
||||
<li class="nav-item nav-item-this"><a href="">Web Tutorial</a></li>
|
||||
<li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Web Tutorial</a></li>
|
||||
</ul>
|
||||
<div class="develop">develop branch</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue