Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TETRIS for BDFD
- - Game by Rajat#1004
- - API by reset#8278
- Code 1
- --------------------------------------------------------------------------------
- Trigger : ?connect4
- Language : BDScript 2
- Code :
- $nomention
- $httpPost[https://api.resetxd.xyz/game/connect-4/create;{
- "player1": "🟣",
- "player2": "🔴",
- "empty": "⬛"
- }]
- $onlyIf[$httpResult[success]!=some unknown error;‼️ API Down!]
- $if[$mentioned[1]!=]
- <a:red_loading:854368597853339648> <@$mentioned[1]>'s Turn
- $title[$username[$mentioned[1]]'s Turn]
- $newSelectMenu[$authorIDc4play$mentioned[1];1;1;Select Position]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 1;$httpResult[game_id] 0 2 1;;no;1️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 2;$httpResult[game_id] 1 2 1;;no;2️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 3;$httpResult[game_id] 2 2 1;;no;3️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 4;$httpResult[game_id] 3 2 1;;no;4️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 5;$httpResult[game_id] 4 2 1;;no;5️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 6;$httpResult[game_id] 5 2 1;;no;6️⃣]
- $addSelectMenuOption[$authorIDc4play$mentioned[1];Position 7;$httpResult[game_id] 6 2 1;;no;7️⃣]
- $else
- <a:red_loading:854368597853339648> <@$authorID>'s Turn
- $title[$username[$authorID]'s Turn]
- $newSelectMenu[c4withbot$authorID;1;1;Select Position]
- $addSelectMenuOption[c4withbot$authorID;Position 1;$httpResult[game_id] 0 0;;no;1️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 2;$httpResult[game_id] 1 0;;no;2️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 3;$httpResult[game_id] 2 0;;no;3️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 4;$httpResult[game_id] 3 0;;no;4️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 5;$httpResult[game_id] 4 0;;no;5️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 6;$httpResult[game_id] 5 0;;no;6️⃣]
- $addSelectMenuOption[c4withbot$authorID;Position 7;$httpResult[game_id] 6 0;;no;7️⃣]
- $endif
- $footer[Connect 4 to win]
- $color[aa8ed6]
- $description[🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪$repeatMessage[9;⬛]🟪⬛
- ⬛🟪⬛1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣⬛🟪⬛
- 🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳🔳]
- Code 2
- ---------------------------------------------------------------------------------------------
- Trigger : $onInteraction
- Language : BDScript 2
- Code :
- $nomention
- $suppressErrors[Having troubles? check this extra space after the `$.httpResult[board\];` part. There are 6 of these in the code and remove the ghost space after them https://cdn.discordapp.com/attachments/837219640874631197/984377616192663573/unknown.png]
- $if[$checkContains[$customID;c4play]==true]
- $textSplit[$replaceText[$customID;c4play; ;1] $message; ]
- $var[7;$replaceText[$replaceText[$splitText[5];1;🟥;1];2;🟪;1]]
- $var[9;$replaceText[$replaceText[$splitText[5];2;🟥;1];1;🟪;1]]
- $var[10;$replaceText[$replaceText[$var[7];🟥;dd2e44;1];🟪;aa8ed6;1]]
- $var[11;$replaceText[$replaceText[$var[7];🟥;aa8ed6;1];🟪;dd2e44;1]]
- $if[$authorID==$splitText[2]]
- $httpPost[https://api.resetxd.xyz/game/connect-4/drop;{
- "game_id": "$splitText[3]",
- "column": $splitText[4],
- "player": $splitText[5]
- }]
- $removeComponent[$customID]
- $if[$httpResult[winner]==none]
- <a:red_loading:854368597853339648> <@$splitText[1]>s Turn
- $title[$username[$splitText[1]] is playing]
- $footer[Connect 4 to win]
- $color[$var[10]]
- $description[$repeatMessage[10;🔳]🔳🔳🔳
- ⬛$var[7]⬛$replaceText[$httpResult[board];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 1/7]
- ;⬛$var[7]⬛
- ⬛$var[7]⬛;-1]⬛$var[7]⬛
- $repeatMessage[10;🔳]🔳🔳🔳
- ]
- $newSelectMenu[$splitText[2]c4play$splitText[1];1;1;Select Position]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 1;$splitText[3] 0 $splitText[6] $splitText[5];;no;1️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 2;$splitText[3] 1 $splitText[6] $splitText[5];;no;2️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 3;$splitText[3] 2 $splitText[6] $splitText[5];;no;3️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 4;$splitText[3] 3 $splitText[6] $splitText[5];;no;4️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 5;$splitText[3] 4 $splitText[6] $splitText[5];;no;5️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 6;$splitText[3] 5 $splitText[6] $splitText[5];;no;6️⃣]
- $addSelectMenuOption[$splitText[2]c4play$splitText[1];Position 7;$splitText[3] 6 $splitText[6] $splitText[5];;no;7️⃣]
- $else
- $var[9] **<@$authorID> Wins**
- $title[Game Ended]
- $footer[Connect 4 to win]
- $color[$var[11]]
- $description[$repeatMessage[10;🔳]🔳🔳🔳
- ⬛$var[9]⬛$replaceText[$httpResult[board];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 2/7]
- ;⬛$var[9]⬛
- ⬛$var[9]⬛;-1]⬛$var[9]⬛
- $repeatMessage[10;🔳]🔳🔳🔳
- ]
- $channelSendMessage[$channelID;$var[7] <@$splitText[1]>, you lost!]
- $endif
- $else
- $ephemeral
- $removeComponent[$customID]
- ‼️ Hey it's <@$splitText[2]>'s turn!
- $endif
- $endif
- $if[$checkContains[$customID;c4withbot]==true]
- $textSplit[$replaceText[$customID;c4withbot;;1] $message; ]
- $if[$authorID==$splitText[1]]
- $httpPost[https://api.resetxd.xyz/game/connect-4/drop;{
- "game_id": "$splitText[2]",
- "column": $splitText[3],
- "player": 1
- }]
- $if[$httpResult[winner]==none]
- $editMessage[$channelID;$messageID;<a:red_loading:854368597853339648> Bots Turn;Botuu is Playing;$repeatMessage[10;🔳]🔳🔳🔳
- ⬛🟥⬛$replaceText[$optOff[$httpResult[board]];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 3/7]
- ;⬛🟥⬛
- ⬛🟥⬛;-1]⬛🟥⬛
- $repeatMessage[10;🔳]🔳🔳🔳;dd2e44;Connect 4 to win.]
- $var[data;$replaceText[$replaceText[$replaceText[$replaceText[$httpResult[board];⬛;0;-1];🔴;2;-1];🟣;1;-1];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 4/7]
- ;;-1]]
- $var[predata;$cropText[$var[data];7;]]
- $var[data;$cropText[$var[predata]$var[data];49;]]
- $httpGet[http://kevinalbs.com/connect4/back-end/index.php/getMoves?board_data=$var[data]&player=2]
- $var[count;0]
- $var[col;1]
- $try$if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry$var[col;$sum[$var[col];1]]$try
- $if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry$var[col;$sum[$var[col];1]]$try
- $if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry$var[col;$sum[$var[col];1]]$try
- $if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry$var[col;$sum[$var[col];1]]$try
- $if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry$var[col;$sum[$var[col];1]]$try
- $if[$optOff[$httpResult[$var[col]]]>$optOff[$httpResult[$var[count]]]]
- $var[count;$var[col]]$endif$endtry$try
- $if[$optOff[$httpResult[$var[col]]]==$optOff[$httpResult[$var[count]]]]
- $var[count;$randomText[$var[count];$var[col]]]
- $endif$endtry
- $httpPost[https://api.resetxd.xyz/game/connect-4/drop;{
- "game_id": "$splitText[2]",
- "column": $var[count],
- "player": 2
- }]
- $if[$optOff[$httpResult[winner]]==none]
- $editMessage[$channelID;$messageID;<a:loaddotbar:849050488640503829>•Your Turn <@$authorID>;$username is Playing;$repeatMessage[10;🔳]🔳🔳🔳
- ⬛🟪⬛$replaceText[$optOff[$httpResult[board]];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 5/7]
- ;⬛🟪⬛
- ⬛🟪⬛;-1]⬛🟪⬛
- $repeatMessage[10;🔳]🔳🔳🔳;aa8ed6;Connect 4 to win.]
- $else
- **Game Ended**
- $title[Botu Won!]
- $description[$repeatMessage[10;🔳]🔳🔳🔳
- ⬛🟥⬛$replaceText[$optOff[$httpResult[board]];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 6/7]
- ;⬛🟥⬛
- ⬛🟥⬛;-1]⬛🟥⬛
- $repeatMessage[10;🔳]🔳🔳🔳]
- $color[dd2e44]
- $footer[Connect 4 to win.]
- $removeComponent[$customID]
- $channelSendMessage[$channelID;<@$authorID>, you lost!]
- $endif
- $else
- **Game Ended**
- $title[You Won!]
- $description[$repeatMessage[10;🔳]🔳🔳🔳
- ⬛🟪⬛$replaceText[$optOff[$httpResult[board]];$c[‼️‼️‼️‼️ Delete all the spaces after this comment if any ‼️‼️ 7/7]
- ;⬛🟪⬛
- ⬛🟪⬛;-1]⬛🟪⬛
- $repeatMessage[10;🔳]🔳🔳🔳]
- $color[aa8ed6]
- $footer[Connect 4 to win.]
- $removeComponent[$customID]
- $channelSendMessage[$channelID;<@$authorID>, you won!]
- $endif
- $else
- $ephemeral
- $removeComponent[$customID]
- ‼️ Hey it's <@$splitText[1]>'s game. Not yours!
- $endif
- $endif
Add Comment
Please, Sign In to add comment