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

how to bind codes.

Started by c1doger, 20 February 2013 - 06:16 PM
c1doger #1
Posted 20 February 2013 - 07:16 PM
Title: how to bind codes.

im not sure if i worded that right but im new to CC and i would like to know if there is a way to type a number into the computer to get it to do a command. ex: instead of typing redpulse.bottom 1 1 (i think this is how its done) i want to be able to just type 4815162342.
ive worked with CC a little so thats how i know the redpulse command but i wanted to do this for a map i have. its based off a tv searies and im trying to get it as close as possible. thanks for the help. :)/>
Lyqyd #2
Posted 21 February 2013 - 04:21 AM
Try making a program with that name that does whatever you want. Use `edit filename`, replacing filename with the actual name of the file.
c1doger #3
Posted 21 February 2013 - 09:35 AM
thanks ill try that
JokerRH #4
Posted 21 February 2013 - 11:02 AM
But is there a way to use the pointer directly?
So as far as I understand a table (for example) is a pointer to
an allocated area on your memory. By using tostring it will shows it to you
I don't have a use for this, just want to understand lua a bit better…:)/>
Cranium #5
Posted 21 February 2013 - 11:11 AM
You can use a modification of my cheat code function.

local function checkCode()
local kCode = {75, 72, 79, 76, 79, 77, 80, 81, 75, 80, 28}
local code = false
local index = 1
while true do
  local events = {os.pullEvent()}
  if events[1] == "key" then
   if events[2] == kCode[index] then
	    if index == #kCode then
		 code = true
		 break
	    else
		 code = false
		 index = index + 1
	    end
   else
	    code = false
	    os.queueEvent(events[1], events[2], events[3], events[4])
	    index = 1
	    break
   end
  else
   code = false
   os.queueEvent(events[1], events[2], events[3], events[4])
   break
  end
end
return code
end

This will run silently without output unless the characters 4, 8, 15, 16, 23, 42 are entered. Nice LOST reference btw.
If you want it to display the characters, you just need to modify it to display the character it displays.
c1doger #6
Posted 21 February 2013 - 11:37 AM
glad to see there is some one who knows what im doing thanks cranium. but like i said im still new to this so how would i put that in?

but ya im remodeling the LOST map (by Prof_Snape and IKonakona) to my liking but not going to release it. im using buildcraft, ic2, redpower, and computer craft mods for now. im doing "the hatch" right now and im trying to get the computer set up. already got the timer down using timers, NOT gates, and counters from redpower but still need the computer so i hope this will help.

also if theres a youtube video that could help me out that would be nice to