PDA

View Full Version : Informational upload script request



icon315
02-09-2010, 02:29 PM
Is there a way to upload information from a site onto the CLI?

In other words.....upload the daily information from HERE (http://www.noblesse-oblige.org/calendar/) That way you know what to do that day

Bale
02-09-2010, 10:19 PM
Is there a way to upload information from a site onto the CLI?Short answer: Yes.

Long answer: You'll need a script to do that. One example of how this is done is in zarqon's dailydungeon (http://kolmafia.us/showthread.php?t=1866) where he parsed the daily dungeon information from that page. He solved the problem like this:


boolean fetch_roomdata() {
string url = visit_url("http://www.noblesse-oblige.org/calendar/daily_"+today_to_string()+".html");
if (!contains_text(url,"<h3>Daily Dungeon</h3>"))
return vprint("Noblesse Oblige's daily dungeon info is not yet available today.","black",-2);
url = substring(url,index_of(url,"Room ")+5,index_of(url,"Room 10"));
string[int] chunks = split_string(url,"Room ");
if (count(chunks) != 9) return false;
foreach i in chunks
p[to_int(substring(chunks[i],0,3))] = substring(chunks[i],index_of(chunks[i],": ")+2,index_of(chunks[i],"<"));
return (count(p) == 9);
}

Obviously, similar logic could tell you almost anything else you wanted to know.