Jump to content




disable ctrl+T


  • You cannot reply to this topic
11 replies to this topic

#1 schrolock

  • Members
  • 62 posts

Posted 20 July 2012 - 07:54 PM

is it available to disable the ctrl+T function to avoid that my programs getting hacked?

#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 20 July 2012 - 07:57 PM

Hmmm, i don't know. Maybe one of all the posts in the forum about this has an answer.
Seriously, try searching first. There's a lot of posts about this, it's even on the wiki.

#3 schrolock

  • Members
  • 62 posts

Posted 20 July 2012 - 08:02 PM

ok thx

#4 JATO457

  • New Members
  • 1 posts

Posted 21 July 2012 - 08:21 AM

Place this at the top of your code:
os.pullEvent = os.pullEventRaw


#5 schrolock

  • Members
  • 62 posts

Posted 21 July 2012 - 04:37 PM

View PostJATO457, on 21 July 2012 - 08:21 AM, said:

Place this at the top of your code:
os.pullEvent = os.pullEventRaw

Thank You

#6 DireEpidemic

  • New Members
  • 8 posts

Posted 25 July 2012 - 10:55 AM

Awesome but cant they just restart it also?

#7 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 25 July 2012 - 04:31 PM

Yes, that can't be stopped. but with a suitable startup file, you can make your program show up on reboot again...

#8 tfoote

  • New Members
  • 134 posts
  • LocationSalt Lake, UT

Posted 25 July 2012 - 04:48 PM

question, is there a way to detect if they are pushing ctrl + t and stop it before it happens? if so that would be very helpfull... in my code I have an option for the program to autostart where it left off... if i could detect that before it happens i could tell it to automatically start where it left off...

#9 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 25 July 2012 - 05:16 PM

ctrl+t will post a "terminate"-event which can be received like any other event. However, os.pullEvent() catches that one and terminates the program. os.pullEventRaw() doesn't. you have to be careful as os.pullEvent() is also used in sleep() or rednet.recieve().

#10 tfoote

  • New Members
  • 134 posts
  • LocationSalt Lake, UT

Posted 26 July 2012 - 05:35 AM

ok. how much time is between the recieving of the event and the termination? can you change that time?

#11 KingMachine

  • Members
  • 122 posts

Posted 26 July 2012 - 06:01 AM

View Posttfoote, on 26 July 2012 - 05:35 AM, said:

ok. how much time is between the recieving of the event and the termination? can you change that time?
It varies between processors of the hosting computer (ie the one that runs minecraft). To change that time would definitely include changing the rom.

#12 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 26 July 2012 - 09:11 AM

To catch the terminate event is very simple, however it will over ride the global os.pullEvent() so you will need to restore it when closing your program to regain ctrl+t functionality.

Add this to the top of your code:
function os.pullEvent()
    local event, p1, p2, p3, p4, p5 = os.pullEventRaw()
    if event == "terminate" then
   	 print ("Sorry Ctrl+t is disabled")
        sleep(2)
    end
    return event, p1, p2, p3, p4, p5
end

And use this function to restore the original
function restoreEvent()
    function os.pullEvent( _sFilter )
    local event, p1, p2, p3, p4, p5 = os.pullEventRaw( _sFilter )
    if event == "terminate" then
        print( "Terminated" )
        error()
    end
    return event, p1, p2, p3, p4, p5
end
end






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users