Hi
Bit new to all this ComputerCraft stuff and im a little stuck on a program ...
Ive made a 1 vs 1 PVP arena on our server and the idea is that each player drops down a shoot hitting a pressure plate at the bottom. Once both pressure plates are activated it starts a countdown timer of 1 minute before the doors open allowing access to the arena.
Ive made the countdown timer and it works fine, its just the redstone activation program to start the countdown that im having problem with.
Heres the redstone input program im having problems with...
while true do
event = os.pullEvent()
if event == "redstone" and rs.getInput(right) == true then
--run countdown
end
When run I get the error..
bios:339 [string "redstone"] :7 : '=' expected
Any help would be much appriciated
Thanks
Moogstar
Having Poblems starting a program with redstone signal
Started by Moogstar, Aug 02 2014 11:13 AM
10 replies to this topic
#1
Posted 02 August 2014 - 11:13 AM
#2
Posted 02 August 2014 - 01:39 PM
okay everything you're doing there is fine. The first thing I notice is the error is saying the problem is in the file 'redstone', is this code from that file and is this all of the code?
did you type this out manually here or copy/paste? if you've typed it out here make sure in the if condition on your version in-game are both == and not a single =
did you type this out manually here or copy/paste? if you've typed it out here make sure in the if condition on your version in-game are both == and not a single =
#3
Posted 02 August 2014 - 01:49 PM
Hi
Thanks for the reply..
The code is from my program called redstone and what you see is all the code from that program.
I did actually copy the code originally from another thread and its identical as it is above as it is in game.
I have used == and not single =
Its got me stumped!
Thanks for the reply..
The code is from my program called redstone and what you see is all the code from that program.
I did actually copy the code originally from another thread and its identical as it is above as it is in game.
I have used == and not single =
Its got me stumped!
#4
Posted 02 August 2014 - 04:23 PM
You need to use
rs.getInput("right")
without the quatation marks, you are passing nil variable right to the function rather than string "right"
#5
Posted 03 August 2014 - 10:12 AM
Tried with quotation marks and still getting the same error.
I cant figure out what it can be, im stumped!
I cant figure out what it can be, im stumped!
#6
Posted 03 August 2014 - 12:53 PM
Oh, you also missed off the end to complete your while loop
You can also just use rs.getInput("right") and not have that comparison as getInput() just returns true or false anyway
You can also just use rs.getInput("right") and not have that comparison as getInput() just returns true or false anyway
#7
Posted 03 August 2014 - 02:01 PM
Mmmm like this...?
while true do
end
rs.getInput("right")
run countdown
end
Still getting..
bios:339: [string "redstone"] :7: '=' expected
Thanks
while true do
end
rs.getInput("right")
run countdown
end
Still getting..
bios:339: [string "redstone"] :7: '=' expected
Thanks
#8
Posted 03 August 2014 - 02:09 PM
no, like this
while true do
local event = os.pullEvent()
if event == "redstone" and rs.getInput(right) then
--# run countdown
end
end
though missing an end won't yield that error. I suspect that you've made a typo somewhere, such as a , (comma) instead of a . (period). Another possibility, I noticed in your latest code you only had run countdown without the -- at the start this time, is it like this in your code?
#9
Posted 03 August 2014 - 04:53 PM
Doh!
Yeh missed the -- /faceplam
Rewrote the code again and it doesn't crash out anymore
Doesn't seem to want to start the countdown program tho ?!
Btw...thanks for your time..
Yeh missed the -- /faceplam
Rewrote the code again and it doesn't crash out anymore
Doesn't seem to want to start the countdown program tho ?!
Btw...thanks for your time..
#11
Posted 03 August 2014 - 08:28 PM
Aha!
Ok, ive read about shell.run and added a line at the end,
It Works!!
Thankyou for all the help folks!
Last time I programmed anything it was on a Sinclair Spectrum!
Ok, ive read about shell.run and added a line at the end,
It Works!!
Thankyou for all the help folks!
Last time I programmed anything it was on a Sinclair Spectrum!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











