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

need a bit of help plz :P

Started by Wooki_inthetrees, 13 August 2014 - 01:28 PM
Wooki_inthetrees #1
Posted 13 August 2014 - 03:28 PM
okay so im trying to set this up and i keep getting startup:10: attempt to call nif just wondering if i could get some help thanks :P/>

print('NGG ReactorVision a0.004 Engaged. View Monitor.')

emptyflag=0
offlineflag=0
flashflag=0

reactor = peripheral.wrap('right')
monitor = peripheral.wrap('left')

monitor.setTextScale(2)
monitor.setBackgroundColor(32768)

while true do
monitor.clear()
monitor.setCursorPos(1,1)
monitor.setTextColor(colors.white)
monitor.write('Fuel Level:')
monitor.setCursorPos(1,2)
monitor.setTextColor(colors.yellow)
monitor.write(math.floor(((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Fuel')
monitor.setCursorPos(1,3)
monitor.setTextColor(colors.lightBlue)
monitor.write(math.floor(((reactor.getWasteAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Waste')
monitor.setCursorPos(1,5)
monitor.setTextColor(colors.white)
monitor.write('Control Rod Levels:')
monitor.setTextColor(colors.green)
monitor.setCursorPos(1,6)
monitor.write('Rod 1: '..(100-(reactor.getControlRodLevel(0)))..'% Depth')
monitor.setCursorPos(1,7)
monitor.write('Rod 2: '..(100-(reactor.getControlRodLevel(1)))..'% Depth')
monitor.setCursorPos(1,8)
monitor.write('Rod 3: '..(100-(reactor.getControlRodLevel(2)))..'% Depth')
monitor.setCursorPos(1,9)
monitor.write('Rod 4: '..(100-(reactor.getControlRodLevel(3)))..'% Depth')
monitor.setCursorPos(1,10)
monitor.write('Rod 5: '..(100-(reactor.getControlRodLevel(4)))..'% Depth')
monitor.setCursorPos(1,12)
monitor.setTextColor(colors.white)
monitor.write('Temperature:')
monitor.setCursorPos(1,13)
monitor.setTextColor(colors.lightGray)
monitor.write('Casing: ')
if reactor.getCasingTemperature()>=650 then
monitor.setTextColor(colors.purple)
else if reactor.getCasingTemperature()>=950 then
monitor.setTextColor(colors.red)
else
monitor.setTextColor(colors.green)
end
end
monitor.write(reactor.getCasingTemperature()..'C')

monitor.setCursorPos(1,14)
monitor.setTextColor(colors.yellow)
monitor.write('Fuel: ')
if reactor.getFuelTemperature()>=650 then
monitor.setTextColor(colors.purple)
else if reactor.getFuelTemperature()>=950 then
monitor.setTextColor(colors.red)
else
monitor.setTextColor(colors.green)
end
end
monitor.write(reactor.getFuelTemperature()..'C')

monitor.setCursorPos(1,16)
monitor.setTextColor(colors.white)
monitor.write('Flux:')
monitor.setCursorPos(1,17)
monitor.setTextColor(colors.green)
monitor.write(reactor.getEnergyStored()..' RF Stored ')

if reactor.getEnergyProducedLastTick()>=500 and reactor.getEnergyProducedLastTick()<2000 then
monitor.setTextColor(colors.orange)
end

if reactor.getEnergyProducedLastTick()>=2000 then
monitor.setTextColor(colors.red)
end
monitor.write((math.floor(reactor.getEnergyProducedLastTick()+0.5))..'RF/t')

monitor.setCursorPos(1,19)
monitor.setTextColor(colors.orange)
monitor.write('Warnings:')

if flashflag==0 then
flashflag=1
if offlineflag==1 then
monitor.setCursorPos(1,20)
monitor.setTextColor(colors.lightGray)
monitor.write('OFFLINE - Manual Override')
end
if emptyflag==1 then
monitor.setCursorPos(1,20)
monitor.setTextColor(colors.pink)
monitor.write('OFFLINE - Fuel Exhausted')
end
if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)>75 then
monitor.setCursorPos(1,20)
monitor.setTextColor(colors.yellow)
monitor.write('ONLINE - Low Power Mode')
end
if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)<=75 then
monitor.setCursorPos(1,20)
monitor.setTextColor(colors.orange)
monitor.write('ONLINE - High Power Mode')
end
else
flashflag=0
monitor.setCursorPos(1,20)
monitor.clearLine()
end

if reactor.getEnergyStored()<=10000000 and reactor.getEnergyStored()>100 then
reactor.setAllControlRodLevels(0+(math.floor(reactor.getEnergyStored()/100000)))
else
reactor.setAllControlRodLevels(0)
end

if reactor.getFuelAmount()<=100 and offlineflag==0 then
reactor.setAllControlRodLevels(100)
reactor.setActive(false)
emptyflag=1
else
emptyflag=0
end

if rs.getInput('bottom')==false and emptyflag==0 then
reactor.setActive(true)
offlineflag=0
end

if rs.getInput('bottom')==true and emptyflag==0 then
reactor.setActive(false)
reactor.setAllControlRodLevels(100)
offlineflag=1
end
sleep(1)
end
Lyqyd #2
Posted 13 August 2014 - 03:31 PM
Is the peripheral to the left actually a monitor? Can you provide a screenshot of the setup?
Wooki_inthetrees #3
Posted 13 August 2014 - 07:25 PM
yes i can give me a moment and ill post it just let me take it :P/>/>

all right heres the screenshots :P/>/> http://imgur.com/tDKkShn,aeHzt8X,W8Co98I
Lyqyd #4
Posted 13 August 2014 - 07:45 PM
Your setup appears to be fine. What is the result of running peripheral.getType("left") in the Lua prompt?

If it returns "monitor", a screenshot or list of the results of running this in the Lua prompt would be useful: textutils.tabulate(peripheral.getMethods("left"))

If it doesn't, a mod list might be useful.
Bomb Bloke #5
Posted 13 August 2014 - 07:56 PM
Not that I can see any other obvious triggers around that area of the script, but wouldn't failure to wrap result in an indexing error?
Wooki_inthetrees #6
Posted 13 August 2014 - 08:11 PM
http://imgur.com/J1ODC9I heres the screeny u asked for hope this help im a bt of a nub when it comes to cc and i was thinking of creating a sort of application system where it would ask generic questions and the results of the questions be put on a disk which would be titled with the players name so that the person in charge of the applications could go back and look at the answers on the disks i dont know if thats possible but if it is i think i have a idea on how to do it but any tips i would be grateful for
Lyqyd #7
Posted 13 August 2014 - 11:47 PM
Okay, looks like the problem isn't with the monitor. Can you verify that the code pasted here exactly matches the code on the computer (at least for the first twelve lines)? Also, double checking the error message, especially the line number, would help. Lastly, do you have any startup scripts or ROM modifications that run before this script? Anything that would modify the peripheral API, essentially.
Wooki_inthetrees #8
Posted 14 August 2014 - 05:24 AM
yes i uploaded from the in-game computer to pastebin the directly here give me just a sec and ill check the error message
Edited on 14 August 2014 - 03:24 AM
natedogith1 #9
Posted 14 August 2014 - 06:23 AM
yes i can give me a moment and ill post it just let me take it :P/>/>

all right heres the screenshots :P/>/> http://imgur.com/tDK...aeHzt8X,W8Co98I
umm… I don't see the computer in that screenshot?
Wooki_inthetrees #10
Posted 14 August 2014 - 06:31 AM
there are 3 screenies they and i cant provide the error code as i do not currently have access to the computer because i lost the cords :(/> i will attempt to find them nate as far as those screenshots go if you look above the picture you should see like first second and 3rd
natedogith1 #11
Posted 14 August 2014 - 07:46 AM
Just wondering, in 'setBackgroundColor', why are you using a number(it works, but colors.color would make more sense). I'd like to see what the output is if you put
for k,v in pairs(monitor)
  print(k)
end
between the 'monitor=' and the 'setTextScale'

Also, your computer appears to be at -2950,3056
Wooki_inthetrees #12
Posted 15 August 2014 - 11:12 AM
i figured it out guys lol i apoligize but it was just ignorance on my part i got it now thanks !!!!