Go Back   The Older Gamers Forums > TOG Strategy, RPG and Other Games > Minecraft (Public Forum)

Minecraft (Public Forum) Build it and they will come

Reply
 
LinkBack Thread Tools
Old 20th October 2013, 10:36 AM   #1 (permalink)
Ace - Post: 8304 TOG Silver Level Supporter
 DaedalusAlpha's Avatar

Default Having fun with ComputerCraft and login detection

Another program I wrote which will set a redstone signal (on all sides) when you are logged on. This can be used to turn on and off your machinery so you don't have to do it manually. This program use dropbox as well.

Code:
local CHECK_DELAY = 10 -- minutes
local was_online = false

rs.setOutput("top", false)
rs.setOutput("bottom", false)
rs.setOutput("left", false)
rs.setOutput("right", false)
rs.setOutput("front", false)
rs.setOutput("back", false)

while true do
    local online_file = http.get("https://dl.dropboxusercontent.com/u/?????????/CCPrograms/online.txt")

    if online_file ~= nil then
        local line = online_file.readLine()
        local is_online = (line == "online")
        
        if is_online ~= was_online then
            rs.setOutput("top", is_online)
            rs.setOutput("bottom", is_online)
            rs.setOutput("left", is_online)
            rs.setOutput("right", is_online)
            rs.setOutput("front", is_online)
            rs.setOutput("back", is_online)
            
            was_online = is_online;
            
            if is_online then
                print("Player is online")
            else
                print("Player is not online")
            end
        end
    end
    
    sleep(CHECK_DELAY * 60)
end
It must be saved as "startup" on the computer.

It works by checking a specific file (online.txt) in your dropbox Public/CCPrograms folder. If the file contains the word "online" the signal will be set, otherwise it will be reset. The computer checks this every 10 minutes.

To actually write the value into the file a batch file is required to run on your own computer:

Code:
@echo off

echo online>%userprofile%\Dropbox\Public\CCPrograms\online.txt

start "" /D[path] "[path]\FTB_Launcher.exe"

echo When done playing the game,
pause

echo.>%userprofile%\Dropbox\Public\CCPrograms\online.txt
This batch file (call it FTB.bat for example) will write the online.txt file, start FTB and then wait for the user to press enter when finished playing. When that happens the online.txt file will be reset again. To make it work you have to fill in the path (twice) to your FTB_Launcher.exe on the third line (marked [path]).

From now on you have to start FTB via this batch file instead than the normal launcher.
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote

Old 21st October 2013, 12:36 AM   #2 (permalink)
Ace - Post: 8304 TOG Silver Level Supporter
 DaedalusAlpha's Avatar

Default

On a related note, it would be very neat if we could install this serverside (at least I think it's only required server side): OnlinePlayerDetectionSigns (OPDS) - Bukkit

That way my complicated solution would not be needed
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote
Old 21st October 2013, 11:32 AM   #3 (permalink)
Division Captain
Minecraft
Elite - Post: 2824
 Irimar's Avatar

Grumpy
Default

We can't use Bukkit mods. This is a Forge server.
Irimar is offline   Reply With Quote
Old 21st October 2013, 06:30 PM   #4 (permalink)
Ace - Post: 8304 TOG Silver Level Supporter
 DaedalusAlpha's Avatar

Default

Ah, too bad. It said on the site it would work for FTB, but I guess there are more things to consider.
__________________
EVE Online characters:
Daedalus II
ex-CEO TOGOA, Daedalus III slave of Daedalus II
GW2 characters:
Little Molok Asura Engineer


"Each day I don't get an attempt on my life by a robot from the future I see as a personal failure"
DaedalusAlpha is offline   Reply With Quote
Old 21st October 2013, 10:08 PM   #5 (permalink)
Division Captain
Minecraft
Elite - Post: 2824
 Irimar's Avatar

Grumpy
Default

It will work with the MCPC+ server jar, which you can use to run an FTB server. MCPC+ isn't compatible with some of the other mods we're using.
MCPC+ allows most Bukkit mods to be used with FTB.
Irimar is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +11. The time now is 06:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0