tpt restarter

  • electronic_steve
    9th Mar 2014 Member 0 Permalink

    Hello everyone. I made a little script to restart TPT without unnecessary action. you simply hover your mouse on the "R" 

     

    also want to note that I made this script primarily for themselves. so I was comfortable.

    Image:http://picture-host.ru/v.php?id=cdf433bb3233fd78935700254c47cb76

    windows code:

     

    local restartButton = Button:new(613, 97, 15, 15, "R", "Restart")
    restartButton:action(function(sender)
    os.execute("TASKKILL /IM \"powder.exe\" /F &&START .\\\"powder.exe\"")
    end)
    interface.addComponent(restartButton)

     

    linux code:

     

    local restartButton = Button:new(613, 97, 15, 15, "R", "Restart")
    restartButton:action(function(sender)
     os.execute("killall -s KILL \"powder.exe\" && ./\"powder.exe\"")
    end)
    interface.addComponent(restartButton)

    Edited 5 times by electronic_steve. Last: 11th Mar 2014
  • mniip
    9th Mar 2014 Developer 1 Permalink
    Doesn't work on my linux
  • nucular
    9th Mar 2014 Member 0 Permalink
    Not really a great idea to let it do that while hovering your mouse on that area... People sometimes make saves without constantly saving and they also sometimes move their cursors on stuff accidentally.
  • electronic_steve
    9th Mar 2014 Member 0 Permalink

    @nucular (View Post)

     I'm sorry but I just do not know how to make this to happen  clicking on the button. :c

     

  • nucular
    9th Mar 2014 Member 1 Permalink
    @electronic_steve
    Something around these lines (untested):

    local restartButton = Button:new(619, 123, 8, 10, "R")
    restartButton:action(function(sender)
    os.execute("TASKKILL /IM \"powder.exe\" /F &&START .\\\"powder.exe\"")
    end)
    interface.addComponent(restartButton)
    Edited once by nucular. Last: 9th Mar 2014
  • electronic_steve
    9th Mar 2014 Member 0 Permalink

    @nucular (View Post)

     nice! thank you

  • zBuilder
    9th Mar 2014 Member 0 Permalink

    why do we need to kill and restart TPT this way?

  • electronic_steve
    9th Mar 2014 Member 0 Permalink

    @zBuilder (View Post)

    I need it to quickly restart scripts

  • Pilihp64
    9th Mar 2014 Developer 0 Permalink

    My script manager has a restart ability built in, exactly for the reason of restarting scripts. It will prompt for a restart when you disable a running script, then simply start the script again one it restarts.

     

    (If you don't want to use it, you could also just use my restart code for linux compat, search for do_restart)

    Edited 2 times by cracker64. Last: 9th Mar 2014
  • electronic_steve
    9th Mar 2014 Member 0 Permalink

    @cracker64 (View Post)

    I know but it's a long