Skip to content

Examples

On this page you can find a few example scripts

TARDIS recall script

This script will allow you to move your TARDIS using a pocket computer



For this script you will need:
1. Computer
2. Ender Modem
3. Ender pocket computer


It does not matter whether the Computer and Ender Pocket Computer are Advanced or not


First the code for the computer that is connected to the Time Vortex Interface

pastebin get ZauVCGtU computer.lua

computer.lua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
peripheral.find("modem", rednet.open)
local tardis = peripheral.find("vortexmod:vortex_interface_be") or error("No Time Vortex Interfce connected!")

while true do
    id, message = rednet.receive()

    x = message.x
    y = message.y
    z = message.z
    dimension = message.dim

    tardis.setCoords(x.. " ".. y.. " ".. z)
    tardis.setDimension(dimension)

    if tardis.enableThrottle() then
        rednet.send(0, {status="success"})

        -- ensures tardis does not stay in the time vortex when auto land is disabled
        repeat
            sleep()
        until tardis.readyToLand()

        sleep(0.1)

        tardis.disableThrottle()
    else
        rednet.send(0, {status="failed"})
    end
end

Then the code for the Ender Pocket Computer
Make sure to change the value of tardis_id to the id of the computer connected to the Time Vortex Interface

pastebin get Dp73uTCF pocket.lua

pocket.lua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
rednet.open("back")

local tardis_id = 1

while true do
    print("What X am I going to?")
    local x_number = tonumber(read())
    if x_number ~= nil then
       print("What Y am I going to?")
       local y_number = tonumber(read())
       if y_number ~= nil then
           print("What Z am I going to?")
           local z_number = tonumber(read())
           if z_number ~= nil then
               print("What dimension am I going to?")
               local dimension_string = read()
               local data = {x=x_number, y=y_number, z=z_number, dim=dimension_string}    
               rednet.send(tardis_id, data)
               print("Packet sent")
               id, message = rednet.receive()
               term.clear()
               term.setCursorPos(1, 1)
               print(message.status)
           end
       end 
    end
end

TARDIS control panel

This script will let you have the functionality of a keypad without needing a keypad


For this script you will only need a computer, advanced is not required

pastebin get an90Ma4T panel.lua

panel.lua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local tardis = peripheral.find("vortexmod:vortex_interface_be")

while true do
    local currentTar = tardis.getTargetLocation()
    local currentPos = tardis.getExtLocation()

    term.setCursorPos(1,1)
    term.clear()
    print("Current Position: ".. currentPos.x .. " " .. currentPos.y .. " " .. currentPos.z)
    print("Current Target: ".. currentTar.x .. " " .. currentTar.y .. " " .. currentTar.z)


    print("Enter X coordinate (~ to leave unchanged): ")
    local x = read()
    if x == "~" then
        x = currentTar.x
    else
        x = tonumber(x)
    end

    print("Enter Y coordinate (~ to leave unchanged): ")
    local y = read()
    if y == "~" then
        y = currentTar.y
    else
        y = tonumber(y)
    end

    print("Enter Z coordinate (~ to leave unchanged): ")
    local z = read()
    if z == "~" then
        z = currentTar.z
    else
        z = tonumber(z)
    end

    tardis.setCoords(x .. " " .. y .. " " .. z)

    print("Enable auto pilot? (y/N)")

    if (read() == "y") then
        tardis.enableThrottle()

        term.clear()
        term.setCursorPos(1,1)

        print("Travelling to " .. x .. " " .. y .. " " .. z)
        repeat
            term.setCursorPos(1,2)
            term.clearLine()
            print("ETA " .. tardis.getFlightTime())
            sleep()
        until tardis.readyToLand()

        sleep(.1)
        tardis.disableThrottle()
    end

end