rjb25 / 5e-dm-assistant

An assistant python script to be run for keeping track of health and automatically running attacks in combat for dnd 5e
1 stars 1 forks source link

Mismatched operands #16

Closed v6 closed 3 years ago

v6 commented 3 years ago

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 commented 3 years ago

'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 commented 3 years ago

--identity is for Nick names

On Sat, May 22, 2021, 1:56 AM Nathan Basanese @.***> wrote:

'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(funcDictcommand) 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?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rjb25/5e-dm-assistant/issues/16#issuecomment-846356025, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7UJNZM3OJAZ66BWKAUCNTTO5BPJANCNFSM45KJWZWA .

rjb25 commented 3 years ago

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

rjb25 commented 3 years ago

Looking into a better error message for this.

rjb25 commented 3 years ago

Resolved and future issues should be easier to find.