Computercraft Help

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord
Status
Not open for further replies.

Mango845

New Member
Jul 29, 2019
9
0
0
This is probably in the wrong section but I need help with computercraft.
I have some variable in my program and i am trying to change then with an if then statement, but it seems that they are not changing. Can someone please help me. Here is my code.

local mtime
local mside
print("Should I make blocks(b) or ingots(i)?")
local ch = tostring( read() )
if ch == b then
mtime = 14
mside = left
end
if ch == i then
mtime = 3
mside = right
end
print(mtime)
print("How many ingots/blocks should I mold?")
local Num = tostring( read() )

for i=1,Num do
rs.setOutput("mside",true)
os.sleep(1)
rs.setOutput("mside",false)
os.sleep(mtime)
end
 

MrZwij

New Member
Jul 29, 2019
452
0
0
I'm no expert but I see a few obvious problems.

1. Looks like you need to enclose b and i in quotes, lines 5 and 9.

Code:
If ch == "b" then
 
if ch == "i" then

2. You also need quotes around the values you assign to mside.

Code:
mside = "right"

3. local Num = tostring(read()) MIGHT work, but what it should be is

Code:
local Num = tonumber(read())

4. I'm about 90 percent sure you need to take the quotes out of the rs.SetOutput lines

Code:
rs.setOutput(mside, true)
 
Status
Not open for further replies.