Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =============================
- Connect4
- made by ShadowsNemesis#0001
- using resets api
- *****
- Note:
- 1) you will need to make emojis using the images found in this link https://postimg.cc/gallery/sQHfNMG
- 2) Both codes are BDScript2
- *****
- Variables:
- gameid - value:
- opponent1 - value:
- opponent2 - value:
- turnbattle - value:
- enemybattle - value:
- ===================================
- Code 1: (prefix)connect4
- $nomention
- $allowMention
- $deletecommand
- $onlyIf[$mentioned[1]!=;please mention your opponent when using the command]
- $onlyIf[$mentioned[1]!=$authorID;you cant be your own opponent]
- $alternativeParsing
- $c[Please replace all the REPLACE WITH THE EMOJIID FOR _ PIECE with the <:emotename:emotenumber> for the emojis you made]
- $var[1;$httpPost[https://resapi.up.railway.app/game/connect-4/create;{
- "player1": "REPLACE WITH THE EMOJIID FOR RED PIECE",
- "player2": "REPLACE WITH THE EMOJIID FOR BLACK PIECE",
- "empty": "REPLACE WITH THE EMOJIID FOR NO PIECE"
- }]$httpResult[game_id]]
- $httpPost[https://resapi.up.railway.app/game/connect-4/get-board;{
- "game_id": "$var[1]"
- }] $description[
- $replaceText[$httpResult[board];1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣;;1]]
- $setUserVar[gameid;$var[1];$authorID]
- $setUserVar[gameid;$var[1];$mentioned[1]]
- $setUserVar[enemybattle;$mentioned[1];$authorID]
- $setUserVar[enemybattle;$authorID;$mentioned[1]]
- $setUserVar[opponent1;$authorID;$authorID]
- $setUserVar[opponent2;$mentioned[1];$authorID]
- $setUserVar[opponent1;$authorID;$mentioned[1]]
- $setUserVar[opponent2;$mentioned[1];$mentioned[1]]
- $setUserVar[turnbattle;$authorID;$authorID]
- $setUserVar[turnbattle;$authorID;$getUserVar[enemybattle]]
- $footer[$nicknames turn]
- $addButton[no;c1-$authorID-$mentioned[1];1;primary;no;]
- $addButton[no;c2-$authorID-$mentioned[1];2;secondary;no;]
- $addButton[no;c3-$authorID-$mentioned[1];3;primary;no;]
- $addButton[no;c4-$authorID-$mentioned[1];4;secondary;no;]
- $addButton[no;c5-$authorID-$mentioned[1];5;primary;no;]
- $addButton[yes;c6-$authorID-$mentioned[1];6;secondary;no;]
- $addButton[no;c7-$authorID-$mentioned[1];7;primary;no;]
- $addButton[yes;cq-$authorID-$mentioned[1];Quit;danger;no;]
- ====================================
- Code 2: $onInteraction
- $onlyIf[$checkContains[$customID;c1-;c2-;c3-;c4-;c5-;c6-;c7-;cq-]==true;]
- $nomention
- $deletecommand
- $if[$checkContains[$customID;$authorID]!=true]
- $ephemeral
- $description[this is not your game]
- $removeButtons
- $elseif[$checkContains[$customID;$authorID]==true]
- $if[$getUserVar[turnbattle;$authorID]!=$authorID]
- $ephemeral
- $description[not your turn]
- $removeButtons
- $elseif[$getUserVar[turnbattle;$authorID]==$authorID]
- $if[$checkContains[$customID;cq-]!=true]
- $textSplit[$customID;-]
- $httpPost[https://resapi.up.railway.app/game/connect-4/drop;{
- "game_id": "$getUserVar[gameid;$authorID]",
- "column": $sub[$replaceText[$splitText[1];c;;1];1],
- "player": $replaceText[$replaceText[$checkCondition[$getUserVar[opponent1;$authorID]==$authorID];true;1;1];false;2;1]
- }]
- $if[$httpResult[winner]!=none]
- $title[__Winner:__ $nickname[$replaceText[$replaceText[$httpResult[winner];1.000000;$getUserVar[opponent1;$authorID];1];2.000000;$getUserVar[opponent2;$authorID];1]]]
- $thumbnail[$userAvatar[$replaceText[$replaceText[$httpResult[winner];1.000000;$getUserVar[opponent1;$authorID];1];2.000000;$getUserVar[opponent2;$authorID];1]]]
- $removeButtons
- $endif
- $description[$replaceText[$httpResult[board];1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣;;1]]
- $setUserVar[turnbattle;$getUserVar[enemybattle];$authorID]
- $setUserVar[turnbattle;$getUserVar[enemybattle];$getUserVar[enemybattle]]
- $if[$httpResult[winner]==none]
- $footer[$nickname[$getUserVar[turnbattle;$authorID]]s turn]
- $endif
- $elseif[$checkContains[$customID;cq-]==true]
- $description[$nickname has quit the game]
- $removeButtons
- $elseif[$checkContains[$customID;cq-]==true]
- $description[$nickname has quit the game]
- $removeButtons
- $endif
- $endif
- $endif
- $color[$replaceText[$replaceText[$getUserVar[turnbattle;$authorID];$getUserVar[opponent1;$authorID];FF0000;1];$getUserVar[opponent2;$authorID];000000;1]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement