Reaction-Time based Quick Draw Duels

Description

This extension allows for interactive, reaction-time based Duels in a Quick Draw style: Whoever shoots first wins, but shooting too early means losing. It works with the VRFlad points-system to allow for bets on the duel.

How it works

  1. !duel [user (optional)] [amount of points (optional)] to challenge someone to a duel → e.g. !duel userXY 100 would challenge userXY for 100 points.
    If there is no name specified, anyone in chat can accept the challenge and if there is no amount of points specified, it takes a standard amount which can be set in the arguments. “all” and a number with “%” also works to set an amount.
  2. Once the challenge is out, there’s a 1 minute window to !accept or !decline the duel. Decline is only available if a person is specified.
  3. If it’s being accepted, there’ll be a short message, instructing the 2 dueling chatters to get ready to type !shoot.
  4. After a delay of between 7 and 30 seconds, they will have to type !shoot - the quicker one wins the duel and the points that have been bet.
    If someone shoots too early, they will automatically lose the duel and the points to the other person.

Extras

  • In some occasions, there will be a “Hold…” message after a bit of delay, to make the duels more spicy. In even rarer occasions, there will be a 2nd message saying “Not yet…”. Both of these should not be reacted to as it would result in an early shot.
  • If your bot account gets challenged (which can be set in the arguments), it will automatically accept the duel and shoot after a delay of about 300ms.
  • Reaction times, wins and losses all get tracked and can be retrieved with !duelstats
  • Multiple wins in a row (minimum 3) will result in a win streak, which will earn bonus points per win. Shutting down a win streak also earns bonus points.
  • There can be multiple duels involving different people at the same time, but only 1 challenge at all times. E.g.: User1 can duel User2. After their duel starts, User3 can duel User4 so they’re ongoing simultanously. None of the involved users can accept or start another duel though until their own is finished.
    *!cancel can be used to cancel a challenge, it also automatically cancels after a minute if no one accepts.

Import Code

Duels.sb (13.3 KB)

Installation

In Streamer.bot in select Import from the top left.
Copy the Import Code and paste it into the Import String.

When importing you should have 5 actions

Duel Accept
Duel Cancel
Duel Decline
Duel for Points
Duel Shoot
Duel Stats

You should also have 5 Commands, which will need to be enabled

!accept
!cancel
!decline
!duel
!duelstats
!shoot

You will need the following references to ensure the code compiles.

mscorelib.dll
System.Core.dll

References are already added to the Actions, so they should compile correctly right away without the need of any further installation.

Configuration

In the action “Duel for Points” you will find 3 arguments:
botname This is the name of your bot account for automatic duels with it
standardAmount This is the amount the bet will be if the user doesnt specify
minimumAmount This is the minimum amount that will have to be bet for a challenge
streakAmount This is the amount someone will get on a hot streak (3+ wins). For every subsequent win, it adds the same amount on top of it. Shutting down someone elses streak will earn you the last streak bonus the other person got.

2 Likes

Looks like it works from my testing, one thing i would advise is to add the System.core dll to the actual actions so the end user doesnt need to add them.

Its one less thing for the user to worry about

Thank you, added it and edited the post. :slight_smile:

Heya, ran a few tests on it. My current “issue” is when the duel got accepted and it’s written that the people should shoot. If no one writes !shoot, the action will forever be pending. I’m thinking it might be better to also add a certain time windows in which the people should shoot. If no one shot in that timeframe then either count the duel as invalid, or perhaps even remove the betted points from both accounts.

Another scenario which shouldn’t happen would be that if someone create a duel anyone challenge, so “!duel”, they themself are able to accept the duel, which could lead to some weird stats.

One last thing is, there is no way to cancel a duel. So if someone accidently challenges the wrong person, they are not able to cancel before the other party would accept

Hey, thank you for the feedback! I edited the post and the import-code file. It should all be fixed now! I have already implemented a way to automatically expire duels when no one shoots before, but whenever I added more stuff, I did a mistake in one of the while-loops that made it go for way longer than intended, so that’s working fine now.
Dueling yourself is also no longer possible.
Challenges should’ve already automatically expired after a minute, but I added a way to cancel them with !cancel, which is only usable by the person challenging.

Edit: I think I hit the Reply button to the wrong message, that was supposed to be a Reply to pwnyy, but it doesn’t let me fix it I think.

Looks like those issues are fixed, awesome!
I think I found one last issue with the duel challenge.
There technically can be two ongoing challenges. Once someone User1 does !duel, User2 !accept, Then another user is able to write !duel again to create another challenge

That’s all that is left if I checked it correclty :slight_smile:

Thank you! Oh that was actually intended, maybe just worded a bit poorly by myself. The !shoot interaction is made in a way that it recognizes which duel it is used for by having a key that includes both usernames involved in each duel. Having only one challenge at a time in this case would mean that as soon as a challenge is accepted, it’s supposed to be open again for someone else to challenge another user. To make it more clear on what’s possible and what isn’t, here’s an example:

User1 challenges User2 to a duel → User2 accepts, so both are in a duel → Both User1 and User2 can’t accept another duel or start a new challenge to another UserX but User3 can now challenge User4 to a different duel, which can be accepted right away, even while the duel between User1 and User2 is still ongoing.

Do you think I should word it differently in the post or still change anything up regarding this?

Might be best to word it differently then haha
Although in my testing the following was the case, of course this is really a rare case:
pwnyytv: !duel
pwnyybot: !accept
Challenge started
pwnyybot: !duel
pwnyytv: !accept
Another challenge started
Shoot now message of one duel happens
pwnyytv/pwnyybot: !shoot
shot too early

This happened when both those challenges did not write the shoot now message yet and both or possibly one user is in a duel challenge. But like I said this is a rare case lol

Edited the post → I changed the wording and the code as the scenario you mentioned shouldn’t have been able to happen. It should all be fixed now, any user can only be in 1 active duel but multiple duels involving all different people can be going on at the same time. :slight_smile:

Awesome, seems to behave normally now!

1 Like