Jump to content


Rsstn's Content

There have been 14 items by Rsstn (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#144390 Advanced Nuclear reactor management.

Posted by Rsstn on 11 September 2013 - 01:57 PM in Ask a Pro

View Postquinn9009, on 11 September 2013 - 01:52 PM, said:

how to add a function to a command

Sorry, I don't quite understand what you mean by that, can you explain again in a different way what you need explaining?



#144383 Advanced Nuclear reactor management.

Posted by Rsstn on 11 September 2013 - 12:34 PM in Ask a Pro

As the others say, you'll need to learn this for yourself, but here's where to start:

The easiest way for you to control the reactors is to power them using a redstone current via redstone dust.
To control redstone dust adjacent to one of the sides of your computer, you can use the Redstone API:

So far you have the basics needed to keep the reactor under control automatically. In order to turn on/off the reactor manually you will need a menu (like the one in your program so far) and to be able to read user inputs. The easiest way to do this is using os.pullEvent() (more specifically os.pullEvent("key")) to read when a user presses one of the number keys related to an option in the menu.

It looks like you already know the basics that fit in between the code suggestions I've given you, so just give it a go on a single reactor. Multiple reactors will be a bit tougher because if each one uses two sides of the computer for inputs/outputs, you will soon run out of sides! You'll have to find a solution to this at a later date, but for the moment, start simple! This is a pretty complex starter project so don't make it any harder than it already is. You can always make it look good at the end, once it's working!

If you get stuck with anything, just ask!



#92342 Wolf3d-style 3d engine (proof of concept)

Posted by Rsstn on 01 March 2013 - 07:54 AM in Programs

Awesome, trying it out!



#89904 [CC1.5]ComputerCraft Emulator V0.57 (February 19th)

Posted by Rsstn on 21 February 2013 - 11:21 PM in APIs and Utilities

It would be nice if there was a way you could tell when you are outputting a redstone signal to the sides of the PC, and maybe even a way to input redstone signals. That could be some kind of on-screen switch that you can drag and drop against the side of the terminal. That would make it most useful for me because I find nearly all of my programs have some sort of redstone output (eg. a redstone lantern on the top as a visual indicator of what the PC is doing).
Good job so far!
Ross



#89900 Computercraft/BuildCraft pipe program

Posted by Rsstn on 21 February 2013 - 10:51 PM in Ask a Pro

Function for a pulse:
function pulse(outputSide, nPulses)
local i = 1
while i <= nPulses do
i = i + 1
rs.setOutput(outputSide, true)
sleep(1)
rs.setOutput(outputSide, false)
sleep(1)
end

Then call the function like this to make 5 pules from the back side of the PC:
pulse("back", 5)

Untested, but should work.



#89482 FS API h.readAll() returns 'attempt to index ? (a nil value)'

Posted by Rsstn on 21 February 2013 - 05:41 AM in Ask a Pro

But the 'write()' line near the top should have sorted that out and set it to the default (right) side...



#89481 FS API h.readAll() returns 'attempt to index ? (a nil value)'

Posted by Rsstn on 21 February 2013 - 05:39 AM in Ask a Pro

Ok, I found that it was stopping because my program did not yeild, and the screen stayed blank because there was no 'else' part of the if statement. (wasn't supposed to be needed!)
Now I got to find out why the ASCII codes arn't correct...

EDIT: Ah, you got there first!



#89461 FS API h.readAll() returns 'attempt to index ? (a nil value)'

Posted by Rsstn on 21 February 2013 - 05:09 AM in Ask a Pro

Ok, here is my new code: http://pastebin.com/wx6ssA7X
But whenever I run the code, the computer goes blank (shutting down? crashing?)
When I right-click on the PC again, it boots up like normal with 'CraftOS 1.5'.
What's going on here?



#89430 FS API h.readAll() returns 'attempt to index ? (a nil value)'

Posted by Rsstn on 21 February 2013 - 04:35 AM in Ask a Pro

Ah, ok that might be it. I forgot the code to write the file comes after the code to read it!
I'll assume that's the problem and give it a go later. Thanks for your help guys!



#89408 Computercraft/BuildCraft pipe program

Posted by Rsstn on 21 February 2013 - 04:19 AM in Ask a Pro

If you had only one type of item per chest you could just use redstone pulses to power buildcraft engines for one 'pump' at a time. One 'pump' of the engine removes one item from the chest via a wooden pipe. Just repeat the pulse until the right number of that item have been removed. Using turtles might be more efficient, but it depends what is easiest for you.



#89386 FS API h.readAll() returns 'attempt to index ? (a nil value)'

Posted by Rsstn on 21 February 2013 - 03:44 AM in Ask a Pro

Hi guys, haven't been here in a while!
I am starting my own email programs for a server with friends and have started by giving them an easy way to change what side the modem is attached to (the don't know Lua).
I started with this: http://pastebin.com/4gsvLThm (The pastebin link is better because the colour is correct)

Spoiler

The error I get is:

Quote

FILENAME:19: attempt to index ? (a nil value)

I've seen this error many a time before, but I just can't work out what's going wrong. It seems that 'h.readAll()' is returning nil, and I can't work out why. I've done this before and not had trouble, and tried using 'h.readLine()' too.
This is all correct according to the wiki, but maybe it's just that I'm out of practice in Lua.
(and yes I know it could be neater, but I just want to get it working for now!)

Thanks in advance,
Ross.



#37246 Texture problem with computer

Posted by Rsstn on 05 October 2012 - 08:47 PM in Ask a Pro

I presume you've tried re-installing CC on a fresh Minecraft.jar?
I don't know much about how Optifine works, but if it is interference from other mods, Optifine is the most likely culprit, as it changes a lot of Minecraft's rendering and animation.



#32377 saving files/tables

Posted by Rsstn on 17 September 2012 - 04:28 PM in Ask a Pro

View Postnirokid, on 17 September 2012 - 04:24 PM, said:

first of all thank you for helping me :)/>,

I want to to save a message that a computer get from another computer. then I just want to read it so lets say computer 1 sends computer 2 a message called a then I wand to save this message a in a file so that I can read it later.

For this, you probably won't need tables.
You can just use the FS API to save the string to a file on the PC. When you want to show the message again, you can just use the FS API to open the file as a string, and print the string to the screen.



#32375 saving files/tables

Posted by Rsstn on 17 September 2012 - 04:24 PM in Ask a Pro

Use this to help you learn how to create/open/read/write/close files:
http://computercraft...?title=Fs_(API)

You can't save tables in this way. To save tables, you must first convert them into a string using:
textutils.serialize(TABLE_NAME)

To turn a string back into a table, use:
textutils.unserialize(STRING_NAME)