This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
V497_Vesper's profile picture

Peripherals++ help,

Started by V497_Vesper, 15 May 2015 - 08:56 AM
V497_Vesper #1
Posted 15 May 2015 - 10:56 AM
I have downloaded and installed the peripherals++ mod and tried tio use the speaker but when i try to use the peripheral.wrap command to wrap the speaker to the computer it doesn't seem to work, after i type in peripheral.wrap("speaker", left) i get the error no such program what am i doing wrong?

the reason i would like this to work is so i can develop a computercraft controlled progressive heat monitor using nuclear control, computercraft, openccSensors and project red, any help would be appreciated
regards V497_vesper
Bomb Bloke #2
Posted 15 May 2015 - 03:01 PM
It sounds like you're trying to type your code directly into the computer's command prompt. Usually you'd want to enter it into a script file, save that script file, then type the script's name into the prompt in order to execute its contents.

This may help.
V497_Vesper #3
Posted 18 May 2015 - 10:58 PM
Thanks for the reply but i am not a programmer I have no idea how to create a script;
all i do is i place the speaker down in my world but it doesn't create another API.
Apart from the script thing what am i doing wrong? how do i get the computer to recognise the api of the chat box and speaker?
Dragon53535 #4
Posted 19 May 2015 - 12:58 AM
It is already recognizing it, however the way the computer is setup is that you cannot actually type code commands such as peripheral.wrap into the shell. You'd need to get to the area that allows you to do so. The reason that this is so is that it works like that on your computer you're using right now. You cannot just go into the file browers and tell it to execute code. It will try to search for a file with the name of whatever code you typed, and tell you no file found. However, if you go to the command prompt, it will allow you to type commands into it.

I'll give a short tutorial of how to do so in CC.


--#These lines with the --# are comments, don't actually type them
--#First thing, getting to the place to type commands.
lua
--# That's it, that's the program that lets you type commands.
chatbox = peripheral.wrap("right")
--# Change the right to the side the chatbox is in. You have now wrapped the peripheral.
--# Should we want to use the chatbox, we use that chatbox variable name.
--# At this stage we don't know what the chatbox can do, we can google it, or we can just grab the names of what it does.
print(textutils.tabulate(chatbox))
--#This will print out two columns of words, these words are the methods of the chatbox, and are our commands to use it.
--#Now after working with chatboxes myself, I can tell you that one of them will be say.
--#Lets say something to everyone in a radius around the box.
chatbox.say("Hello there people")
--#To put it in a few lines, here's the commands you're typing.
lua
chatbox = peripheral.wrap("right")
print(textutils.tabulate(chatbox))
chatbox.say("Hello there people")
V497_Vesper #5
Posted 19 May 2015 - 12:44 PM
It is already recognizing it, however the way the computer is setup is that you cannot actually type code commands such as peripheral.wrap into the shell. You'd need to get to the area that allows you to do so. The reason that this is so is that it works like that on your computer you're using right now. You cannot just go into the file browers and tell it to execute code. It will try to search for a file with the name of whatever code you typed, and tell you no file found. However, if you go to the command prompt, it will allow you to type commands into it.

I'll give a short tutorial of how to do so in CC.


--#These lines with the --# are comments, don't actually type them
--#First thing, getting to the place to type commands.
lua
--# That's it, that's the program that lets you type commands.
chatbox = peripheral.wrap("right")
--# Change the right to the side the chatbox is in. You have now wrapped the peripheral.
--# Should we want to use the chatbox, we use that chatbox variable name.
--# At this stage we don't know what the chatbox can do, we can google it, or we can just grab the names of what it does.
print(textutils.tabulate(chatbox))
--#This will print out two columns of words, these words are the methods of the chatbox, and are our commands to use it.
--#Now after working with chatboxes myself, I can tell you that one of them will be say.
--#Lets say something to everyone in a radius around the box.
chatbox.say("Hello there people")
--#To put it in a few lines, here's the commands you're typing.
lua
chatbox = peripheral.wrap("right")
print(textutils.tabulate(chatbox))
chatbox.say("Hello there people")
thanks for the response, however when i put in the commands that you say i get this



