I would like to have the option to set a variable cost and modify the @counter@ variable for commands, instead of the cost being static and the counter always incrementing by 1.
Use Case: I use custom commands for persistent voting on things like the next game we're going to play. For example, viewers can vote for a game with a command like this:
!game01
Cost: 60 Points
/me @user@, you have spent @cost@ points to add 1 vote to Game01. You now have @points@ points. Game01 has @counter@ votes. @savefile@[C:\Google Drive\$voteGame01.txt,@counter@]
This system works really well but it has a flaw in that if viewers have enough points to vote multiple times, they are forced to enter the command many times in a row, spamming chat. I would like them to be able to enter something like:
!game01 @target@
@setcost@[60*@target@]
@setcounter@[@counter@+@target@]
/me @user@, you have spent (@cost@*@target@) points to add @target@ vote(s) to Game01. You now have @points@ points. Game01 has @counter@ votes. @savefile@[C:\Google Drive\$voteGame01.txt,@counter@]
In this implementation, when the command is parsed, @setcost@ is checked before anything else. If @setcost@ is specified then the default command cost is overridden and the value in @setcost@ is used instead.
Next, @setcounter@ is checked. If @setcounter@ is specified then the counter is modified by that instead of incrementing by 1.
Then the rest of the command plays out based on the newly modified cost and counter values. An Insufficient Points error will still be issued if the variable cost exceeds the user's total points; the command will not be executed.
This could also be useful for people trying to use the @counter@ variable as a special, command-unique stored number in other novel ways.