Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatched operands #16

Closed
v6 opened this issue May 22, 2021 · 5 comments
Closed

Mismatched operands #16

v6 opened this issue May 22, 2021 · 5 comments

Comments

@v6
Copy link
Contributor

v6 commented May 22, 2021

Looks like we've got a lot of cases of collection defaultdict getting compared to integer values.

Not sure what's going on here, but here's just one example:

Command?add --times 5 --target adult-black-dragon tyrone-the-dragon
17d12
oneechan makes awkward-sounding noises at you, enter the 'exit' command to exit.
Traceback (most recent call last):
  File "basic.py", line 701, in run_assistant
    running = parse_command(command_input_string)
  File "basic.py", line 681, in parse_command
    command_result += str(funcDict[command](argDictCopy))
  File "basic.py", line 509, in addCreature
    applyInit({"target" : nick})
  File "basic.py", line 292, in applyInit
    combatant["initiative"] = statMod(combatant["dexterity"]) + roll("1d20")
  File "basic.py", line 240, in statMod
    return math.floor((stat-10)/2)
TypeError: unsupported operand type(s) for -: 'collections.defaultdict' and 'int'
initiative name type hp/max_hp
22 giant-rat giant-rat 3/3
12 sahuagin#1 sahuagin 11/11
9 goblin goblin 9/9
3 druid druid 21/23
Command?
@v6
Copy link
Contributor Author

v6 commented May 22, 2021

'snot just for Tyrone either:

Command?add --times 5 --target giant-rat rattigan-the-rat
2d6
oneechan makes awkward-sounding noises at you, enter the 'exit' command to exit.
Traceback (most recent call last):
  File "basic.py", line 701, in run_assistant
    running = parse_command(command_input_string)
  File "basic.py", line 681, in parse_command
    command_result += str(funcDict[command](argDictCopy))
  File "basic.py", line 509, in addCreature
    applyInit({"target" : nick})
  File "basic.py", line 292, in applyInit
    combatant["initiative"] = statMod(combatant["dexterity"]) + roll("1d20")
  File "basic.py", line 240, in statMod
    return math.floor((stat-10)/2)
TypeError: unsupported operand type(s) for -: 'collections.defaultdict' and 'int'
initiative name type hp/max_hp
22 giant-rat giant-rat 3/3
12 sahuagin#1 sahuagin 11/11
9 goblin goblin 9/9
3 druid druid 21/23
Command?

@rjb25
Copy link
Owner

rjb25 commented May 22, 2021 via email

@rjb25
Copy link
Owner

rjb25 commented May 28, 2021

Full command should be add --times 5 --target giant-rat --identity rattigan-the-rat

@rjb25
Copy link
Owner

rjb25 commented May 28, 2021

Looking into a better error message for this.

@rjb25
Copy link
Owner

rjb25 commented May 29, 2021

Resolved and future issues should be easier to find.

@rjb25 rjb25 closed this as completed May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants