ID:140374
 
Code:
for(M in world)
//SEARCH PLAYERS IN WORLD
var/Mname = lowertext(M.name)
var/pn = lowertext(pname)
if(Mname == pn)
//IF PLAYER FOUND
pname = M.name
var/foundS = 1//VARS FOR THE NEXT FOR LOOPS
var/foundM = 1
for(var/p in src.panes)//CHECK THROUGH THE 'PANES' LIST
if(p == "whisperpane[M]")
foundS = 1
break
else
foundS = 0
continue

if(!foundS)//IF THE WISPERPANE OF THE TARGET PLAYER TO SEND A WHISPER TO DOESN'T HAVE AN EXISTING TAB
//CREATE ONE:
winclone(src,"whisperpane","whisperpane[M]")//CLONE A BLANK TAB
winset(src,"whisperpane[M]","title=[M]") //CREATE A WHISPER TAB WITH NAME OF PLAYER YOU ARE WHISPERING TO..
src.panes += "whisperpane[M]"//ADD THE TAB TO 'PANES' LIST

for(var/P in M.panes)//DO SAME BUT FOR THE PLAYER RECIEVEING THE WHISPER
//CHECK THE RECIEVING PLAYERS LIST
if(P == "whisperpane[src]")
foundM = 1
break
else
foundM = 0
continue
//SAME AGAIN IF THERE'S NO EXISTING TAB... CREATE ONE:

if(!foundM)
//HERE'S THE ERROR: (WINCLONE(M,...BLAHH
winclone(M,"whisperpane","whisperpane[src]")
winset(M,"whisperpane[src]","title=[src]") //CREATE A WHISPER TAB WITH NAME OF PLAYER YOU ARE WHISPERING TO..
M.panes += "whisperpane[src]"


Problem description:
So basically as described in the code, this is a system I'm trying to create of PMs or whispers in a seperate tab control, when the verb is used to send a message to the player (M), it either creates a new tab or writes to the existing tab... however when I run this in my game I get a runtime error that M is a bad client?

I am hosting the game on my computer and I am playing both the characters who are whispering to eachother.

Anyone have any ideas?

Thanks, Farkas

Okay I've modified the code to get no runtime errors but I find that winset() doesn't like to work for anything other than the player calling it!

new_tab(mob/M)//M being the player being whispered to
//src being the player who is sending the whisper...
winclone(src,"whisperpane","whisperpane[M]")
world << "src=[src],M=[M]"
winset(src,"whisperpane[M]","title=[M]") //CREATE A WHISPER TAB WITH NAME OF PLAYER YOU ARE WHISPERING TO..
world << "rename"//testing
src.panes += "whisperpane[M]"
for(var/l in M.panes)
world << "[l]"
tab_update(M)
//now tab_update:
tab_update(M as mob) //PROC TO UPDATE TABS (REMOVE OR ADD)//M being the player recieving the whisper like in the above proc
var string1 = ""
for(var/x in panes)
string1 += "[x],"
world << string1//testing
winset(M,"tab1","tabs=[string1]")


So all my little testing strings are saying exactly what they're supposed to be saying, the problem being is that a new tab isn't being created in 'M's interface!

Anyone have a clue as to why?

Thanks, Farkas
Okay so noone knows why winset() doesn't work for anyone but the player who calls it? Is that just way it is? I'm sure it's not?!
In response to Farkas
Because you aren't creating one for M.
In response to Ulterior Motives
Thankyou! ^_^
In response to Farkas
Your problem isn't in winset().

In new_tab() (not a good name BTW for a proc intended only for a whisper) you're creating a tab only for the person sending the whisper, not for the person receiving. M.panes is never updated. So when you call tab_update(), nothing happens. Incidentally tab_update() should also be changed; src should be the mob receiving the update, and the M argument is not needed.

Lummox JR