c = true
while c do
c = true
shell.run("clear")
print("...")
print("...")
write("...")
a = io.read()
if a == "Raffinerie" then
shell.run("Raffinerie")
elseif a == "Steinbruch" then
shell.run("Steinbruch")
else
print("Falsche Eingabe")
c = true
end
end
Side note: lua has booleans, true and false. So you could replace c == 0 in the while declaration with simply c, and if c is true, it will run, otherwise it won't.
- ComputerCraft | Programmable Computers for Minecraft
- → Graypup's Content
Graypup's Content
There have been 15 items by Graypup (Search limited from 10-February 22)
#188910 For input string "1shell"
Posted by
Graypup
on 23 July 2014 - 09:50 PM
in
Ask a Pro
#174629 Gamax92's CCLite ComputerCraft Emulator (Updated for CC1.75)
Posted by
Graypup
on 21 April 2014 - 04:44 AM
in
General
gamax92, on 16 April 2014 - 11:19 PM, said:
Graypup, on 14 April 2014 - 04:38 AM, said:
local h = http.get("http://ma.sdf.org:1254")
print(h.readAll())
EXPECTED RESULT: http.get taking 5 secondsACTUAL RESULT: http.get returning nil instantly
Server code, in nodejs:
var h = require('http')
var s = h.createServer(function (req, resp) {
req.on('data', function(datas) {
console.log('Got: ' + datas)
})
var body = 'yaaays\r\n'
setTimeout(function () {
resp.writeHead(200, {'Content-Length' : body.length, 'Content-Type' : 'text/plain'})
resp.end(body)
}, 5000)
})
console.log('running')
s.listen(1254)
There's probably some Keep-Alive trickery going on that Java does.
EVEN
http.request("http://ma.sdf.org:1254")
e, p1, p2 = os.pullEvent()
doesn't work
#173304 Gamax92's CCLite ComputerCraft Emulator (Updated for CC1.75)
Posted by
Graypup
on 14 April 2014 - 04:38 AM
in
General
local h = http.get("http://ma.sdf.org:1254")
print(h.readAll())
EXPECTED RESULT: http.get taking 5 secondsACTUAL RESULT: http.get returning nil instantly
Server code, in nodejs:
var h = require('http')
var s = h.createServer(function (req, resp) {
req.on('data', function(datas) {
console.log('Got: ' + datas)
})
var body = 'yaaays\r\n'
setTimeout(function () {
resp.writeHead(200, {'Content-Length' : body.length, 'Content-Type' : 'text/plain'})
resp.end(body)
}, 5000)
})
console.log('running')
s.listen(1254)
#172516 Post your desktop!
Posted by
Graypup
on 09 April 2014 - 03:26 AM
in
General

The autohotkey is to fix my Model M not having media keys. And windows hating my weird routing setup to change volume.
#172259 Lua: What would you change?
Posted by
Graypup
on 07 April 2014 - 05:33 PM
in
General
A string-supporting switch statement
Who needs functional overloading? It can be done with some type() and some if statements.
Bracket notation, remembering ends is stupid, and brackets are easier
Ways to escape some boilerplate like
str = str or "blah"
#172252 ComputerCraft 1.6 is out of Beta!
Posted by
Graypup
on 07 April 2014 - 05:08 PM
in
General
1lann, on 01 April 2014 - 03:56 PM, said:
-- Main loop (terminate to break)Ironically it uses os.pullEventRaw(), and thus you can't terminate out of it. I'm not sure if this is intentional or not, as it does add some small protection for computers that are dedicated repeaters.
#170798 Ultimate Door Lock - PDA Opened Doors!
Posted by
Graypup
on 31 March 2014 - 03:43 AM
in
Pocket Programs
oeed, on 31 March 2014 - 02:51 AM, said:
Sxw, on 31 March 2014 - 12:03 AM, said:
No. There's really nothing I can think of that can prevent others from mimicking another PDA. ComputerCraft is very open, even if I did encrypt everything you could still fairly easily reverse it.
If you have any suggestions let me know. I'm trying out the program on the CoderCraft server and haven't run in to any issues as of yet.
#161948 OpenPeripheral chest monitor not working
Posted by
Graypup
on 25 January 2014 - 04:30 PM
in
Ask a Pro
Unfortunately, this throws an attempt to index nil error on line 7.
What am I doing wrong?
The setup is as follows: openperipheral installed, vanilla chest on the left of the computer.
p = peripheral
c = p.wrap("left")
while true do
local totalUU = 0
for i=1, 27 do
local temp = c.getStackInSlot(i)
if temp["qty"] ~= nil then --THIS IS LINE 7
totalUU = totalUU + temp["qty"]
end
temp = nil
end
--this is a demo thing and will 404, but we don't care!
http.get("http://computercraft.info/update-uum.php?uum="..totalUU)
print("told the server about my amazing "..totalUU.." iridium ore!")
totalUU = 0
sleep(180)
end
The serverside portion works FINE with manual requests
#142388 Graypup's Turtle Programs (Currently Not Plural)
Posted by
Graypup
on 30 August 2013 - 12:25 PM
in
Turtle Programs
The syntax is TurtleTB distance numberOfTurnarounds
numberOfTurnarounds must be a number or no, or nothing. no or nothing means that the program will not turn around, and just stop at the end of the tunnel.
It is open-source (LIKE EVERY FREAKING CC PROGRAM THAT ISN'T BYTECODE SAVED TO A FILE!), and what most people call open-source, so it's also on github here: https://github.com/Graypup/TurtleTB
There are various config variables at the start of the source code, so please configure them how you want them.
UsingEnderChest means that the turtle will break the chest after putting its stuff in it. Otherwise it will leave the chest in the bottom of the tunnel. Note: it doesn't fill in holes in the floor left by enderchest placement
Chests go in the last item slot, torches in the second last. I will add something for when the turtle runs out of chests, but for now, just make sure the chest item slot is full when refilling torches.
It's in the public domain, have fun doing whatever you want. Preferably credit me, though I can't do anything about you not doing so.
#140631 Anyone Interested In A Javascript (Web/html5) Version Of A Cc Emulator?
Posted by
Graypup
on 18 August 2013 - 01:44 PM
in
General
- ComputerCraft | Programmable Computers for Minecraft
- → Graypup's Content


