ID:2235682
 
(See the best response by Lummox JR.)
Code
mob/player
proc
callbattleitems()
itemsinhud=list()
itemsnumber=0
src.itemsHUD.maptext="<b>Inventory: Battle</b><br><br>"
for(var/obj/items/i in src)
itemsnumber++
if(i.itemtype=="Battle")
if(itemsnumber > hudscrolled)
if(i.stackable==1)
src.itemsHUD.maptext+="<img src=[i.icon]> [i.suffix]x [i.name]<br><br>"
else
src.itemsHUD.maptext+=" [i.name]<br><br>"
src.itemsHUD.maptext_y-=30
itemsinhud+=i
if(itemsinhud.len > 10) break
if(itemsinhud.len < 12)
itemsHUD.maptext+="Return"
itemsHUD.maptext_y-=30
else itemsHUD.maptext_y-=14

Problem description:

So, this is more of a how-to kind of question. I am working with a lot of huds sporting maptext, so my items and skills are also in there. However I want to integrate icons in the maptext and I'm unsure how to do this. The idea is not to have to delete specific stuff separately from my maptext but rather make it change automatically with maptext.
I'm pretty sure maptext doesn't support images.
This is actually quite a surprise:

Well, after a lot of messing around to see if my tbs works right it actually did show the image, but only after it runs through the whole battle cycle of my tbs for some odd reasons. Also, it only stops at the first icon_state, which is odd.

Seems to work after the proc has been triggered a second time.
Maptext does support images, but not animated.
So, is there a way to include a specific icon_state of a .dmi file aswell, provided it's not animated?
In response to Lummox JR
Lummox JR wrote:
Maptext does support images, but not animated.

Wait, really? Huh... Never even thought to try that.

In response to Kayren
Best response
Kayren wrote:
So, is there a way to include a specific icon_state of a .dmi file aswell, provided it's not animated?

The <img> tag in maptext should support the "iconstate" attribute just as it does in regular output controls.
In response to Lummox JR
Lummox JR wrote:
Maptext does support images, but not animated.

wtf
I'm shocked as well.
Tis how I display the player icons on the character loading interface of Eternia. Unfortunately it still doesn't allow for clicking the maptext, but that's pretty easy to solve with a dummy object as an overlay transformed to cover the entire area the maptext covers.
Thanks, Lummox! ^^

Nadrew wrote:
Tis how I display the player icons on the character loading interface of Eternia. Unfortunately it still doesn't allow for clicking the maptext, but that's pretty easy to solve with a dummy object as an overlay transformed to cover the entire area the maptext covers.

That's alright for me since I'm just trying to not call any unneeded objects where I only want a nice picture.


EDIT: Could it be that it is somewhat buggy when used in conjunction with text? It only shows up after the second time the proc is triggered and it also behaves weirdly; like eliminating any text that comes after.
In response to Flick
Flick wrote:
Lummox JR wrote:
Maptext does support images, but not animated.

Wait, really? Huh... Never even thought to try that.


Lummox told me this a long time ago in a PM. The fact that maptext capabilities aren't extensively documented is a bit annoying.

Also, in trying to teach the ui's built-in CSS support to a number, I've frequently made the comment to myself that I'm a lazy piece of shit for not putting it all down in a Snippet Sunday.