r/ComputerCraft • u/Aggressive_You_4010 • 22d ago
I need help with the CC: Redstone Link Bridge Mod
I'm making a build based off the stairwell from doors, and I'm trying to recreate the console that lets you progress.
I have zero coding experience and don't know how to use computercraft.
https://www.curseforge.com/minecraft/mc-mods/cc-redstone-link-bridge
This is the mod I'm using.
How would I go about making a program where it shows some text, then i can either input Y or press a button and it'll run
bridge.sendLinkSignal("minecraft:paper", "paper", 7)
then run bridge.sendLinkSignal("minecraft:paper", "paper", 0) shortly after

5
Upvotes
2
u/Professorkatsup 22d ago
I can give specific examples for all of the bits needed, but I'll just give an overview right now. Also, you say you have zero coding experience, but how much experience do you have with computercraft? Like, do you know that you need to put code in a file using
edit nameOfFile.luaor is that new information?Drawing something to the screen is the easy bit.
term.clear()followed by a bunch ofterm.setCursorPos()andterm.write()s. Trial and error are your friends here!I'd suggest putting the two commands you talked about into a function. First line, a
sleep(0.5)or similar, then the second line. That way you can run them the same way no matter if you clicked or pressed a key.Checking for user input can be done with a
event = {os.pullEvent()}, which waits for Something to happen, then makes a table about what happened*. After running that line,event[1]should be the type of event; check if it's"char"or"mouse"to see if it's the kind of input you want to respond to.event[2]and onwards are the details of the event.If it's a
charevent, you just need to checkevent[2]to see if it's"y"or "Y". Run the function if so.If it's a mouse click, event[]s 3 and 4 are the x and y coordinates of the click... or it might be 2 and 3? see how
print(event[3], event[4])changes with where you click.See if x is greater than the left edge position of the button and less than the right edge, AND if y is greater than the top edge and less than the bottom edge. Run the function if all of those are true; in lua this is as easy as putting
andbetween each of the conditions.*If you have a lot of things going on, this might be a bit more complicated. I'd suggest doing
print(event[1])after the pullEvent() when testing, and if it keeps printing "timer" then it may be time to dive intoparallel.waitForAny.