Advertisement
ShadowsNemesis

Connect4 in 2 codes with images for emojis

Jul 9th, 2022
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.06 KB | None | 0 0
  1. =============================
  2. Connect4
  3. made by ShadowsNemesis#0001
  4. using resets api
  5.  
  6. *****
  7. Note:
  8. 1) you will need to make emojis using the images found in this link https://postimg.cc/gallery/sQHfNMG
  9.  
  10. 2) Both codes are BDScript2
  11. *****
  12.  
  13. Variables:
  14. gameid - value:
  15. opponent1 - value:
  16. opponent2 - value:
  17. turnbattle - value:
  18. enemybattle - value:
  19.  
  20. ===================================
  21. Code 1: (prefix)connect4
  22.  
  23. $nomention
  24. $allowMention
  25. $deletecommand
  26. $onlyIf[$mentioned[1]!=;please mention your opponent when using the command]
  27. $onlyIf[$mentioned[1]!=$authorID;you cant be your own opponent]
  28. $alternativeParsing
  29.  
  30. $c[Please replace all the REPLACE WITH THE EMOJIID FOR _ PIECE with the <:emotename:emotenumber> for the emojis you made]
  31.  
  32. $var[1;$httpPost[https://resapi.up.railway.app/game/connect-4/create;{
  33. "player1": "REPLACE WITH THE EMOJIID FOR RED PIECE",
  34. "player2": "REPLACE WITH THE EMOJIID FOR BLACK PIECE",
  35. "empty": "REPLACE WITH THE EMOJIID FOR NO PIECE"
  36. }]$httpResult[game_id]]
  37.  
  38. $httpPost[https://resapi.up.railway.app/game/connect-4/get-board;{
  39. "game_id": "$var[1]"
  40. }] $description[
  41. $replaceText[$httpResult[board];1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣;;1]]
  42. $setUserVar[gameid;$var[1];$authorID]
  43. $setUserVar[gameid;$var[1];$mentioned[1]]
  44. $setUserVar[enemybattle;$mentioned[1];$authorID]
  45.  
  46. $setUserVar[enemybattle;$authorID;$mentioned[1]]
  47. $setUserVar[opponent1;$authorID;$authorID]
  48. $setUserVar[opponent2;$mentioned[1];$authorID]
  49. $setUserVar[opponent1;$authorID;$mentioned[1]]
  50. $setUserVar[opponent2;$mentioned[1];$mentioned[1]]
  51. $setUserVar[turnbattle;$authorID;$authorID]
  52. $setUserVar[turnbattle;$authorID;$getUserVar[enemybattle]]
  53.  
  54. $footer[$nicknames turn]
  55. $addButton[no;c1-$authorID-$mentioned[1];1;primary;no;]
  56. $addButton[no;c2-$authorID-$mentioned[1];2;secondary;no;]
  57. $addButton[no;c3-$authorID-$mentioned[1];3;primary;no;]
  58. $addButton[no;c4-$authorID-$mentioned[1];4;secondary;no;]
  59. $addButton[no;c5-$authorID-$mentioned[1];5;primary;no;]
  60. $addButton[yes;c6-$authorID-$mentioned[1];6;secondary;no;]
  61. $addButton[no;c7-$authorID-$mentioned[1];7;primary;no;]
  62. $addButton[yes;cq-$authorID-$mentioned[1];Quit;danger;no;]
  63.  
  64. ====================================
  65. Code 2: $onInteraction
  66.  
  67. $onlyIf[$checkContains[$customID;c1-;c2-;c3-;c4-;c5-;c6-;c7-;cq-]==true;]
  68. $nomention
  69. $deletecommand
  70. $if[$checkContains[$customID;$authorID]!=true]
  71. $ephemeral
  72. $description[this is not your game]
  73. $removeButtons
  74. $elseif[$checkContains[$customID;$authorID]==true]
  75. $if[$getUserVar[turnbattle;$authorID]!=$authorID]
  76. $ephemeral
  77. $description[not your turn]
  78. $removeButtons
  79. $elseif[$getUserVar[turnbattle;$authorID]==$authorID]
  80. $if[$checkContains[$customID;cq-]!=true]
  81. $textSplit[$customID;-]
  82. $httpPost[https://resapi.up.railway.app/game/connect-4/drop;{
  83. "game_id": "$getUserVar[gameid;$authorID]",
  84. "column": $sub[$replaceText[$splitText[1];c;;1];1],
  85. "player": $replaceText[$replaceText[$checkCondition[$getUserVar[opponent1;$authorID]==$authorID];true;1;1];false;2;1]
  86. }]
  87. $if[$httpResult[winner]!=none]
  88. $title[__Winner:__ $nickname[$replaceText[$replaceText[$httpResult[winner];1.000000;$getUserVar[opponent1;$authorID];1];2.000000;$getUserVar[opponent2;$authorID];1]]]
  89. $thumbnail[$userAvatar[$replaceText[$replaceText[$httpResult[winner];1.000000;$getUserVar[opponent1;$authorID];1];2.000000;$getUserVar[opponent2;$authorID];1]]]
  90. $removeButtons
  91. $endif
  92. $description[$replaceText[$httpResult[board];1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣;;1]]
  93.  
  94. $setUserVar[turnbattle;$getUserVar[enemybattle];$authorID]
  95. $setUserVar[turnbattle;$getUserVar[enemybattle];$getUserVar[enemybattle]]
  96. $if[$httpResult[winner]==none]
  97. $footer[$nickname[$getUserVar[turnbattle;$authorID]]s turn]
  98. $endif
  99. $elseif[$checkContains[$customID;cq-]==true]
  100. $description[$nickname has quit the game]
  101. $removeButtons
  102. $elseif[$checkContains[$customID;cq-]==true]
  103. $description[$nickname has quit the game]
  104. $removeButtons
  105. $endif
  106. $endif
  107. $endif
  108. $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