is this a problem with the 1.73 update to Computercraft and or the recent peripherals++ update?
Edited on 19 May 2015 - 01:32 PM
V497_Vesper #6
Posted 19 May 2015 - 01:11 PM
hello everyone, i am looking to create a program that i can use in my Minecraft project Moonbase Luna using Computercraft, openCC Sensors, Peripherals++, Industrialcraft and Nuclear Control, the nuclear control part has been done and what i am looking to use computercraft and peripherals++ to preate a public adress system on the base like say for example if the level increases the chat box will put the text up on th screen and the speaker will say something like "WARNING! Reactor Heat Increase Detected!"
now using a simple tutorial from Dragon53535 i got the speaker wrapped to the computer now i am looking to use these things to have an alarm sound when the reactor goes critical and the computer shuts the reactor down immediately while the speaker is pretty much telling the people on the base to evacuate

The mods i am using for this are:
==========================
Galacticraft
4planet
Computercraft
industrialcraft
buildcraft
OpenCCsensors
ProjectRed
Peripherals++
any help on designing this program will help me a lot
regards V497_Vesper
V497_Vesper #7
Posted 19 May 2015 - 04:07 PM
thanks to the help i got about the chat box and speaker i have an idea for a system that monitors the reactor that I have built with industrialcraft and nuclear control, I am trying to figure out how to make a computercraft controlled PA system that works throughout the base using the speaker and chatbox. What I am trying to do is this; as the reactor heats up to a certain point a light turns on and as the light comes on I need a computer controlled system that detects the redstone input of each nuclear control remote thermal montior, as the reactor heats up to that level I need a program to announce the heat status of the reactor each level it goes through example

Green light 1> "Reactor heat level at 1000 Degrees"
Green light 2> "Reactor heat level at 2000 Degrees"
Yellow light 1> "CAUTION! Reactor heat level at 3000 Degrees"
Yellow light 2> "CAUTION! Reactor heat level at 4000 Degrees"
Orange light 1> "ALERT! Reactor heat level at 5000 Degrees"
Orange light 2> "ALERT! Reactor heat level at 6000 Degrees"
Red light 1> "WARNING! WARNING! Reactor heat leve at 7000 Degrees"
Red light 2> "DANGER! DANGER! REACTOR CRITICAL! EVACUATE ALL PERSONELL!"
at this point the alarm would be blaring and the lights ab ove the heat indicator would flash
using the redstone signal emitted from each remote thermal monitor is there a way to get the computer to detect these signals and announce the status?
Edited on 19 May 2015 - 02:09 PM
Cranium #8
Posted 19 May 2015 - 04:33 PM
Moved to Ask A Pro.
Please post any code you have, so that we may help you troubleshoot what you have.
Lyqyd #9
Posted 19 May 2015 - 04:44 PM
Threads merged. Please stick to one topic for all questions regarding your reactor monitoring system.
V497_Vesper #10
Posted 19 May 2015 - 05:59 PM
Moved to Ask A Pro.
Please post any code you have, so that we may help you troubleshoot what you have.

all i got is the peripheral.wrap command and i have no idea where to go after this i know what i want to do but due to my lack of experience in codes i cannot write a good program to do this; i have absolutey no idea what i need to do i mean i need the computer to detect the redstone signal but it is a matter of having it detect each signal that gets outputted i.e from 1000 to 2000 degrees and so on right up to the limit where i need the computer to disable the reactor until it cools down any suggestions will be greatfully accepted
regards V497 vesper
Edited on 19 May 2015 - 04:47 PM
Dragon53535 #11
Posted 19 May 2015 - 07:49 PM
Right, so. The error you got was my mistake. Now that screen though is temporary. To make something that is saved as a file on the computer, you need to edit the file.


edit filename
Boom, you'll get a mostly blank screen, with a bit of text at the bottom left. You are now inside a file and making a script. Whatever you type here, as long as it's code or comments (Denoted by typing –) it will work. Of course you should of noticed the code I gave you failed to work and sent an error, that was my mistake. Now lets say that you've put in whatever code you want into the file, and want to test it. You need to press ctrl, then move the cursor to save and press enter, then ctrl and move it to exit and press enter.

To run your code, you just need to enter the filename. So in the case of what I did, I would just type filename. and boom it would run.
Now for errors.
If you noticed, the error you got was formatted like this

filename:lineNumber:error
So if we were to go into the textutils api file we would look at line 104 to see our error, however we already know the error problem is that I didn't supply the correct type of data to the function textutils.tabulate and it errored for that.

So lets say that we purposely put an error inside our test file "filename" and made sure it would error. We'd see something like this:

