ID:169519
 
Is there a proc I can use to export the first state of a player's icon to a png or gif or something? I just need a way for their icon to show up in the browser window because dmi's don't work there =(
Cowdude wrote:
Is there a proc I can use to export the first state of a player's icon to a png or gif or something? I just need a way for their icon to show up in the browser window because dmi's don't work there =(

Yep, you'd use this:

player << browse_rsc(player.icon, "[key].png")


Lummox JR
Yes! You can use browse_rsc() to send a file to a player's cache, and the second argument specifies a file name to use. Knowing this, we can use the icon() proc to make an icon for just one state and send it to the cache to be used later. =)

mob/verb/show_me_myself()
src << browse_rsc( icon(icon, icon_state, dir) ,"myicon.png")
src << browse({"
<html>
<head>
<title>You!</title>
</head>
<body>
<h3 align='center'>This is you on
[world.name].</h3>
<img align='center' src='myicon.png' />
</body>
</html>"}
)
In response to YMIHere
In other words, they used to have theese on icon trading games, where the person would steal everyone's icons.
Try looking there. =P
In response to Flame Sage
Not really. This would be a completely ridiculous way to save an icon that someone uploaded to the game. Why would you want it in .png form anyway? =P
In response to Lummox JR
Okay this sorta worked; but after a while I decided I should probably fix it.

What that did is only export the first icon state; I need the one they're using =)
In response to Cowdude
Cowdude wrote:
Okay this sorta worked; but after a while I decided I should probably fix it.

What that did is only export the first icon state; I need the one they're using =)

Well then you probably shouldn't have asked for just the first one. To get just the state they're using, change player.icon in that code to new/icon(player.icon,player.icon_state).

Lummox JR
In response to Lummox JR
Lummox JR wrote:

Yep, you'd use this:

player << browse_rsc(player.icon, "[key].png")



Don't you think generating a new cache item for each key is a bit inefficent? It would be better to give it a filename based on the icon and icon_state.