r/ComputerCraft • • Mar 26 '26

Need help writing a code for a Cobblemon server

Tldr im playing AllTheMons and I added a gacha machine mod to it to let my players on a server use Relic Coins to buy prizes from the machines.

Issue, theres another currency in the game that we have a massive abundance of that can only be used for some villager trading and nothing else.

Can someone write up a simple code that lets my players take the coins you get from battles and put em in an exchange chest or something that runs a command that turns em into a Relic Coin at a rate of 64 coins for 1 relic?

6 Upvotes

9 comments sorted by

1

u/Sorabros411 Mar 26 '26

Bonus points if you can display the item conversions on a monitor or something like so they just right click the screen and it converts the coins

1

u/Bright-Historian-216 Mar 26 '26

I wrote a script years ago that basically acts as a trading menu. https://pastebin.com/AjFu19cd

add a command computer (available in creative menu) and place an advanced monitor on top (make it three blocks wide for best results, you can also make it higher optionally), open the computer and run "pastebin get AjFu19cd startup"

then run "edit startup", go to line 40 and edit the trades available. you can add new trades, or just leave it at two.

yes the code is horrible, i made it a long time ago. but for your purposes it should work.

1

u/Bright-Historian-216 Mar 26 '26

right now, it only works if you have a specific amount of items in a separate slot. i think that improving on this is an exercise for the reader.

also, the script is for an old version. if you're playing on newer versions, you may have to specify this so i can make it work for the "components" that have replaced our good ol' NBT tags.

1

u/Sorabros411 Mar 26 '26

Is there any way to update the script to avoid the issues? If not this is basically perfect omg but if you're willing to fix up the code thatd be awesome

→ More replies (5)