filename:1:Attempt to index ? (A nil value)
Ah so on line one, we're screwing up, okay.
This is why if you ask for help here and you get an error, they will ask for the full error message.

Now, onto helping you code.

Now I have a couple questions, what does your setup look like? Because it is very much possible to set something like this up,just need to know the setup.
V497_Vesper #12
Posted 19 May 2015 - 09:11 PM
the setup of my system or my computercraft setup?
Computercraft setup location:



Progressive heat monitoring system Exterior:



Progressive heat monitoring system rear:



Lua coding so far:



this is what i got so far, i really would like this system to work as it is something i have always wanted to do in minecraft using computercraft

regards V497 Vesper
Edited on 19 May 2015 - 07:12 PM
Dragon53535 #13
Posted 19 May 2015 - 10:18 PM
Alright, how's the reactor input being received?
V497_Vesper #14
Posted 19 May 2015 - 10:42 PM
the panels at the bottom of the Progressive heat monitor system receive the signal from the reactor remotely,
When the reactor reaches the heat level, example 1000 the reactor transmits its heat status to the remote thermal monitor which when the heat is reached it outputs a redstone signal that gets picked up by the bundled cable at the back of the wires where i use project red wiring
Dragon53535 #15
Posted 19 May 2015 - 11:00 PM
Some versions of CC aren't compatible with Project Red cables.
Real quick, type rs.setBundledOutput("back",colors.red) in the lua prompt and see if the red cable turns on. If it does, then we can continue further.
Edited on 19 May 2015 - 09:01 PM
V497_Vesper #16
Posted 19 May 2015 - 11:20 PM
that doesn't work, how about the rs.setoutput("back", true) i tried that and it activated the cable but it only linked to a coloured cable before linking to the wire bundle is there a workaround for this?
Edited on 19 May 2015 - 10:09 PM
Dragon53535 #17
Posted 21 May 2015 - 05:50 AM
There is a sort of workaround however you will need a line of redstone going to the computer. Note that it's redstone, not cables. Then set it so that each color is set to connect to a different spot on that line, (I would make it so that the lowest level is the farthest away). When that is setup go into the lua prompt, and type rs.getAnalogInput("back"), then turn on each of the colors in sequence so that you know what the number is for each. Now you can differentiate between the colors.
V497_Vesper #18
Posted 21 May 2015 - 11:26 AM
ok i got a table here that i put together using the rs.getAnalogInput("back") command in lua

Cable colour ¦ input ¦ Temperature
=============================
White cable ¦ 13 ¦ 1000 degrees
Orange cable ¦ 12 ¦ 2000 degrees
Magenta cable ¦ 11 ¦ 3000 degrees
Blue cable ¦ 10 ¦ 4000 degrees
Yellow cable ¦ 09 ¦ 5000 degrees
Green cable ¦ 08 ¦ 6000 degrees
Pink cable ¦ 07 ¦ 7000 degrees
Red cable ¦ 06 ¦ 8000 degrees

how can i use this to work on my Computercraft base PA system?
The thing is if the white cable is still active regardless of what other cable is active E.g. red cable which is the critical point it will always show 13 as the active cable so if the scale is all lit from 13 to 06 all the computer will detect is 13
Edited on 21 May 2015 - 09:47 AM
Bomb Bloke #19
Posted 21 May 2015 - 11:47 AM
Unfortunately, while quite clever, Dragon's solution will only allow you to detect one colour at a time - whichever enabled one is closest to your computer. If you want to use the bundled cable as a proper bundled cable, you'll have to get rs.getBundledInput() working.

Maybe you've got read-only capabilities? I've got a memory that some version of Project Red was limited in that way, but for your purposes, that may be enough! Try rs.getBundledInput("back") with various colours lit/unlit and see what results you get back.
V497_Vesper #20
Posted 21 May 2015 - 12:41 PM
Unfortunately, while quite clever, Dragon's solution will only allow you to detect one colour at a time - whichever enabled one is closest to your computer. If you want to use the bundled cable as a proper bundled cable, you'll have to get rs.getBundledInput() working.

Maybe you've got read-only capabilities? I've got a memory that some version of Project Red was limited in that way, but for your purposes, that may be enough! Try rs.getBundledInput("back") with various colours lit/unlit and see what results you get back.

