The Challenge! Automated, Randomized Fighting Chat Game!


Hi Yoshiro here again.

A game script I made after learning a bit here and there. Download is just after “Installation Instructions”.

With many people’s help, the script is currently capable of saving settings to the database and also changable via the subcommand of !challenge. If the chat gets too clog up by the script, captions can be turned off to allow only the result while points can be waged for the fight(On by default.) Details are as below.

@ArthurTheLastAncient: Bugs, features and all sorts of other stuff were truly done by him. Thank him for all the convenience feature made for it.
yxpoh: Just the base game and some small stuff :stuck_out_tongue:
@TheRealAlixe: Web UI and a few bug fixes

Credits: The changes to the script has reached a point where I only did the base of the system.
@TheRealAlixe and @ArthurTheLastAncient have been contributing lots of stuff to the script itself.
Also, kudos to @UsernamesSuck for giving multiple comments and suggestions initially.

Example of it:
(You do not see the reply because I used the control panel to execute the reply statement as below)


Just throwing this out here for those that wants to give it a try.

Installation instructions (Easy mode)

  1. Shut down PhantomBot
  2. Download this file: challengeSystem.zip1 (6.4 KB)
  3. Unpack into the base directory of your PhantomBot installation
  4. If you want the control panel options, download this file: challengeControlPanel.zip1 (9.7 KB)
    Otherwise, skip to step 7
  5. Close any browser windows and/or tabs with the control panel opened
  6. Unpack into the base directory of your PhantomBot installation.
    WARNING The following three (3) files will be overwritten:
  7. Restart PhantomBot

Update instructions

  1. Make sure PhantomBot is running
  2. type into (twitch)chat: “!module delete ./custom/games/challenge.js” (Don’t worry, this is because the file is renamed. Your settings won’t be touched)
  3. Shut down Phantombot
  4. Delete .\scripts\custom\games\challenge.js
  5. Delete .\scripts\lang\custom\games-challenge.js
  6. Continue with installation instructions

Version 1.9.1 KB)

Version 1.8.2 (Updated Files only) (7.3 KB)

Version 1.8.1 (16.6 KB)
More Details: The Challenge! Automated, Randomized Fighting Chat Game!

Version 1.8 Kudos to @ArthurTheLastAncient and @TheRealAlixe for theirs efforts in adding so much features to the original base game I have made. (16.6 KB)

Format to change settings: (Editable from web as well) (Will be updated soon)
!challenge - Challenges another user to a fight
!challenge set - Base settings command, displays all options changeable through the command
!challenge set minDamage - Sets the minimum damage for an attack
!challenge set maxDamage - Sets the maximum damage for an attack
!challenge set attackRate - Sets the success (hit/miss) rate of an attack
!challenge set health - Sets the starting health (HP) of each player
!challenge set timeout - Sets the time the challenger has to accept the challenge in seconds
!challenge set wager - Sets the bet/wager to fight for. Set to 0 to disable the use of currency
!challenge set messageInterval - Sets the seconds of delay between messages in chat.
!challenge set captions - Sets the maximum of attack/dodge descriptions to show. Set to 0 to go straight to the results
!challenge reset - Resets the challenge module and reloads all data. Use it when you change attack/dodge descriptions and don’t want to restart your bot, or when you want to clear an ongoing challenge. (Does not affect settings)

Adding new move sets
In games-challenge.js
Follow the format of ‘challenge.fight.’ or '’ where * is a set of continuous number you can see in the file.
$1,$2,$3 are required in fight, while $1,$2 are required in dodge,
(where $1=attacker, $2=defender, $3=damage dealt.)
Note: Ensure that * is always continuous, as it will keep all other numbers that are off the consecutive list.

For anyone who do tried my game, please give me your views on it too.

Changelog: (Will update when ready)
Version 1.91

Version 1.82
By @ArthurTheLastAncient

  • Added check if challenged user actually is seen before by the bot with appropriate language string.
  • Added check if pointSystem is enabled before checking wager/currency, will issue a log.warning if the pointSystem is off and disable any wager functionality. (But does not touch the current wager setting)
  • “!challenge set wager” won’t allow changing of wager if the pointSystem is disabled and informs the user of this with appropriate language string. Setting of wager is still doable from the control panel, although it won’t have any effect.
  • Cleaned up some language strings
  • Accidentally included my custom moves in the last update. Restored the original moveset.

Version 1.81

  • Bugfixes by @ArthurTheLastAncient

Version 1.8

  • Fixed a bug where you could challenge yourself, including sassy message
  • Added User Cooldown/Recoverytime option in Minutes.
  • Added the appropriate language lines
  • Added the new setting to the control panel

