ID:167067
 
How do i make stuff keep listing, not just the first thing. like for example:

mob/verb/Test()
set category = "Test"
for(var/O in songs)
var/pooo = ("[O] - [File_Size(O)]")
usr << browse(pooo,"window=testy,size=250x300")


All that does is list the first file, is there a way to make it list the whole list?
Evidence wrote:
How do i make stuff keep listing, not just the first thing. like for example:

> mob/verb/Test()
> set category = "Test"
> for(var/O in songs)
> var/pooo = ("[O] - [File_Size(O)]")
> usr << browse(pooo,"window=Announce,size=250x300")
>
>

All that does is list the first file, is there a way to make it list the whole list?

Some things you do inside loops, some things you do outside. Filling your output with song titles: inside the loop. Clearly that has to be done for every song. Sending the final output: outside the loop.

When you use browse() it sends an entire HTML document. It does not send text one line at a time like you see in ordinary text output. Therefore you have to create an empty string, add to it (and add <br> tags too), then output the whole thing at once via browse().

Lummox JR
In response to Lummox JR
Do you think i could get an example of this? I'm more of a visual learner.
In response to Evidence
mob/verb/Test()
set category = "Test"
var/a
for(var/O in songs)
var/pooo = ("[O] - [File_Size(O)]")
a+="[pooo]<br>"
usr << browse(a,"window=Announce,size=250x300")
In response to Mysame
Ok, that works, but one more problem, it lists all the songs correctly but when i click one, it goes through all of them asking me if i want to download them.
Test()
set category = "Admin"
var/poo
for(var/O in songs)
var/pooo = ("<a href=?src=\ref[src];action=songs>[O] - [File_Size(O)]")
poo += "<a href=?src=\ref[src];action=songs>[pooo]<br>"
usr << browse(poo,"window=testy,size=250x300")

Topic(href,href_list[])
switch(href_list["action"])
if("songs")
var/Alert = alert(usr,"Download [songs] [File_Size(songs)]","Download","Yes","No")
switch(Alert)
if("Yes")
usr<<ftp(src)
sleep(20)
usr<<"You have succesfully downloaded [songs]"
if("No")
usr << "lol"
return
.=..()


In response to Evidence
<a href=?src=\ref[src];Title=[O];action=songs>


You have got your Topic completey wrong its got usr and src in it both pointing at the player.... and your alert code...

    Test()
set category = "Admin"
var/poo
for(var/O in songs)
var/pooo = ("<a href=?src=\ref[src];Title=[O];action=songs>[O] - [File_Size(O)]")
poo += "<a href=?src=\ref[src];Title=[O];action=songs>[pooo]<br>"
src << browse(poo,"window=testy,size=250x300")




Topic(href,href_list[])
switch(href_list["action"])
if("songs")
var/Song = href_list["Title"]
src << ftp(Song)

Etc etc etc