Esempio n. 1
0
def format_error_message(prefix, msg, entry=None, opcode=None):
  output = [prefix, msg]
  if entry:
    output.append("; at ")
    output.append(repr(entry))
  if opcode:
    output.append(", operation: ")
    output.append(header_operations.get_opcode_name(opcode))
  return "".join(output)
def format_error_message(prefix, msg, entry=None, opcode=None, tag=None):
  message = [prefix, msg]
  info = []
  if tag:
    info.extend([",", " type tag: ", tag])
  if opcode:
    info.extend([",", " operation: ", header_operations.get_opcode_name(opcode)])
  if entry:
    entry_string = repr(entry)
    if len(entry_string) > 100:
      entry_string = entry_string[:100] + " ... <snipped>"
    info.extend([",", " entry: ", entry_string])
  if len(info):
    info[0] = ";"
  return "".join(message + info)
Esempio n. 3
0
def format_error_message(prefix, msg, entry=None, opcode=None, tag=None):
    message = [prefix, msg]
    info = []
    if tag:
        info.extend([",", " type tag: ", tag])
    if opcode:
        info.extend(
            [",", " operation: ",
             header_operations.get_opcode_name(opcode)])
    if entry:
        entry_string = repr(entry)
        if len(entry_string) > 100:
            entry_string = entry_string[:100] + " ... <snipped>"
        info.extend([",", " entry: ", entry_string])
    if len(info):
        info[0] = ";"
    return "".join(message + info)
Esempio n. 4
0
#!/usr/bin/python

import argparse
import header_operations

parser = argparse.ArgumentParser(
    description=
    "Convert an opcode from an error message in Mount&Blade Warband to the matching operation name."
)
parser.add_argument("opcode",
                    type=int,
                    help="the opcode from the error message")
args = parser.parse_args()

print header_operations.get_opcode_name(args.opcode)
#!/usr/bin/python

import argparse
import header_operations

parser = argparse.ArgumentParser(description="Convert an opcode from an error message in Mount&Blade Warband to the matching operation name.")
parser.add_argument("opcode", type=int, help="the opcode from the error message")
args = parser.parse_args()

print header_operations.get_opcode_name(args.opcode)