Advertisement
RianeSN

Untitled

Sep 17th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.87 KB | None | 0 0
  1. def menunode_skill_input(caller, raw_string, **kwargs):
  2.     player_input = raw_string
  3.     logger.log_msg(f"player_input: {player_input}")
  4.     text = ""
  5.     skill = ""
  6.     amt = ""
  7.     n = 0
  8.     change = 0
  9.     failed = False
  10.  
  11.     if not player_input:
  12.         failed = True
  13.     else:
  14.         if not " " in player_input:
  15.             failed = True
  16.         else:
  17.             for n in player_input:
  18.                 logger.log_msg(f"n is: {n}")
  19.                 if n.isnumeric():
  20.                     amt += n
  21.                 else:
  22.                     skill += n
  23.  
  24.             logger.log_msg(f"Skills: {skill} | Amt: {amt}")
  25.             if not skill or not amt:
  26.                 failed = True
  27.             else:
  28.                 skill = skill.strip()
  29.                 amt = amt.strip()
  30.  
  31.         if failed:
  32.             text += (f"You must include the skill name and amount to add.\nExample: |gAcrobatics 5|n.")
  33.  
  34.             options = {"key": "Continue",
  35.                              "desc": "Add Points",
  36.                              "goto": _menunode_skills }
  37.  
  38.             return text, options
  39.  
  40.  
  41. # ........
  42.  
  43. def _menunode_skills(caller, raw_string, **kwargs):
  44. #  etc, stuff here...
  45.  
  46.         options = ({"key": "_default",
  47.                     "goto": (menunode_skill_input)},
  48.                     {"key":"Back",
  49.                     "desc":"Set Your stats",
  50.                     "goto": "menunode_assign_stats"})
  51.  
  52.         return text, options
  53.  
  54. # below works fine... only difference with that node goto is it's in "" instead
  55.  
  56. def menunode_assign_skills(caller, raw_string, **kwargs):
  57. # etc etc ...
  58.  
  59.     options = ( {"key": "Continue",
  60.                      "desc": "Add Points",
  61.                      "goto": ("menunode_skills") },
  62.               {"key":"Back",
  63.                         "desc":"Set Your Stats",
  64.                         "goto": "menunode_assign_stats"})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement