How to use wireless modem to send commands

Started by Tsukicchi, Aug 24, 2020, 07:43 PM

Previous topic - Next topic

Tsukicchi

Soooo hey everyone!

I'm not entirely sure which version of computercraft I'm using, but it has CraftOS 1.3, the version from Tekkit Classic.

I have an idea for an automated system to get pretty much any crafted item you want to set up.
So here's the idea, explained as best as i can:
You set up a bunch of chests with resources, all sorted. Every chest has a filter being able to extract the exact amount of a specific item that you need. Let's say I want to craft a diamond pickaxe. What I want to be able to do is type in a command in a computer, say "pickaxe_iron" which will then send a request wirelessly to the corresponding computer, which will then send a redstone signal to two extractors which will each pull out 2 sticks and 3 diamonds which will be sent to an automatic crafting table. That same computer would then send a second signal to an extractor that will pull out that diamond pickaxe from that automated crafting table which will then send it into a chest.

Now here's my set up problem. There are a few things I don't know how to set up properly. One of them being the signals to the filters to extract the crafting materials and the filter to extract the crafted item from the automated crafting table. I can send a signal to both at the same time, and then put a delay on the signal to send it again so the filter on the automated crafting table gets another signal after the item is crafted so the crafting materials have time to get to the crafting table. The problem with this is that the signal will also be sent to the other two filters again, extracting another set of material. What I want to do is send a signal to the two filters on the chests first to extract the items, then set a sleep command in the program so it will wait long enough to then only send a signal to the filter on the crafting table to pull out the item without sending another set of materials.

Now I don't know if you've spotted the problem here, but a computer only has 5 sides, meaning I would only be able to send 5 signals, which obviously isn't enough. This would mean I'd need 1 computer per 5 signals.

So I was wondering, is there a way to use one computer as sort of the main hub with 1 or more wireless modems attached to it so I could theoretically have an unlimited amount of destinations?

My idea with this is as follows:
Take one computer as the main hub and put a bunch of wireless modems on it,
Give every destination computer a sort of ID,
This way, from the main computer, I would send a command that would specifically go to computer 1. This will send a command from the main computer to computer 1 to execute a script that will send a signal to the necessary extractors which will extract the items and bring then to the crafting table, then after a pause computer 1 will send another signal but only to the extractor on the crafting table to pull out the crafted item.
I want to have a bunch of setups like that that will all lead back to the main computer. Again, sort of giving every computer in charge of actually sending signals to craft items an ID, so I can send a signal wirelessly to theoretically an infinite amount of computers to craft pretty much any item I want.

I don't care about how much space this requires because I know it will take a lot. The main focus is just that I want to be able to send every command from just 1 main computer. I don't care how many extra computers i need down the chain. I pretty much only care about this being possible and being abel to be doen from 1 main computer.

I will let you know I'm not a programmer at all. Have pretty much no experience with programming, not even in computercraft. So preferably I'd like to have a script that I can easily just change some numbers of (like the IDs for example) to make it easily work for pretty much as many computers as I want without having to reqrite a load of lines.


I hope my explanation was good enough. I'm not entirely sure how to explain it down to the smallest detail but I hope you understand what I'm trying here.
If you have any suggestions on how to set this up I'd very much appreciate it!
Thanks!

Also all the required captcha's and the questions are a bit much. I don't know who the developer is of the CC:Tweaked fork

Lupus590

#1
Since you said that you are new to programming, I would start with simple things.

Having a computer triggers the craft when it receives a signal is quite simple. So I would start there and not worry about the central computer, other than being aware that the crafter needs to listen for commands from it and maybe say that the craft is done back to it.

Once you have a crafter I would get the main computer able to send a command the correct crafter when you want it to.

It sounds like you know how the program will work, it's just a matter of learning the language to make the computer do what you want it to. Mentioning which, google should be able to help you learn Lua. I will mention that you want to learn Lua 5.1 and that CC has some oddities with its implementation of Lua. You will also find that many of the features documented on the wikis, yes there's two, are not available in that version of CC.

You also seem to have a few misunderstandings of how CC works, but I'll leave you to find them in your own time.

If you end up with specific problems then feel free to ask us here, or on discord.

You might find this as a good starting point too: http://www.computercraft.info/wiki/Tutorials#Introduction_to_Coding