Jump to content


Quinncunx's Content

There have been 9 items by Quinncunx (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#17264 Bundled Cables and CC

Posted by Quinncunx on 30 June 2012 - 01:51 AM in General

I know this is not strictly a cc problem, though I was looking to see if anyone had any advice, the short of it is, Bundled Cables work in our creative areas of the map but not in the survival areas, we have been testing it with a small script

rs.setBundledOutput("back", colors.white)
sleep(0.5)
rs.setBundledOutput("back", 0)
rs.setBundledOutput("back", colors.red)
sleep(1.0)
rs.setBundledOutput("back", 0)

works in the creative areas, fails in the survival areas, any suggestions?



#17209 [LUA] [ERROR] ACsln:55:Bad Arguement: number expect, got string

Posted by Quinncunx on 29 June 2012 - 06:02 PM in Ask a Pro

Thanks for that, Now it seems to just be freezing but thats a new 24 hours of looking at it before I ask for help :P/>



#17201 [LUA] [ERROR] ACsln:55:Bad Arguement: number expect, got string

Posted by Quinncunx on 29 June 2012 - 05:33 PM in Ask a Pro

Making a program that would control a factory to automatically create computers, factory side works well, just trying to now program the bundled cable outputs based on the users input on how many they want making, though I keep getting this error:

ACsln:55:Bad Arguement: number expect, got string

I have tried several things to make this work, I get that it is basically saying I am trying to compare a number with a string, but as far as I can see all my numbers are numbers.

Any help would be appreciated.


print("How many computers would you like to build?")
local num = tonumber(read())
if num > 5 then
  print("Please input a smaller amount this time")
elseif input == 0 then
  print("please enter an amount")
elseif input == 1 then
  stonex = tonumber(7)
  redstonex = tonumber(1)
  glassx = tonumber(1)
  print("glassx")
elseif input == 2 then
  stonex = (14)
  redstonex = tonumber(2)
  glassx = tonumber(2)
elseif input == 3 then
  stonex = tonumber(21)
  redstonex = tonumber(3)
  glass = tonumber(3)
elseif input == 4 then
  stonex = tonumber(28)
  redstonex =tonumber(4)
  glass = tonumber(4)
else
  stonex = tonumber(35)
  redstonex = tonumber(5)
  glassx = tonumber(5)
end
for i=1,tonumber(redstonex),1 do
rs.setBundledOutput("back", "color.red")
sleep(0.5)
redstone.setBundledOutput(sSide, 0)
  for j=1,glassx,1 do
   rs.setBundledOutput("back", "color.white")
   sleep(0.5)
   redstone.setBundledOutput(sSide, 0)
    for k=1,stonex,1 do
	 rs.setBundledOutput("back", "color.white")
	 sleep(0.5)
	 redstone.setBundledOutput(sSide, 0)
    end
  end
end



#15971 [LUA] [HELP] How to programatically copy a file from disk to root directory o...

Posted by Quinncunx on 16 June 2012 - 11:59 PM in Ask a Pro

Effectively I am trying to make an installer/uninstaller for a program, how do I programatically copy a file from the disk to the root directory of the console. I was thinking this

[CODE]
fs.copy("file", ".. /file")
[/CODE

however it is telling me Invalid path, though if I was to type that as a shell command it would work.

So I am a bit confused.



#15945 Program is not running or throwing any error

Posted by Quinncunx on 16 June 2012 - 04:01 PM in Ask a Pro

Thanks for that input, it did make the program run, and I have altered some of the logic now, the only problem I seem to have now is the Key event is not working any suggestions

-Revised Code

local pwfile = "pwfile.txt"
local sidefile = "sidefile.txt"
local file = fs.open (pwfile, "r")
local file2 = fs.open(sidefile, "r")
--Checks if the password and side file cfg exists if true then runs phase 1 if false then runs phase 2
print("checks for cfg")
if file and file2 then
-- PHASE 1
local password = file.readAll()
local side = file2.readAll()
file.close()
file2.close()
term.clear()
print("Key Code:")
print("Hit F9 to change your keycode")
--need to move actual check to here
local input = read("*")
-- masks the keycode input

if input == password then
   print("Keycode Correct!")
   rs.setOutput(side, true)
   sleep(5)
   rs.setOutput(side, false)
   os.reboot()
  
-- Dim key event
local key, param1 = os.pullEvent(key)
-- checks to see if F9 has been hit
elseif param1 == 67 then
-- changing keycode code
	 local pw = "pwfile.txt"
	 local file = fs.open (pwfile "r")
	 file.close()
	 print("Please enter your current keycode:")
	 local input read("*")
--checks the entered password is correct
	   if input == password then
		  print("Now enter your new keycode:")
		  local pwin read ("*")
		  local npwin = pwin
		  file = fs.open(pwfile, "w")
		  file.write(npwin)
		  file.close()
		  print("Console will now reboot")
		  sleep(2)
		  os.reboot()
	   else
		  print("Your keycode was incorrect")
		  sleep(5)
		  os.reboot()
	   end
	else
	   print("Keycode Incorrect")
	   sleep(2)
	   os.shutdown()
	end

else
--Phase 2
--runs initial cfg
   print("Inital Configuration - Please enter your desired keycode:")
   local inputpw = read("*")
   local pwnew = inputpw
   file = fs.open(pwfile, "w")
   file.write(pwnew)
   file.close()
   term.clear()
   print("Inital Configuration - Please enter the side of the console that the door is connected ton Right | Left | Back")
   local inputside = read()
   local sidenew = inputside
   file2 = fs.open(sidefile, "w")
   file2.write(sidenew)
   file2.close()
   print("settings configured Console will now reboot")
   sleep(5)
   os.reboot()
end
--Print("This is the end, Debug line")

-- EDIT I have solved this now.



#15741 Program is not running or throwing any error

Posted by Quinncunx on 14 June 2012 - 09:37 AM in Ask a Pro

As soon as I run the program it freezes, I will add in some prints prior to
if file and file2 then
to see if its getting to that point



#15713 Program is not running or throwing any error

Posted by Quinncunx on 14 June 2012 - 01:03 AM in Ask a Pro

I have been working on a simple door entry system, that allows a user to run an initial configuration of the code they want to use and the side of the console that it wants the output to be, however, I must of made a mistake in the code, but I cannot see what it is, if anyone could poke at the code and point me to the line number where I am going wrong I would be very grateful.

local pwfile ="pwfile.txt"
local sidefile ="sidefile.txt"
local file = fs.open (pwfile, "r")
local file2 = fs.open (sidefile, "r")
-- Checks if the password file and side file cfg exists
if file and file2 then
local password = file.readAll()
local side = file2.readAll()
file.close()
file2.close()
term.clear()
print("Key Code:")
print("Hit F9 to change your keycode")
local event, param1 = os.pullEvent(key)
-- Checks if f9 has been hit and opens change keycode dialogue
if param1 == 67 then
  local pw = "pwfile.txt"
  local file = fs.open (pwfile, "r")
  file.close()
  print("Please enter your current keycode:")
  local input read("*")
-- checks the entered password is correct
  if input == password then
	print("Now enter your new keycode:")
	local pwin read("*")
-- writes new password to file
	local npwin = pwin
	file = fs.open(pwfile, "w")
	file.write(npwin)
	file.close()
	os.reboot()
  else
  print("Your keycode was incorrect")
  sleep(5)
  os.reboot()
  end
-- runs actual password check to open door
  local input = read("*")
  if input == password then
   print("Keycode correct!")
   rs.setOutput(side, true)
   sleep(5)
   rs.setOutput(side, false)
   os.reboot()
  else
-- if keycode was not correct
   print("Keycode incorrect")
   sleep(2)
   os.shutdown()
  end
else
-- runs intial configuration of the system
print("Initial Configuration - Please enter your desired keycode:")
local inputpw = read("*")
local pwnew = inputpw
file = fs.open(pwfile, "w")
file.write(pwnew)
file.close()
term.clear()
print("Initial Configuration - Please enter the side of the console that the door is connected to\n Right | Left | Back")
local inputside = read()
local sidenew = inputside
file2 = fs.open(sidefile, "w")
file2.write(sidenew)
file2.close()
print("Settings configured OS will now reboot")
sleep(5)
os.reboot()
end
end



#14841 [Question] How do I update a variable is a running script then save the scrip...

Posted by Quinncunx on 06 June 2012 - 05:14 PM in Ask a Pro

Thanks Guys :)/>



#14808 [Question] How do I update a variable is a running script then save the scrip...

Posted by Quinncunx on 06 June 2012 - 02:31 PM in Ask a Pro

I am trying to write a script that will ask users for a password (similar to the tutorial on the wiki) with the difference that when it is run for the first time it asks the user to input their chosen password.

I am not really sure how to do this, I think there could be a solution by having the password saved to an external file to the script then read that in? Then the password could be changed as and when the user requires to do so, any advice and guidance would be greatly appreciated.

Thanks!