Fix Commands: "lategame" and "midgame"
Closed this issue · 3 comments
Which Command
lategame
and midgame
What should it do?
Since 3.8.1 changed random_items
's format, these 2 macros don't give items anymore. Adding Tier1Def,Tier2Def,Tier3Def
as a parameter does technically work, but wouldn't fully replicate the old behavior (no weighting).
The command change was made to add support for custom tiers. Yes, it does break compatibility with how the the macro commands used to behave, but they still give items.
Ideally we need to add some weighting option to make the command complete and between random_items {count} tier1:weight1,tier2:weight2,etc
and random_items {count} tier1,tier2 weight1,weight2
I favour the latter because it's less hassle to work with "all" tiers. Still feels a bit clunky and a better approach might exist.
But coming back to the issue, if we want to have the exact same behavior as in the past, it's still possible by using the HG random items method that the old command used to call internally.
Yes, it does break compatibility [...] but they still give items.
I tried both macros several times but never received any items (mod version 3.8.2). The macro sends user.username
as the second argument, which fails to be parsed as a tier and short circuit the whole command.
That's why I suggested adding the parameter Tier1Def,Tier2Def,Tier3Def
. Another possibility would be to try to parse the second argument as a username before trying to parse it as a tier. Not sure what would be better.
My apologies, you're quite right about that. I had never noticed the commands there pass the username. To be honest it is superfluous there as it is set by default to be the user who issued the command. Either removing the username argument or changing the call to random_items 23 all user.username
would work. Or any specific tiers instead of the default all like you suggested.