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

Railcraft control program not finding redpulse/redprobe

Started by Mange, 21 November 2012 - 10:00 AM
Mange #1
Posted 21 November 2012 - 11:00 AM
http://pastebin.com/MFGm9mGU

This is my code to control a multiple location railway across the server (multiplayer). When I run this program, the list prints correctly, the input is received, but at the point of the redpulse and redprobe lines (line 43 and following), I get only "No such program". I put in the print(shell.path) of both programs and this latest iteration has me directing the path from root to the programs.

I've tried copying the programs to the root directory with the railrun program, putting in the directory path to the programs, loading the program in the programs directory (this failed multiple times). Does anyone have any suggestions?
Lyqyd #2
Posted 21 November 2012 - 11:21 AM
Please post the code into a code box on the forums rather than linking to a pastebin.

Why do you have extraneous punctuation in your program paths? It should simply be "/rom/programs/redpulse" without periods or colons.
Mange #3
Posted 21 November 2012 - 11:29 AM
-- variable declarations
location = {"Dav","Orrnos","Dani","Mange","Helnrei/Bagger","Slew/Akeroh","City","FantaCWriteR Subway","FantaCWriter Tower","Xerxus","Sriseru","Ke6lgr/","Talon","Callak"}
freqloc = {"red","magenta","pink","brown","orange","yellow","lime","green","gray","light blue","cyan","blue","purple","light gray"}
x = 0
north = false
east = false
returneast = false
west = false
returnwest = false
-- user prompting...note 14 is changed for number of locations
term.clear() -- Clears the screen
term.setCursorPos(1,1) -- Fixes the cursor position
print("Hello. Please choose a destination by number:")
repeat
   x=x+1
   print (x..": "..location[x])
until x == 14
-- user input
input = 0
repeat
   input = tonumber(io.read())
   if (input <= 0) then
	  print("Please choose by number.")
   elseif (input >x) then
	  print("Please choose by number.")
   elseif (input == nil) then
	  print("Please choose by number.")
   end
until (input <= x) and (input >0)
-- assigning frequencies
color = freqloc[input]
freq = 1042 + input
if freq >= 1043 and freq <= 1047 then north = true
end
if freq >= 1056 and freq <= 1058 then east = true
end
if freq > 1060 then west = true
end
-- send pulses
print(shell.path(redpulse))
print(shell.path(redprobe))
shell.run("/rom/programs/bin/redpulse back "..color.." 1 0.5")
if east then shell.run("/rom/programs/bin/redpulse left 1 0.5")
end
if west then shell.run("/rom/programs/bin/redpulse right 1 0.5")
end
if north or west then shell.run("/rom/programs/bin/redpulse top 1 0.5")
end
print("Please proceed to cart launch and enjoy your journey.")
-- check for east-west passage
if east or west then
   repeat
	  if east then while not returneast do
		 probe = shell.run("/rom/programs/bin/redprobe")
		 if (probe == "back = 1 (white)") then returneast = true
		 end
	  end
	  if west then while not returnwest do
		 probe = shell.run("/rom/programs/bin/redprobe")
		 if (probe == "back = 32768 (black)") then returnwest = true
		 end
	  end
   end
   end
   until returneast or returnwest
end

Removed and still "No such program."
Luanub #4
Posted 21 November 2012 - 11:31 AM
You shouldn't need any of the paths unless you've changed the default path setup or had an installation issue.
The problem is the way you're sending your args. They need to be separated by commas. It thinks yoiu are trying to run a program named "/rom/programs/bin/redpulse top 1 0.5".

shell.run("redpulse","top",1,0.5)
Mange #5
Posted 21 November 2012 - 11:37 AM
Ok, I did all that (removing the paths and extra punctuation and put in the commas and quotes) and it worked. Thank you.