Version 1.7 and earlier (Will be making a quick summary. I hope.)
-Too much to keep track. Thanks to @TheRealAlixe and @ArthurTheLastAncient. :stuck_out_tongue:

!challenge the bot

yxpoh you should always make a custom folder for custom scripts like


instead of using the main folders then its easyer to know what is standard and what is not


I see. Thanks.

I didn’t know the bot was smart enough to scan through the child folders.

EDIT: Sorry, the text doesn’t seem to appear when I moved them to the custom folders.


Pro tip: Values that you want to edit should be defined as variables at the top of the document.

Such as:

 var attactSuccess = 0.65,
 attackDamageMin = 1,
 attackDamageMax = 4;

That way you don’t have to keep going to obscure lines to find the values to adjust, you just change the variable at the top and you’re good to go.

But good work. I didn’t read over anything else other than what was highlighted in the post.


Also making a command to edit them is always smart too

yxpoh make sure u change the locations in the scripts them self too


Hey UsernamesSuck, Thanks. will go try doing it.

The RealAlixe,
Yeah, I can do just that too. That’s definitely simpler than making a UI for it in the panel :stuck_out_tongue:

But as said, moving the scripts to the locations you have suggested made the script not display text.
Reason for that is because I see the script loaded just fine but when I ran the command, nothing comes out; I can only think of the lang file not loading.


maybe check the console and see if it posts the error???


Nope no error.

But I finally sort the problem out. It’s not just a simple move of files.
Initready has to be changed to fit the new directory. It’s working now.

Going on to moving the constant variables and adding commands to simplify changing settings :smiley:

EDIT: Any idea how to check sender if he is at least moderator and above?


$.isMod(sender) will work


Haven’t gotten users to help test the mod check script, but Thanks!

Editing the above to reflect new changes:

  • Commands to change settings
  • Constant variables for settings
  • Scripts to be placed in custom folders.

Update with Verision 1.1…

Always wanted to try adding a changelog :stuck_out_tongue:


Updated some misc with Version 1.2
Edited to use clearTimeout to stop Timeout sequence when a fight is confirmed and about to start.
Allows different messages for expiry and match end.
Set a restriction in fight() to refrain from using the same moves on the next turn.


Version 1.3
Now, whether if someone adds ‘@’ into the names of the opponent it will still be able to recognize the other party, as ‘@’ is removed during checking and storing of temp data.
Constant timeout added, also timeout can be set via settings sub-command.(Missed this out while doing the other constants)


Hey, I’ve been looking for something like this and I’m happy to see you’ve already made this into quite the addon! Thanks for your hard work.

I’ve had some ideas of my own though and I’ve been tinkering with your scripts a bit. Since you might be interested in integrating these new features yourself, I’ll post the updated scripts: Dropbox Link

I’ve made the following changes:

  • Setting values are now stored in the PhantomBot Database for preservation between bot starts, under “challengeSettings”, “optionname”
  • Changed the attackSuccess type from float to integer from 1 to 100 (percentage) for ease of use.
  • Added “wager” option to set a wager, winner takes all. It’s a global value for all challenges and can be set through "!challenge settings wager ". Issues automatic warning messages if a challenger or the challenged doesn’t have enough currency, using currency names from the database automatically. Can be set to 0 to disable the need for currency.
  • Wager is taken from the challenger’s account upon challenge issued, and will be restored if challenged user doesn’t accept. Challenged user’s currency is only affected upon acceptance.
  • Language file has been updated to accommodate wager.
  • Added a response when a setting is changed successfully.
  • Added a “pause” of 5 seconds in between chat messages in case people set high health and/or low damage to ensure the bot account doesn’t get globally banned and make the chat seem less cluttered.
  • An incoming challenge can now also be accepted with “!challenge accept”.
  • Updated the language file to display how to accept a challenge upon issue for ease of use.

Hi Arthur. I am glad the script was useful and thank you for the updates.

I have included your scripts in the main thread for more people to see.

1 Like

Not to be picky but for this is there any way to hide the attacks and only show the start and the result as it gets a bit spammy???

maybe have a hide attack setting that will hide all the attacks in between?


That can be done, but I am currently not as free to go through that right now.

Also, the purpose of the script was actually to have a fun “text” fist-fight with the chat-members, so that isn’t really thought of as an option.

PS: I am actually surprised that this thread is still active. lol…


Ya other then this option i really like this script :slight_smile: ya i could add this but i find it a pain to go though someone else work to add this so will wait for some one to do so


Version 1.4

  • Added with Battle Captions on/off

Added settinsg as a sub command so you can set the permissions in the permission tab instead of ismod so i can make it admin instead
challengeGame.js (10.5 KB)

Removed challenge.usage.noperm as its not needed
games-challengeGame.js (3.8 KB)