SHOW:
|
|
- or go back to the newest paste.
| 1 | - | function data_set(channel, data) |
| 1 | + | function Chest(chest) |
| 2 | - | data = tostring(data) |
| 2 | + | chestID = chest |
| 3 | - | url = "http://craft-a-cloud.mooo.com/upload.php?name="..channel.."&data="..data |
| 3 | + | |
| 4 | - | encoded=textutils.urlEncode(url) |
| 4 | + | |
| 5 | function Target(chest) | |
| 6 | - | local i=0 |
| 6 | + | if (not chestID) then |
| 7 | - | while data_get(channel) ~= data do |
| 7 | + | error("A Cloud Chest has not been specified yet. First call Chest(id) where the id is your cx4 Chest key.")
|
| 8 | - | if i >= 20 then |
| 8 | + | |
| 9 | - | return false |
| 9 | + | return chestID |
| 10 | end | |
| 11 | - | sleep(0.25) |
| 11 | + | |
| 12 | - | i = i+1 |
| 12 | + | function Set(location, data) |
| 13 | if (not chestID) then | |
| 14 | - | return true |
| 14 | + | error("A Cloud Chest has not been specified yet. First call Chest(id) where the id is your cx4 Chest key.")
|
| 15 | end | |
| 16 | url = "http://boomtree.com/guid/" .. chestID .. ".cc?location=" .. location | |
| 17 | - | function data_get(channel) |
| 17 | + | local ret = http.post(url, data) |
| 18 | - | url = "http://craft-a-cloud.mooo.com/download.php?name="..channel |
| 18 | + | print(ret.readAll()) |
| 19 | - | encoded=textutils.urlEncode(url) |
| 19 | + | |
| 20 | - | response = "" |
| 20 | + | |
| 21 | - | while response == "" do |
| 21 | + | function Get(location) |
| 22 | - | http.request(url) |
| 22 | + | url = "http://boomtree.com/guid/" .. chestID .. ".cc?location="..location |
| 23 | - | event, returnurl, response = os.pullEvent("http_success")
|
| 23 | + | loop = true |
| 24 | - | response = response.readAll() |
| 24 | + | |
| 25 | ||
| 26 | - | return response |
| 26 | + | event, returnurl, response = os.pullEvent() |
| 27 | while loop == true do | |
| 28 | if event == "http_success" then | |
| 29 | return response.readAll() | |
| 30 | else | |
| 31 | print("The request failed.")
| |
| 32 | return | |
| 33 | end | |
| 34 | end | |
| 35 | end |