ID:264181
 
Code:
proc
CheckHost()
var/http[]=world.Export("http://www.byond.com/members/Yash69/files/Host.txt")
if(!http)
world.log<<"The file with the innital hosts inside it has been deleted"
world.Del()
var/F=file2text(http["CONTENT"])
if(!F)
world.log<<">No File Found"
world.Del()
if(F)
var/CheckHost=findtext(F,"[world.host]")
if(CheckHost)
world.log<<">Host Deteced"
..()
else
world.log<<">No Host Detected, World Closed"
world.Del()
spawn(100) CheckHost()


Problem description: Well, the this is the runtime error I got:
runtime error: bad index
proc name: CheckHost (/proc/CheckHost)
source file: Stuff.dm,7
usr: null
src: null
call stack:
CheckHost()
: New()


In a way, everything works out great. Except the runtime error messes it up. (The spawn is like there just for testing reasons to see what would happen if I delete it. Only happens when the file is deleted or renamed.
The list http doesn't contain "CONTENT". I'm not very familiar with using Export() to grab information from remote files/web pages, but you should probably try "Content" and "content", too.
In response to Jeff8500
Both don't work, give the same runtime

Edit: Line 7 is
        var/F=file2text(http["CONTENT"])
In response to Yash 69
Your code works fine when I tested it (using the exact same file). The CONTENT field should exist if the Export returns the file... so I'm guessing that for whatever reason, it isn't. You could use the example code from the world.Export() proc in F1, to check and see what is actually getting returned.
In response to Ephemerality
I assume it has something to do with exporting a text file.
Maybe you should try checking what world.Export is returning.
In response to Keeth
It returned Yash 69
In response to Yash 69
Then it's returning the text in the file.