i tried this and it will not work, this is starting to get frustrating when you have a good idea and it doesn't even seem possible, i have an updated version of project red, and updated version of computercraft, an updated version of Nuclear control and an updated version of openccsensors.
the ComputerCraft Bundled Cable API does not appear to work so now what can i do?
Edited on 21 May 2015 - 10:57 AM
Bomb Bloke #21
Posted 21 May 2015 - 01:01 PM
Hearing "it won't work" is always frustrating when the person saying it could've explained what happened instead. Ditto for "updated" in lieu of actual version numbers.

But ok, let's go with that; your next option is to try a different cable. Ender I/O's Insulated Redstone Conduits are supposed to have the required support.
V497_Vesper #22
Posted 21 May 2015 - 02:30 PM
Ender IO doesn't even attach to my remote thermal monitors in minecraft the only system i had was the project red system that connected to everything else BUT computercraft blocks, it looks like that the only chance for this system that i want to become a reality is if there is an update to computercraft which allows the bundled cable to attach to the computer
Lyqyd #23
Posted 21 May 2015 - 02:35 PM
Please post the version numbers for ComputerCraft and ProjectRed.
V497_Vesper #24
Posted 21 May 2015 - 02:47 PM
Please post the version numbers for ComputerCraft and ProjectRed.

Minecraft version 1.710
Computercraft version: v1.73
Project red Base: v4.4.5.44
Project red Integration: v4.4.5.44
Project red compat: v4.4.5.44
Project red lighting: v4.4.5.44
Project red Mechanical: v4.4.5.44
Project red World: v4.4.5.44
Edited on 21 May 2015 - 12:49 PM
Lyqyd #25
Posted 21 May 2015 - 04:41 PM
You appear to have an outdated version of ProjectRed. Try updating to a more recent build (4.6+).
V497_Vesper #26
Posted 21 May 2015 - 06:19 PM
You appear to have an outdated version of ProjectRed. Try updating to a more recent build (4.6+).

thank you very much lyqyd the project is back on track thanks to your suggestion so now i can resume getting help with writing this reactor heat monitoring program the cable bundle actually attaches to the computer
Edited on 21 May 2015 - 04:23 PM
jakejakey #27
Posted 21 May 2015 - 11:25 PM
On the peripherals++ thread there is probably a list of commands that come with all the peripherals but if you want to find out everything a peripheral or api can do this will help:

API:
for i,v in pairs(API) do print(i) end

Peripheral:
table = peripheral.getMethods("left")
for i=1,#table do
  print(table[i])
end

