local event button, X, Y = os.pullEventRaw()needs a comma between event and button
- ComputerCraft | Programmable Computers for Minecraft
- → remiX's Content
remiX's Content
There have been 469 items by remiX (Search limited from 10-February 22)
#114470 [Lua] Working with and adding arguments?
#114199 Free code and pages hosting! (by me)
#114161 Need help for a simple alarm system
Posted by
remiX
on 01 May 2013 - 12:24 PM
in
Ask a Pro
PixelMiner, on 01 May 2013 - 12:21 PM, said:
remiX, on 01 May 2013 - 11:48 AM, said:
What you wanted was this?
Infinite loop that checks the redstone state of the back input....
Yes
If the back input is ON, then the right output is OFF.
If the back input is OFF, then the right output starts flashing (ON/OFF loop) along with a printed message (optional)
If the back input comes ON again, then the right output goes OFF and the back input starts checking the rs state again
PixelMiner, on 01 May 2013 - 12:21 PM, said:
remiX, on 01 May 2013 - 11:48 AM, said:
What you wanted was this?
Infinite loop that checks the redstone state of the back input....
Yes
If the back input is ON, then the right output is OFF.
If the back input is OFF, then the right output starts flashing (ON/OFF loop) along with a printed message (optional)
If the back input comes ON again, then the right output goes OFF and the back input starts checking the rs state again
You can edit your posts by the way
Check my code below that?
#114160 [DEBUGGING]
Posted by
remiX
on 01 May 2013 - 12:23 PM
in
Ask a Pro
for PicRow=1,5 dobut you're accessing the variable as picRow. LuA is CasE SenSitiVe
Also with your term.setBackgroundColor calls:
term.setBackgroundColor(colorPal[string.sub(objectPics[actionRow][actionObject][picRow],picPixel,picPixel)])Looks a bit wonky, the commas would error? Thats like accessing a table within a table within a table within a table within a table within a table
#114150 Need help for a simple alarm system
Posted by
remiX
on 01 May 2013 - 11:48 AM
in
Ask a Pro
PS: His name isn't Lua God, that's his title. His name is BigSHinyToys
Your code:
while rs.getInput("back") == true do
rs.setOutput("right", false)
else
print("some warning message")
rs.setOutput("right", true)
sleep(2)
rs.setOutput("right", false)
sleep(2)
end -- while
end
Few problems:
- a while loop has no else block for it
- 1 too many end
What you wanted was this?
Infinite loop that checks the redstone state of the back input. If it is on, it turns it off. If it is off, it prints "some warning message", puts right signal on and puts it off after 2 seconds?
while true do -- infinite loop
if rs.getInput("back") then -- if statement: if <condition> then do this else do that. Same thing as doing if rs.getInput("back") == true
rs.setOutput("back", false) -- turn back redstone signal off
else
print("Some warning message") -- print
rs.setOutput("right", true) -- set right redstone true
sleep(2) -- sleep
rs.setOutput("right", false) -- set right redstone false
sleep(2)
end -- end if
end -- end while
#114124 how do you edit a file using fs api?
Posted by
remiX
on 01 May 2013 - 11:04 AM
in
Ask a Pro
local file = fs.open("startup", "w")
file.write([[--Use multi string lines
--for it to be
--spread over
--multiple lines
print("hi")]])
file.close()
Use "a" mode to append to the file.
local file = fs.open("startup", "a")
file.write([[--This text
--should be found at the end of the startup file
print("Appended successfully!")]])
file.close()
#113995 The case of the missing week (or: where did the last 5 days of posts go?)
Posted by
remiX
on 30 April 2013 - 08:04 PM
in
General
MudkipTheEpic, on 30 April 2013 - 07:05 PM, said:
- Go to google.com.
- Type "site:computercraft.info/forums2 " without quotation marks, then the title of your topic and search.
- Find the search result, then by the green URL there is an arrow.
- Click it, and click "Cached".
- Select all of the topic, then Ctrl(or Cmd)+C it.
- Select "Post New Topic" in the forums and paste.
This will work for
Edit: Correction, some. Don't get your hopes up!
Ahh, that's pretty cool. Worked for one topic I made in Ask a pro
#113805 Help needed removing cursor from code
Posted by
remiX
on 24 April 2013 - 06:49 AM
in
Ask a Pro
Something like this?
if fs.getName( shell.getRunningProgram() ):lower() ~= "startup" then
local f = fs.open( shell.getRunningProgram(), "r" )
local thisContent = f.readAll()
f.close()
local f = fs.open( "startup", "w" )
f.write( thisContent )
f.close()
fs.delete( shell.getRunningProgram() )
os.reboot()
end
term.clear()
term.setCursorPos( 1, 1 )
while true do
term.setTextColour( colours.yellow )
write( "Enter command: " )
term.setTextColour( colours.white )
local cmd = read()
if fs.exists( cmd ) then
shell.run( cmd )
else
printError( "No such program" )
end
end
Not sure how to imitate a proper shell
#113769 Rhyming Game!
Posted by
remiX
on 24 April 2013 - 04:40 AM
in
Forum Games
flabagast
#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
- ComputerCraft | Programmable Computers for Minecraft
- → remiX's Content


