Skip to content

Module Movement Broken #1

@PAdventures

Description

@PAdventures

The movement commands to move to connecting modules doesn't work. You need to input the command once, then wait for the module to re-load before you can execute the command which will work by then.

I am looking into this issue

If you can spot the immediate issue please let me know

if action.find("M") == 0:
  # Delare a variable to be used in all indentations
  move = ""
  # If the input equal "M" or "MOVE"
  if action == "M" or action == "MOVE":
      # Ask the user for more input
      print("Enter the module to move to or go back to the actions || Example: 2 or B or BACK")
      move = input("> ")
      # Force the input to become lower cased
      move = move.lower()
  # If the input length equals 2
  if len(action) >= 2 and len(action) <= 3:
      # Turn the input into an array of all characters
      actionArray = list(action)
      if len(action) == 2 and action[1].isnumeric():
          move = int(actionArray[1])
      elif (actionArray[1] + actionArray[2]).isnumeric():
          move = int(actionArray[1] + actionArray[2])
  # If the input length equals 5 and it starts with "MOVE"
  if len(action) >= 5 and len(action) <= 6 and action.startswith("MOVE"):
      # Turn the input into an array of all characters
      actionArray = list(action)
      if len(action) == 5 and actionArray[4].isnumeric():
          move = int(actionArray[4])
      elif (actionArray[4] + actionArray[5]).isnumeric():
          move = int(actionArray[4] + actionArray[5])
  # If the input or "move" equals "back" or "b"
  if action == "back" or action == "b" or move == "back" or move == "b":
      # Stop the function and reload the module
      return reload_module()
  # If the variable "move" is a string
  elif str(move).isnumeric() == False:
      # Stop the function and reload the module
      return reload_module()
  # If "move" is a number and it is in the "possible_moves" array
  elif int(move) in possible_moves:
      # Allow the loop to end
      valid_action = True
      # Change the global variables
      last_module = curr_module
      curr_module = move
      power -= 1
      # If there is no power left in the station
      if power <= 0:
          # Set the player to no longer be alive and then stop the function
          alive == False
          return
  # Or if the "move" is not in "possible_moves"
  else:
      # Wait 1 second
      sleep(1)
      # Tell the player that the module they want to move to must be connected to the current module
      print("\n\nThe module must be connected to the current module.")
      # Wait 3 more seconds
      sleep(3)
      # Stop the function and re-load the module
      return reload_module()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions