1. Arne Babenhauserheide
  2. TextRPG


dr...@bach  committed 2600ddd

Made story accept anzy optional arguments and keywod arguments.

  • Participants
  • Parent commits b7f6002
  • Branches default

Comments (0)

Files changed (1)

File textrpg.py

View file
  • Ignore whitespace
     - Simple to use functions in easy to read scriptfiles in the style of the ministory file. 
     - char.compete(other, skill_name) -> See who wins and by how much. 
-    - say() instead of story()?
+    - a basic implementation as minimal api reference for anyrpg plugins.
     - Lazy loading modules, to be able to print stuff at once without having to print before the imports.
         return won, [deep_wounds_self, critical_wounds_self, self.damage_self], [deep_wounds_other, critical_wounds_other, self.damage_other]
-def ask(question=None): 
+def ask(question=None, *args, **kwds): 
     """Ask a question."""
     if question is not None: 
         return raw_input(_(question) + " ")
-def story(data=None):
+def story(data=None, *args, **kwds):
     if data is not None: 
         data = _(data)
         for i in data.split("\n"): 
             if i.strip() != "": 
                  diag(i, localize=False)
              # If the string is empty, just add a blank line without the characters name. 
-            else: diag("...", localize=False)
+            else: diag("...", localize=False, *args, **kwds)
 def save(chars=[]):
         for i in chars:
-def diag(data, localize=True):
-	if localize: 
-		raw_input(_(data))
-	else: raw_input(data)
+def diag(data, localize=True, autoscroll=False, *args, **kwds):
+    if localize: 
+        text = _(data)
+    else: text = data 
+    if not autoscroll: 
+	raw_input(text)
+    else: 
+        print text
+        sleep(len(text)*0.1)
 def greet(char): 
     diag("Old man: Welcome traveller. You've come to the right place to learn about your heritage.")