Just a little useful tip
(and notice to anavrins or lyqyd i am trying to help.) (I know this isn't relevant.)
Edited on 21 May 2015 - 09:29 PM
V497_Vesper #28
Posted 23 May 2015 - 08:55 PM
Once again now that i am updated in project red and Computercraft I will explain what i wish to do,
Using nuclear control in conjuction with Computercraft I want to create a computerised PA system to announce the Heat level of the reactor as it hits the predesignated temperature, the exterior of the system looks like this:



the general idea and concept is this,

whenever the reactor heat level increases it will turn on a light it it goes in this sequence:

Green Light 1: No Concern
Green Light 2: A little bit of concern
Status: <All ok>

Yellow Light 1: Heat level above acceptable limits
Yellow Light 2: Heat level a bit too high
Status: <Caution!>

Orange light 1: Heat level VERY high
Orange light 2: Heat level Very Near Critical
Status: <Warning!>

Red Light 1: Heat Level Severely high
Red Light 2: Heat Level Critical
Status: <Evacuate all none essential personnel>

the PA system created by using Computercraft in conjuction with Peripherals++ And Nuclear Control will announce the text in between "<Status>" the dialogue will be something like

Green Light 1: "Reactor heat level Increase detected"
Green Light 2: "Attention, Reactor heat level at 2000 Degrees"

Yellow Light 1: "Caution! Reactor Heat level above Normal Level"
Yellow Light 2: "Caution! Reactor heat level at 4000 Degrees"

Orange Light 1: "Warning! heat Level above acceptable limit!"
Orange Light 2: "Danger! reactor Heat level at 6000 Degrees"

Red Light 1: "Danger! reactor heat level Critical! Evacuate all none essential Personnel!"
Red Light 2: "Reactor Critical! Reactor Critical! Meltdown Imminent!"

At this point the reactor will shut down, i intend to use rednet to broadcast this message throughout the base

the nuclear control part is complete and working hpwever i am still stuck on coding the computercraft program side to this system, The link to the video of the Nuclear control part working is Below:

https://www.youtube....h?v=QEbAWeSEax0

any help i receive with this project will be greatly appreciated

Regards V497 Vesper
Edited on 23 May 2015 - 08:16 PM
Dragon53535 #29
Posted 24 May 2015 - 01:04 AM
Real quick. I watched the video, however I'm confused how the computer will be getting the information about the reactor being overheated. Earlier I assumed that the redstone was what gave the computer the information about the reactor being heated up, however now I'm not so sure.
V497_Vesper #30
Posted 24 May 2015 - 01:23 AM
Real quick. I watched the video, however I'm confused how the computer will be getting the information about the reactor being overheated. Earlier I assumed that the redstone was what gave the computer the information about the reactor being heated up, however now I'm not so sure.

my idea is that the computer detects the signal from the bundled cable and outputs the information
this video gave me the idea:
https://www.youtube.com/watch?v=A74CCAAW4UE

something similar to
rs.getBundledInput("back",colors.white)
Edited on 23 May 2015 - 11:50 PM
Dragon53535 #31
Posted 24 May 2015 - 01:51 AM

print(colors.test(rs.getBundledInput("back"),colors.red))
Try this with the red cable turned on.
V497_Vesper #32
Posted 24 May 2015 - 02:01 AM
i got true
1
on the screen now
Dragon53535 #33
Posted 24 May 2015 - 02:15 AM

local input = rs.getBundledInput("back")
if colors.test(input,colors.red) then
  --#Do emergency stuff
elseif colors.test(input,colors.orange) then --# Or whatever the next lowest is
  --#Do the next level downs stuff
elseif colors.test(input,colors.green) then --# add more of these for each color, going down the line of highest to lowest.
  --# Do the green stuffs
end
V497_Vesper #34
Posted 24 May 2015 - 03:28 AM
i did the coding and it seemed okay but when i changed it to startup and reboot i get
bios:367: [string "startup"]:7: 'then' expected what have i done wrong?
here is the pastebin
http://www.pastebin.com/0BMMVHRM
Bomb Bloke #35
Posted 24 May 2015 - 03:35 AM
You've stuck a comma in a place where it wasn't expected.
V497_Vesper #36
Posted 24 May 2015 - 04:02 AM
ok now that is sorted another problem has arisen, i saved it as startup but it doesn't act like a startup program, i download correct and save it as startup and still i get this:



and this is after i saved the corrected file as startup and rebooted the computer, What am i doing wrong?
Edited on 24 May 2015 - 02:02 AM
Bomb Bloke #37
Posted 24 May 2015 - 04:27 AM
Well, your script is programmed to check your input once, then end. Did you intend to loop it…?

while true do
  -- check input, do speaker stuff

  os.pullEvent("redstone")
end
V497_Vesper #38
Posted 24 May 2015 - 10:24 AM
what i intended to do was use this progam to announce the heat status of the reactor each time it rises sort of a Public Address system throughout the base; it is essentially a warning system to alert anoyone on the base that there is something up with the reactor which is why i wanted it to interact with the nuclear control system so how should i modify the code to do this?
Bomb Bloke #39
Posted 24 May 2015 - 10:33 AM
Well, what you've got is a script which checks the current states of your redstone inputs and does stuff with your speaker - but only once every time you run it.

So, take another look at that code snippet I suggested above - which is designed to repeat a section of code over and over, once for every time your computer's redstone inputs change - and take a guess as to how you might combine the two.
V497_Vesper #40
Posted 24 May 2015 - 03:09 PM
this is the program here: http://www.pastebin.com/16TeaFTE

and this is the error:


i have no idea how to get this to work i mean i got it running but when the event was triggered the speaker did not speak like i wanted it to, it didn't even speak i then rewritten the code with

while true do
os.pullEvent("redstone")
end

After i did that it still didn't work so i have no idea what to do
Edited on 24 May 2015 - 01:45 PM
KingofGamesYami #41
Posted 24 May 2015 - 06:02 PM

speaker=peripheral.wrap("right")
local input = rs.getBundledInput("back") --#set the input variable to whatever the bundled input was when
                                         --#the program was started.  This variable is not changed anywhere.
while true do --#forever
  os.pullEvent("redstone") --#pull the redstone event
end
--#everything below here will not be executed, because you never exit the above loop
if colors.test(input,colors.red) then
  speaker.speak("Reactor Critical!   Reactor critical!  Meltdown Imminent")
end --#this end is unnecessary and wrong; you can't have an else after you end your if.
    --#it also causes the <eof> expected (End Of File) error.
elseif colors.test(input,colors.pink) then
  speaker.speak("Danger!  Reactor heat level Critical!  Evacuate all none essentail Personnel!")
elseif colors.test(input,colors.green) then
  speaker.speak("Danger! Reactor Heat level at 6000 Degrees!")
elseif colors.test(input,colors.yellow) then
  speaker.speak("Warning! Reactor Heat Level above Acceptable limit!")
elseif colors.test(input,colors.blue) then
  speaker.speak("Caution! reactor Heat level at 4000 degrees!")
elseif colors.test(input,colors.magenta) then
  speaker.speak("Caution! Reactor Heat above Normal Level!")
elseif colors.test(input,colors.orange) then
  speaker.speak("Attention!  Reactor Heat Level at 2000 degrees")
elseif colors.test(input,colors.white) then
  speaker.speak("attention, Reactor heat level increase detected")
end --#here you end your if/elseif statement.
</eof>
Edited on 24 May 2015 - 04:05 PM
V497_Vesper #42
Posted 24 May 2015 - 06:12 PM
thanks for the reply KingofGamesYami so here is my next question;
how do i rectify this error and get the program to work each time a cable is activated?
KingofGamesYami #43
Posted 24 May 2015 - 06:19 PM
Step 1: Remove the end I marked as unnecessary.

Step 2: place your 2nd line (the one defining input) inside the while loop, but after the os.pullEvent.

Step 3: move your newly fixed if/elseif statement (everything currently after the while loop) into the while loop, but after you define your input variable.

I hope this helps!
V497_Vesper #44
Posted 24 May 2015 - 06:44 PM
sorry to be a pain but i did what you said and got this:



the pastebin is this: http://www.pastebin.com/9rbDWZMQ
i think i went wrong somewhere, i have a feeling i missed something out.
I added an end to the part of the coding below the os.pullEvent("redstone") and saved it, the startup program saved but it didn't do what i want it to do i then moved the end down to below the local input = rs.getBundledInput("back") line and still it didn't work what is meant to happen is when a light of the progressive reactor heat monitor system turns on the speaker should tell us the status example if the light above the 1000 degrees sensor comes on the speaker should say "Reactor heat level increase detected" but it doesn't it stays silent, what am i doing wrong?
Edited on 24 May 2015 - 04:55 PM
KingofGamesYami #45
Posted 24 May 2015 - 06:51 PM
You removed an end you weren't supposed to - simply add one to the end of your program.
V497_Vesper #46
Posted 24 May 2015 - 07:59 PM
speaker=peripheral.wrap("right")
while true do
os.pullEvent("redstone")
local input = rs.getBundledInput("back")
end
if colors.test(input,colors.red) then
speaker.speak("Reactor Critical!   Reactor critical!  Meltdown Imminent")
  elseif colors.test(input,colors.pink) then
  speaker.speak("Danger!  Reactor heat level Critical!  Evacuate all none essentail Personnel!")
  elseif colors.test(input,colors.green) then
  speaker.speak("Danger! Reactor Heat level at 6000 Degrees!")
  elseif colors.test(input,colors.yellow) then
  speaker.speak("Warning! Reactor Heat Level above Acceptable limit!")
  elseif colors.test(input,colors.blue) then
  speaker.speak("Caution! reactor Heat level at 4000 degrees!")
  elseif colors.test(input,colors.magenta) then
  speaker.speak("Caution! Reactor Heat above Normal Level!")
  elseif colors.test(input,colors.orange) then
  speaker.speak("Attention!  Reactor Heat Level at 2000 degrees")
  elseif colors.test(input,colors.white) then
  speaker.speak("attention, Reactor heat level increase detected")
end

this is what my program looks like at the moment, even with this editing that was suggested the speaker still won't speak when the signal from the cable is active what am i doing wrong?
Edited on 24 May 2015 - 06:03 PM
KingofGamesYami #47
Posted 24 May 2015 - 08:00 PM

speaker=peripheral.wrap("right")
while true do
  os.pullEvent("redstone")
  local input = rs.getBundledInput("back")
  if colors.test(input,colors.red) then
    speaker.speak("Reactor Critical! Reactor critical! Meltdown Imminent")
  elseif colors.test(input,colors.pink) then
    speaker.speak("Danger! Reactor heat level Critical! Evacuate all none essentail Personnel!")
  elseif colors.test(input,colors.green) then
    speaker.speak("Danger! Reactor Heat level at 6000 Degrees!")
  elseif colors.test(input,colors.yellow) then
    speaker.speak("Warning! Reactor Heat Level above Acceptable limit!")
  elseif colors.test(input,colors.blue) then
    speaker.speak("Caution! reactor Heat level at 4000 degrees!")
  elseif colors.test(input,colors.magenta) then
    speaker.speak("Caution! Reactor Heat above Normal Level!")
  elseif colors.test(input,colors.orange) then
    speaker.speak("Attention! Reactor Heat Level at 2000 degrees")
  elseif colors.test(input,colors.white) then
    speaker.speak("attention, Reactor heat level increase detected")
  end 
end
V497_Vesper #48
Posted 24 May 2015 - 08:15 PM
Thank you very much for your help KingofGamesYami the program is now working fully thanks for your help!
and thank you to all those who offered suggestions and tips during the build of this program

regards V497 Vesper
Edited on 24 May 2015 - 06:21 PM
V497_Vesper #49
Posted 24 May 2015 - 09:17 PM
one last question, yes the program works however the speaker speaks over itself as it reaches the level so how do i stop this? i need the speaker to finish speaking before saying the next thing
KingofGamesYami #50
Posted 24 May 2015 - 09:22 PM
I'm not sure, does the speaker have a function to tell whether or not it is done speaking? Other than that, you could use a sleep - keep in mind, the sleep will eat redstone events, potentially making the program miss an increase/decrease.
V497_Vesper #51
Posted 24 May 2015 - 09:39 PM
according to this:
https://github.com/austinv11/PeripheralsPlusPlus/wiki/Speaker
there is a parameter but i do not know where to impliment it
KingofGamesYami #52
Posted 24 May 2015 - 11:19 PM

speaker=peripheral.wrap("right")
local speaking = false
local red = true
while true do
  while red or speaking do --#while we are waiting for redstone or the speaker to finish
    local event = os.pullEvent() --#pull an event
    if event == "speechComplete" then --#if the speaker stopped speaking
      speaking = false --#we are no longer waiting for it to finish
    elseif event == "redstone" then --#if a redstone change occured
      red = false --#we are no longer waiting for redstone
    end
  end
  local input = rs.getBundledInput("back")
  speaking = true --#we're now waiting for it to speak
  red = true --#and for a redstone change to occur
  if colors.test(input,colors.red) then
    speaker.speak("Reactor Critical! Reactor critical! Meltdown Imminent")
  elseif colors.test(input,colors.pink) then
    speaker.speak("Danger! Reactor heat level Critical! Evacuate all none essentail Personnel!")
  elseif colors.test(input,colors.green) then
    speaker.speak("Danger! Reactor Heat level at 6000 Degrees!")
  elseif colors.test(input,colors.yellow) then
    speaker.speak("Warning! Reactor Heat Level above Acceptable limit!")
  elseif colors.test(input,colors.blue) then
    speaker.speak("Caution! reactor Heat level at 4000 degrees!")
  elseif colors.test(input,colors.magenta) then
    speaker.speak("Caution! Reactor Heat above Normal Level!")
  elseif colors.test(input,colors.orange) then
    speaker.speak("Attention! Reactor Heat Level at 2000 degrees")
  elseif colors.test(input,colors.white) then
    speaker.speak("attention, Reactor heat level increase detected")
  else
    speaking = false --#we aren't waiting if it didn't speak, this is probably not needed but I like to program for any situation.
  end
end
Edited on 24 May 2015 - 09:26 PM
V497_Vesper #53
Posted 24 May 2015 - 11:59 PM
KingofGamesYami after applying your code above, everything is now working as i intended it to; now all i got to do is impliment this around the base as it grows thank you so much for helping me with this coding i really appreciate it,

thanks to Dragon53535 for the suggestion on the wiring detection
thanks to Bomb Bloke and KingofgamesYami for the suggestions and troubleshooting

regards V497 Vesper
V497_Vesper #54
Posted 02 July 2015 - 02:23 PM
dumb question but this program was built in computercraft 1.73, will it work in 1.74?
jerimo #55
Posted 02 July 2015 - 05:36 PM
dumb question but this program was built in computercraft 1.73, will it work in 1.74?
Compatibility is normally good in computer craft, as long as you try to run an old program in a newer version it will work most of the time