ID:2399725
 
Code:
        statpanel("Duels")

if(statpanel("Duels"))

var/duels = 0

var/list/d_stat_list = list()

for(var/client/D) if(D.mob) if(D.mob.isduel)
var/TO_Format = "OCG"
if(D.mob.C_Format) TO_Format = "TCG"
if(D.mob.C_Format == 3) TO_Format = "RANDOM"

var/obj/duel_obj/O = new()
O.d_mob = D.mob

if(D.mob.Opponents.len)
O.icon = 'd_stats.dmi'
if(D.mob.rated)
O.name = {"<font color=#ff0000>"}
O.icon_state = "rank"
else
O.name = {"<font color=#b54d4d>"}
O.icon_state = "full"
var/dup_check = 0
for(var/obj/OO in d_stat_list)
if(findtext(OO.name,D.mob.name))
dup_check = 1

if(!dup_check)
O.name += {"<b>[D.mob.name]</b>"}

if(D.mob.Partners.len) for(var/X in D.mob.Partners)
var/mob/M = D.mob.Partners[X]
if(!findtext(O.name,M.name))
O.name += {" and <b>[M.name]</b>"}

for(var/XX in D.mob.Opponents)
var/mob/M = D.mob.Opponents[XX]
if(!findtext(O.name,M.name))
O.name += {" -VS- <b>[M.name]</b>"}

if(M.Partners.len) for(var/X in M.Partners)
var/mob/MP = M.Partners[X]
if(!findtext(O.name,MP.name))
O.name += {" and <b>[MP.name]</b>"}
O.name += {"</font>"}

O.spectate = 1
d_stat_list += O

else
O.name = "<font color=#6bb54d><b>[D.mob.name] ([TO_Format]) - ([D.mob.x], [D.mob.y], [get_level(D.mob.x,D.mob.y,D.mob.z)])</b></font>"
O.icon = D.mob.cicon
O.icon_state = D.mob.icon_state
O.dir = SOUTH

d_stat_list += O

duels++
if(!duels)
stat("<font color=#F59A2F><b>No Players Dueling</b></font>","[FindPlayersNum()] Online")
else
for(var/O in d_stat_list)
if(d_stat_list.len > 1)
if(O != d_stat_list[1])
stat("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")

stat(O)


Problem description:

The code above is for one of my stat panels. It creates a list of all active matches in the game between players. It also filters out duplicate matches so that if Player A and Player B are both playing against each other, i won't get a PLAYER A -VS- PLAYER B line and then a PLAYER B -VS- PLAYER A line.

It's a list of objects with a Click() proc on them. If a player's match is active, then clicking on the match on the statpanel will allow you to spectate that match. If the player doesn't have an opponent yet, clicking on the match will let you teleport to them.

Everything is displaying how I want it to display, however I'm noticing 2 issues with my statpanel here.

One is that occasionally, when you click on one of the lines in the panel, it will act like you clicked on the line below it instead, it's not a simple misclick issue, multiple players have reported it. I've noticed similar issues with clicking on things in byond as well. If you output multiple images in a chat output with links attached to them, clicking on an image will sometimes open the link of the image next to it instead.

The other issue I've noticed is that when you mouse over one of these lines, it will only stay highlighted for a few moments, and then it will "unhighlight" like you moved your mouse off of it, and if you try to click at that point, it won't work anymore and you have to move your mouse off and back on. I think it's when the statpanel updates that it happens because the time the mouseover lasts for is inconsistent.

Does anyone have any idea how to fix either of these problems?