Main Menu

CC:tweaked with Create

Started by TheMusicAddicyZ, Aug 30, 2024, 07:06 PM

Previous topic - Next topic
hello so i am trying to make some programs to aid with the mod create and trains addons for it i basically wanna write a OS system to run the factories for create where i can tell it to stop and start and stop certain bits of the process line aswell as tell it what to create i also wanna make a signalbox system where a train would run over a observer the redstone signal would be picked up and a notification would ping the signal computer and tell a train is comming on this certain line but i have veery limited knowledge on CC so if possible i would really love to get some help and understanding of whats possible and whats not

QuickMuffin8782

Quote from: TheMusicAddicyZ on Aug 30, 2024, 07:06 PMhello so i am trying to make some programs to aid with the mod create and trains addons for it i basically wanna write a OS system to run the factories for create where i can tell it to stop and start and stop certain bits of the process line aswell as tell it what to create i also wanna make a signalbox system where a train would run over a observer the redstone signal would be picked up and a notification would ping the signal computer and tell a train is comming on this certain line but i have veery limited knowledge on CC so if possible i would really love to get some help and understanding of whats possible and whats not

With CC:Tweaked, you can utilize the Redstone API to communicate with Create, which can be useful to manage your machines.

Consider viewing the API on the Wiki so you can get started on pairing them together.
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

Missooni

#2
Quote from: TheMusicAddicyZ on Aug 30, 2024, 07:06 PMhello so i am trying to make some programs to aid with the mod create and trains addons for it i basically wanna write a OS system to run the factories for create where i can tell it to stop and start and stop certain bits of the process line aswell as tell it what to create i also wanna make a signalbox system where a train would run over a observer the redstone signal would be picked up and a notification would ping the signal computer and tell a train is comming on this certain line but i have veery limited knowledge on CC so if possible i would really love to get some help and understanding of whats possible and whats not

There is a mod called ComputerCraft: Create Bridge that adds some peripherals to better integrate Create and ComputerCraft. Like QuickMuffin said, however, with regular CC:Tweaked you can interact with anything that takes a redstone signal.

Links:
https://tweaked.cc/module/redstone.html
https://www.curseforge.com/minecraft/mc-mods/cccbridge

Here's an example of an ingame setup that uses redstone api:
Example made in MC 1.20.1
https://i.imgur.com/fpZlLgj.png
Observers fire off two extremely quick signals, one when the powered rail turns one, one when it turns off.
The sticky piston will push the redstone block into the computer on the first signal, and pull it back on the second.
https://i.imgur.com/Ih5KjFy.png
Here's a simple loop that waits until a redstone current is detected on the back of the computer:
Code: Lua
  1. local function listen()
  2. repeat
  3. os.sleep(0.5)
  4. local signal = redstone.getAnalogInput("back")
  5. until signal > 0
  6. print("Signal Received.")
  7. os.sleep(5)
  8. listen()
  9. end
  10.  
  11. listen()
The first os.sleep is there to prevent a 'too long without yielding' error while the computer waits for input. The second one adds a delay before the computer will begin listening again, to prevent it from firing off multiple times after receiving a redstone signal. This setup assumes the powered rail will not stay activated once pressed, in theory you can add better safeguarding measures to your own program.
" We are like the spider. We weave our life and then move along in it.
We are like the dreamer, who dreams and then lives in the dream. "
- Aitareya Upanishad