proc
IM_Proc(mob/a,mob/b)
new/IM_Datum(a,b)
var
list
IMs = list()
mob
verb
privsay(msg as text)
var/IM_Datum/I = Find_IM()
if(!I) return
I.Message(src,msg)
closeim()
var/IM_Datum/I = Find_IM()
if(!I) return
I.Close_Window(src)
ignoreim()
var/IM_Datum/I = Find_IM()
if(!I) return
I.Exit_Chat(src)
proc
Find_IM()
var/IM_Datum/I
for(var/IM_Datum/i in IMs)
if(winget(src,"[i][i.ID].chatinput","focus=true"))
winset(src,"[i][i.ID].chatinput","background-color=60,60,60")
I = i
return I
var/IM_ID = 0
IM_Datum
var
ID
mob/a
mob/b
New(mob/m1,mob/m2)
for(var/IM_Datum/I in IMs)
if((I.a == m1 && I.b == m2) || (I.a == m2 && I.b == m1))
problemarising
world << "chat window already made for this conversation"
return
a = m1
b = m2
IMs += src
IM_ID ++
ID = IM_ID
world << "[ID]"
winclone(a,"chat","[src][ID]")
winshow(a,"[src][ID]",1)
winset(a,"[src][ID]","title=\"[a.key] - [b.key]")
proc
Generate_Window(mob/m)
if(!winexists(m,"[src][ID]"))
winclone(m,"chat","[src][ID]")
winshow(m,"[src][ID]",1)
winset(m,"[src][ID]","title=\"[a.key] - [b.key]")
else
winshow(m,"[src][ID]",1)
Message(user,msg)
Generate_Window(a)
Generate_Window(b)
a << output("[user]: [msg]","[src][ID].chatoutput")
b << output("[user]: [msg]","[src][ID].chatoutput")
Close_Window(mob/m)
if(m == a)
a = null
if(m == b)
b = null
if(!a && !b)
del src
Exit_Chat(mob/m)
if(m == a)
b << output("[a] has left the chat","[src][ID].chatoutput")
a = null
else
b = null
a << output("[b] has left the chat","[src][ID].chatoutput")
Close_Window()
Del()
if(a && a.client)
winset(a,"[src][ID]","parent=none")
if(b && b.client)
winset(b,"[src][ID]","parent=none")
IMs -= src
mob
Logout()
..()
if(client)
ignoreim()
Problem description:
I am trying to have it so a player can have more than one popup window to talk to multiple people at the same time. The problem I'm running into right now is, when I try to talk to more than one person, the first popup window only sends messages to the last popup window I created. It's quite confusing and I've tried using a global variable to differentiate between winclones. Can anyone spot the issue? This is a long one, so kudos to anyone who takes the time.