Commits

Anonymous committed ecd7ce4

overally cleaner imports and fixed test cases in anyrpg

Comments (0)

Files changed (5)

rpg_lib/anyrpg.py

 Ideas: 
     - Lazy loading modules, to be able to print stuff at once without having to print before the imports. 
     - Add getting experience for groups and show the chars together (only one experience header instead of one per char). 
-    - Being able to press "pause" when using autoscrolling output. 
+    - Being able to press "pause" and "skip" when using autoscrolling output. "skip" should show the whole line at once (skip the autoscrolling). 
 
 
 Basic design principles for the scripting language: 
     - Actions should be written as verb_noun or simply verb. 
        -> char.say() and char.compete_skill() instead of char.text() and char.skill_compete()
      
-    - In the story function, an action is a parameter of the story. 
+    - In the story function, an action is a parameter of the story. To do several actions during one line, just call story() multiple times without linebreak at the end.
        -> story(switch_background_image="bg_image.png")
      
 
 Design:
-    - revert: story() is a function, but should be heavily overloaded, so it gets 
-used for any kind of interacion with the setting. -> story(background="...", 
-show_image="...", clear_images=True, background_musi="...", play_sound="...", ...)
+    - revert: story() is a function, but should be heavily overloaded, so it gets used for any kind of interacion with the setting. -> story(background="...", show_image="...", clear_images=True, background_music="...", play_sound="...", ...)
       Reason: The story is the central background. 
       It creates the setting, just like an exposition. 
       So it can be treated in a special way. 
       Also this allows story() to rearrange the order of passed arguments, if all get passed in one step -> a simpler way to say "new scene". 
 
 
-This (and other) code can be found at U{http://freehg.org/ArneBab/textrpg}
+This (and other) code can be found at U{http://BitBucket.org/ArneBab/textrpg}
 
 Doctests: 
     >>> story_helper = Story()
-    >>> story_helper.story("The flow changes", autoscroll=True)
-    The flow changes
+    >>> story_helper.story("The flow changes.", autoscroll=True)
+    \033[0GThe flow changes.
+    >>> print "The flow changes."
+    The flow changes.
+    >>> # no output for empty story calls. 
     >>> story_helper.story("", autoscroll=True)
-    <BLANKLINE>
 
 """
 
         Usage: 
             >>> char = Char(source="tag:1w6.org,2008:Mins")
             >>> char.act("walks away.")
-            Mins walks away.
+            \033[0GMins walks away.
         """
         data = _(data)
         for i in data.split("\n"): 

rpg_lib/textrpg_1d6/amov/Namensgrammatik.py

 
 You need either an ID or a tag. If you use a tag, you must set the ID to None, else teh default ID will be used: 
 
-grammar = Grammar(ID=None, art=type, tag=tag)"""
+grammar = Grammar(ID=None, art=type, tag=tag)
+"""
 
 ### Imports ###
 
 # Für das Dateiformat brauchen wir yaml, hier müssen wir yaml nur laden können. 
-from rpg_lib.yaml import load as yaml_load
+try: 
+    from rpg_lib.yaml import load as yaml_load
+except: 
+    from yaml import load as yaml_load
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
 import Skripte.Kernskripte.Objekt as Objekt

rpg_lib/textrpg_1d6/amov/Object.py

 ### Imports ###
 
 # Für das Dateiformat brauchen wir yaml, in dieser Datei müssen wir sie nur laden können. 
-from rpg_lib.yaml import load as yaml_load
+try: 
+    from rpg_lib.yaml import load as yaml_load
+except: 
+    from yaml import load as yaml_load
 
 # Um die Dateien zu laden, nutzen wir die Objekt-Klasse. 
 import Skripte.Kernskripte.Objekt as Objekt

rpg_lib/textrpg_1d6/amov/Skripte/Kernskripte/Objekt.py

 ### Imports ###
 
 # Für das Dateiformat brauchen wir yaml, wir brauchen load udn dump
-from rpg_lib.yaml import load as yaml_load
-from rpg_lib.yaml import dump as yaml_dump
+try: 
+    from rpg_lib.yaml import load as yaml_load
+    from rpg_lib.yaml import dump as yaml_dump
+except: 
+    from yaml import load as yaml_load
+    from yaml import dump as yaml_dump
 
 # Für die Übersetzung von IDs in Dateinamen brauchen wir noch tag_zu_datei
 

rpg_lib/textrpg_1d6/namegen/pycfnamegen/cfnamegen.py

 import random
 import re
 import sys
-from rpg_lib import yaml
+try: 
+    import yaml
+except: 
+    from rpg_lib import yaml
 
 
 class GrammarError(RuntimeError):