- ComputerCraft | Programmable Computers for Minecraft
- → remiX's Content
remiX's Content
There have been 469 items by remiX (Search limited from 10-February 22)
#98515 [WIP] YugoOS
Posted by
remiX
on 18 March 2013 - 04:44 AM
in
Operating Systems
What is this...
#112667 [Turtle] End to close if at line..
Posted by
remiX
on 21 April 2013 - 08:20 AM
in
Ask a Pro
function diggy()
while turtle.detect() do
turtle.dig()
turtle.forward()
end
end
while not turtle.detect() do
turtle.turnRight()
if turtle.detect() then
turtle.dig()
turtle.forward()
turtle.turnRight()
if turtle.detect() then diggy()
if not turtle.detect() then
turtle.turnLeft()
end
else
turtle.turnLeft()
if turtle.detect() then
turtle.dig()
turtle.forward()
turtle.turnLeft()
if turtle.detect() then
diggy()
if not turtle.detect() then
turtle.turnRight()
end
Yeah.. quite a few missing ends
edit: Lol damn you kingdaro!
#106786 [SOLVED] Why Wont My Code Work?
Posted by
remiX
on 06 April 2013 - 08:22 AM
in
Ask a Pro
This is because once you readAll the first time, there is nothing to read anymore so it will be nil. (Didn't even read OP until after I said this
while true do
local command = http.get("http://24.152.212.26:8080/tropo/command.txt")
local status = command.readAll()
print( status ) -- debug
if status == "lights_on" then
rs.setOutput("back", true)
elseif status == "lights_off" then -- elseif statement ! :)/>
rs.setOutput("back", false)
end
--[[ You simply, you could do this:
rs.setOutput( "back", status == "lights_on" )
-]]
end
Always have a debug line which prints something so you know what is wrong.
If you are using a free webhoster, their might be extra code at the end of the page that readAll() will catch, you will need to use string.gsub to remove it.
#113767 [Solved] menu becoming laggy after a while
Posted by
remiX
on 24 April 2013 - 04:37 AM
in
Ask a Pro
Maybe set the delay to 1 second and rather do it this way:
local selector = 1
local heatChecker = os.startTimer(1) -- start a timer for 1 second to check the heat of reactor.
while true do
menuDraw(selector)
local e = {os.pullEvent()}
if e[1] == "key" then
if e[2] == keys.down then
selector = selector < #menu_options and selector+1 or 1
elseif e[2] == keys.up then
selector = selector > 1 and selector-1 or #menu_options
elseif e[2] == keys.enter then
if selector == 1 then
m.transmit(1, 1, "start")
term.setTextColor(colors.green)
term.setCursorPos(1, termY)
term.write("Le reacteur est demarre. ")
elseif selector == 2 then
m.transmit(1, 1,"stop")
term.setTextColor(colors.red)
term.setCursorPos(1, termY)
term.write("Le reacteur est arrete. ")
elseif selector == 3 then
break
end
end
elseif e[1] == "timer" and e[2] == heatChecker then
heatChecker = os.startTimer(1)
if verifheat() then
error = "Mauvaise carte dans le lecteur !"
break
end
end
end
Change the part from local selector = 1 in your code to the end of the while loop to this
#93089 [Question]How do I turn rednet messages into redstone signals?
Posted by
remiX
on 04 March 2013 - 03:59 AM
in
Ask a Pro
Senmori, on 04 March 2013 - 12:49 AM, said:
As for how to do it, well if I gave you the code then you wouldn't learn anything.
I would suggest waiting for an event(os.pullEvent() or rednet.receive()) until a certain message is received and if that message is what you want then do a certain action(redstone signals).
If you don't want to learn then click the spoiler for an idea of how to do it :
while true do local senderID, message, distance = os.pullEvent(rednet_message) --You could also use rednet.receive() instead of os.pullEvent() if (senderID == "12") and (message == "Hello") then --do stuff else --do other stuff end --ends if statement end -- ends while loop
senderID is a number, not a string
#108506 [Question] Login, Register computercraft
Posted by
remiX
on 10 April 2013 - 10:01 AM
in
Ask a Pro
Smiley43210, on 10 April 2013 - 09:09 AM, said:
write("Enter a username. Press enter to continue.")
local username = read()
write("Your username is "..username)
Explained without spoon feeding. Hmmm...
#94400 [Question] How can I make text show on a computer screen and a monitor screen...
Posted by
remiX
on 08 March 2013 - 08:47 AM
in
Ask a Pro
JokerRH, on 07 March 2013 - 10:31 AM, said:
boudragon, on 07 March 2013 - 10:18 AM, said:
function set(ind)
if type(term[ind]) ~= "function" then return end
term[ind] = setmetatable({term = term[ind], monitor = m[ind]}, {
__call = function(self, ...)
self.term(...)
self.monitor(...)
end
})
end
This additional line will detect if term[ind] is a function. If it is already modified it is a table and will not be set twiceTry that.
Source: http://www.computerc...or/page__st__40
Look at the code there and how to use it. I think that's what you're looking for.
#113747 [Question] Encrypt a string from input?
Posted by
remiX
on 24 April 2013 - 03:10 AM
in
Ask a Pro
Mackan90096, on 24 April 2013 - 03:04 AM, said:
Yes, this would be the decryption function.
function decrypt(str) local temp = "" for i = 1, str:len() do local char = str:sub(i,i) for i, v in pairs(lookup) do if v == char then temp = temp .. char break end end end return str end
Untested
#115228 [Question] A little question :P
Posted by
remiX
on 04 May 2013 - 09:47 PM
in
Ask a Pro
Freack100, on 04 May 2013 - 05:49 PM, said:
the anti-terminate:
OldPullEvent = os.pullEvent --backup the os.pullEvent os.pullEventRaw -- override the os.pullEvent --Put this code at the top of your program --If you want to disable the anti-terminating, do this: os.pullEvent = OldPullEvent
I hope It's helpfull for you
os.pullEvent = os.pullEventRaw
As for the permanent text, just have it print and if you don't want it to stop and have it so you can type add this to the end:
while true do
sleep(60)
end
#96060 [Open Source] PearOS (Preview 2) - OS X Inspired OS
Posted by
remiX
on 11 March 2013 - 11:04 PM
in
Operating Systems
#95991 [Open Source] PearOS (Preview 2) - OS X Inspired OS
Posted by
remiX
on 11 March 2013 - 06:01 PM
in
Operating Systems
I would suggest that you save everything into one folder, right now there's two, system and home - just clatters the users' pc folder.
And don't make the file startup because that's annoying xD
And make an installer!
- ComputerCraft | Programmable Computers for Minecraft
- → remiX's Content


