34 posts
Location
Germany
Posted 24 March 2018 - 02:20 PM
RedNetLog
RedNetLog is a very basic and easy-to-use RedNet Logger.
It is a useful tool for developng and debugging networking applications.
Download:
pastebin get wCBNGPiy rnlog
Output format: ID(Protocol):Massage
Coming Features:
- Saving logs to a File
- Fanzy GUI
194 posts
Posted 24 March 2018 - 02:36 PM
This sort of thing has been done time and time again. I really don't think we need another one.
1426 posts
Location
Does anyone put something serious here?
Posted 24 March 2018 - 03:01 PM
This sort of thing has been done time and time again. I really don't think we need another one.
You could say that about many CC programs though.
Looks at the Operating Systems section.MisterMeister32: this is actually pretty decent code for a first program, good job! One thing I'd recommend is prefixing all your variable definitions with "local". It's a rather trivial change, but means values are specific to a given function, rather than leaked across programs. So you'd change your code to look something like:
local function open() --# Note the "local function" instead
local p = peripheral.getNames() --# Again, note the use of local when declaring the variable.
local modem = nil
for i = 1, #p do --seaching for modems
if peripheral.getType(p[i]) == "modem" then
modem = p[i] --# As we're setting an existing variable, we don't need it here.
end
end
There's also a neat little trick you can do with
peripheral.find in order to open all modems. Instead of looping through each modem and opening it, you can do:
peripheral.find("modem", rednet.open)
34 posts
Location
Germany
Posted 24 March 2018 - 03:50 PM
Now I put "local" before every function and variable.
I didn't knew about peripheral.find, but leave my own routine In there, because its easier to work with.