Byond Resource Mass Downloader Fail [Fixed] in Developer Help
|
|
Code:
var/list/Blinks proc GetLastPage(var/handle) var/End=findtext(handle,"\">Last»</a>") if(!End||End<1) return null var/Point=End var/Tol=Point-3 var/Out=0 while(Point>Tol) Point-- var/Chk=copytext(handle,Point,End) if(text2num(Chk)) Out=Chk else if(!Out) return null else return Out return null GetHandle(var/Page) var/list/S = world.Export("[Page]") return file2text(S["CONTENT"]) GetHubsOnPage(var/handle) var/list/Hubs=new() var/Pointer=1 var/EPointer=2 while(1) Pointer=findtext(handle,"<div class=\"favorite_game_header\"><a href=\"",EPointer) if(Pointer) Pointer+=43 else return Hubs EPointer=findtext(handle,"\">",Pointer) if(!EPointer) return Hubs Hubs+=copytext(handle,Pointer,EPointer) GetLinksOnHub(var/handle) var/Pointer=1 var/EPointer=2 Pointer=findtext(handle,"byond:",EPointer) if(!Pointer) world<<"Pnter1" return null EPointer=findtext(handle,"##",Pointer) if(!EPointer) world<<"Pnter2" return null return copytext(handle,Pointer,EPointer) GetAllResHubs() var/address="http://www.byond.com/members/?command=search&type=resources&page=" var/handle=GetHandle("[address]1") var/Max=text2num(GetLastPage(handle)) world<<"[Max] Pages Detected" var/list/Hubs=new() if(!Max) return Hubs for(var/A=1,A<=Max,A++) handle=GetHandle("[address][A]") sleep(0) Hubs+=GetHubsOnPage(handle) world<<"Page [A] Done" return Hubs GetAllResHubLinks(var/list/Hubs) var/list/Links=new() var/handle for(var/A in Hubs) if(isnull(A)) continue if(!A) continue handle=GetHandle(A) sleep(0) var/Tmp=GetLinksOnHub(handle) if(Tmp) Links+=Tmp world<<"[A] has been added to the download list" return Links mob verb MassDownload() world<<"Byond Scan Beggining" sleep(0) var/list/Hubs=GetAllResHubs() world<<"Hub List Complete Building Download List" var/list/Links=GetAllResHubLinks(Hubs) world<<Links.len for(var/A in Links) sleep(10) usr<<link(" [A]")
|
Problem description:
It runs very well for a while then Export crashes.
I know parts of it can be more efficient.
I'm more concerned about getting it to work first.
Tryed to make this for AJX x3
Edit:
The above code now works !!!Use At Own Risk!!!
Also note that last bit will most likely crash your computer if left to run as I was just playing with the link proc a bit.
|