113 posts
Posted 11 October 2012 - 09:43 PM
All you need to go is in the code.
allowed = false
term.clear()
term.setCursorPos(1,1)
print("PC"..os.getComputerID().."/ROM/ENTRY")
print("DENIED; ENTER ACCESS CODE")
rs.setOutput("top",false)
rs.setOutput("bottom",false)
rs.setOutput("left",false)
rs.setOutput("right",false)
rs.setOutput("front",false)
rs.setOutput("back",false)
sleep(0)
term.setCursorPos(34,1)
print(os.time())
term.setCursorPos(17,10)
write("USERNAME: ")
term.setCursorPos(34,20)
if allowed = false then
print("ACCESS STATE: FALSE")
if allowed = true then -- Problem is here, getting "bios:328: [string "startup"]:18: then expected
print("ACCESS STATE: TRUE")
end
Ignore above.
Now this isn't really a problem but its been wasting about 30 minutes of my time
I need a grid to show where the Y and Z cords are for term.setCursorPos(?,?)Now I need to know why sleep does not work in while true do functions
while true do
print("hi")
sleep(3) -- It always is skipped in while true do.
end
Please tell me how to fix.
160 posts
Location
Netherlands
Posted 11 October 2012 - 09:45 PM
if allowed = true then
and
if allowed = false then
Is wrong.
if allowed == true then
if allowed == false then
= Sets a variable and == checks it
113 posts
Posted 11 October 2012 - 09:47 PM
Oh, i always make that mistake. ;p
thanks
113 posts
Posted 11 October 2012 - 10:02 PM
Now this isn't really a problem but its been wasting about 30 minutes of my time
I need a grid to show where the Y and Z cords are for term.setCursorPos(?,?)
8543 posts
Posted 11 October 2012 - 10:16 PM
Now this isn't really a problem but its been wasting about 30 minutes of my time
I need a grid to show where the Y and Z cords are for term.setCursorPos(?,?)
1,1 is in the top left. 1,2 is right below it.
1111 posts
Location
Portland OR
Posted 11 October 2012 - 10:19 PM
It depends on the size of your screen. The X coord i across the top and Y is up and down.
If you do:
local x,y = term.getSize()
it will capture the size of your screen.
You can use the above for a lot of other things.
Mine is 51 x 19 so
1,2,3,4,5,6.....51
2
3
4
5
.
.
.
19
113 posts
Posted 11 October 2012 - 10:48 PM
TY.
Now I have a problem, when I do while true do, sleeps do not function correctly. (they get skipped)
1111 posts
Location
Portland OR
Posted 12 October 2012 - 02:03 AM
Can you post updated code?
2088 posts
Location
South Africa
Posted 12 October 2012 - 02:12 PM
Sleep() does work in while true do functions. There must be something causing it to not sleep in your code. Is that the only code you have in your program?
252 posts
Posted 13 October 2012 - 01:37 AM
I haven't heard of sleep(). But that's just me, maybe. Try using "os.sleep()" instead.
1111 posts
Location
Portland OR
Posted 13 October 2012 - 01:47 AM
I haven't heard of sleep(). But that's just me, maybe. Try using "os.sleep()" instead.
have you been sleeping?? lol sorry bad pun.. sleep() is valid and works great. I've never had to use os.sleep()
252 posts
Posted 13 October 2012 - 02:53 AM
I haven't heard of sleep(). But that's just me, maybe. Try using "os.sleep()" instead.
have you been sleeping?? lol sorry bad pun.. sleep() is valid and works great. I've never had to use os.sleep()
Lol, yes, and I wouldn't know about sleep() because I really haven't learned default lua APIs, only ComputerCraft APIs. :)/>/>
797 posts
Posted 13 October 2012 - 11:10 AM
try in a different program the code you had
while true do
sleep(3)
print(something)
end
if that doesnt work then you have probably installed computercraft incorrectly