RianeSN

Untitled

Sep 16th, 2020 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.06 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. # The above is returning:
  41. # Menu node 'You must include the skill name and amount to add.
  42. # Example: Acrobatics 5.' is either not implemented or caused an error. Make another choice.
  43.  
  44.  
  45.  
  46. # This is what it's supposed to go to:
  47.  
  48. def menunode_skills(caller, raw_string, **kwargs):
  49. #  etc etc...
  50.         options = ({"key": "_default",
  51.                     "goto": (menunode_skill_input)},
  52.                     {"key":"Back",
  53.                     "desc":"Set Your stats",
  54.                     "goto": "menunode_assign_stats"})
  55.  
  56.         return text, options
  57.  
  58.  
  59. # And this other node works fine using the exact same return...
  60. def menunode_assign_skills(caller, raw_string, **kwargs):
  61. # etc etc ...
  62.  
  63.     options = ( {"key": "Continue",
  64.                      "desc": "Add Points",
  65.                      "goto": ("menunode_skills") },
  66.               {"key":"Back",
  67.                         "desc":"Set Your Stats",
  68.                         "goto": "menunode_assign_stats"})
  69.  
Add Comment
Please, Sign In to add comment