ID:140294
 
Code:
mob/verb/icos()
var/list/choices=list(
"Random Girl 1","Random Girl 2","Random Boy 1","Random Boy 2","Random Boy 3")

usr << browse_rsc('players.dmi',"players.dmi")

var/grid = 0

var/icons = {"<style type="text/css"><!--body {margin: 0; padding: 4; background-color: #747474; background-image: url(dmu_av_bg.png); background-position: top; background-attachment: fixed; background-repeat: no-repeat; } .style1 { color: #FFFFFF; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold;} --></style><head><title>Choose Icon...</title></head><center><font face="arial"><body scroll="no"><table width="100%" border="0" cellpadding="0"><tr>"}

for(var/X in choices)
world << "[X]"
icons += {"<td align="center" valign="middle"><a href='?src=\ref[src];picon=[X]'><IMG SRC='players.dmi' ICONSTATE="[X]" ICONDIR=SOUTH border="0" alt="[X]"></a></td>"}
grid++
if(grid==4) { icons += "</tr><tr>" ; grid = 0 }

usr << browse(icons,"window=icon;size=284x218;border=0;can_close=1;can_resize=0;can_minimize=1;titlebar=1")

return


Problem description:

It shows the same icon for every item in the list in the final HTML window. It always goes to the first ICON in my players.dmi. Everything else works fine and appears normal, i checked that X equaled the right text and it does.

If i use the same code to output to an output window instead (like the chat window) it works fine....
The \icon text macro (and similarly, its expansion into an HTML-like tag) don't work in the browser window. You'll need to use browse_rsc() to send the specific icon and icon_state as a single image first.
In response to Garthor
Garthor wrote:
The \icon text macro (and similarly, its expansion into an HTML-like tag) don't work in the browser window. You'll need to use browse_rsc() to send the specific icon and icon_state as a single image first.

Oh :( well that sucks. Thanks though, guess i can stop getting annoyed at my code not working for no good reason >.<
In response to EternalDuelistSoul
Wait i thought browse could only do file/filename. How can i specify icon_state? :/

EDIT: Oh your kidding me. I have to use icon() ???? >.<
In response to EternalDuelistSoul
In response to Garthor
Yeah :/ damn thats a lot of rubbish for just showing an icon that already exists in a browser window.

Imagine i have 100 icons (and i do) im going to have to make 100 little new icon files just so i can show them people. 100 little icons they will have to download as extra resources...

Why does the \icon macro not work in browser windows??
In response to EternalDuelistSoul
EternalDuelistSoul wrote:
Why does the \icon macro not work in browser windows??

Most likely because \icon does not exist in HTML which is Browser.
If you want to display something DM related, you'll need to use DM. Otherwise if you want to display something HTML related, you'll need to use HTML.