ID:1119323
 
Keywords: a, chat, href, message, pm, private, whisper
(See the best response by Super Saiyan X.)
Code:
mob
verb/Private()
set src = usr
var/list/Menu = list()
for(var/mob/T in world)if(T.name!=usr.name && T.client) Menu.Add(T)

var/M = input("Who would you wish to whisper to?","Whisper to whom?") in Menu + list("Cancel")
if(M == "Cancel")return

var/mob/recip = M
var/msg=input("What do you wish to whisper to [M]?")as text
if(!recip || !msg) return // do nothing

msg = html_encode(msg) // strip out HTML
recip << "<B>\[From <A HREF='?private&src=\ref[usr]'>[name]</A>\]</B> [msg]"
usr << "<B>\[To <A HREF='?private&src=\ref[recip]'>[recip]</A>\]</B> [msg]"

client/Topic(href, list/href_list, hsrc)
if("private" in href_list)
if(!hsrc) return

usr = mob
var/msg = input("Send private message to [hsrc]:", "Message") as null|text

if(msg) mob.Private(hsrc,msg)
return
..()


Problem description: My problem is that when a player clicks on the link to reply, it brings up three input boxes. The first input asks the recipient what they wish to respond to sender. Right after the first input box, the second input box brings up the list of online players and asks the recipient who they wish to respond to. finally, the third one asks the recipient what they want to say to person chosen from the list. I just want the first box input box to appear and thats it.

-Thanks in advance.

I think the problem is that under Private() your asking them to input who the recip is and a message. When you use the link to reply your basically inputting a message then it's being dropped due to the args not passing into Private(), then it asks you to put the new recip and message in and it sends that.

I'd do something like mob.Private(hsrc,msg,reply = 1) and have it pass to Private() as Private(recip,msg,reply). Then have and if() statement check if it's a reply, if it is send the message, else ask to input a recip and message.

Not sure if I explained that right, or if it's correct. That would be my work-around though. Hope it helps.
mob
verb/Private(var/mob/default_mob = null, var/default_message = null)
set src = usr

if(!default_mob || !default_message)

var/list/Menu = list()
for(var/mob/T in world)if(T.name!=usr.name && T.client) Menu.Add(T)

var/M = input("Who would you wish to whisper to?","Whisper to whom?") in Menu + list("Cancel")
if(M == "Cancel")return

var/mob/recip = M
var/msg=input("What do you wish to whisper to [M]?")as text
if(!recip || !msg) return // do nothing

msg = html_encode(msg) // strip out HTML
recip << "<B>\[From <A HREF='?private&src=\ref[usr]'>[name]</A>\]</B> [msg]"
usr << "<B>\[To <A HREF='?private&src=\ref[recip]'>[recip]</A>\]</B> [msg]"

else
default_message = html_encode(default_message) // strip out HTML
default_mob << "<B>\[From <A HREF='?private&src=\ref[usr]'>[name]</A>\]</B> [default_message]"
usr << "<B>\[To <A HREF='?private&src=\ref[default_mob]'>[default_mob]</A>\]</B> [default_message]"


client/Topic(href, list/href_list, hsrc)
if("private" in href_list)
if(!hsrc) return

usr = mob
var/msg = input("Send private message to [hsrc]:", "Message") as null|text

if(msg) mob.Private(hsrc,msg)
return
..()


The code is pretty horrible. However, I've fixed it up so that you're able to get the general idea. Unsure as to how arguments work with verbs.
Best response
If he wants to continue to build his own list, rather than use verb arguments, I believe the best method would be:

mob
verb/Private()
set src = usr
var/mob/recip
if(!args.len) //Check to see if something was passed to the procedure
var/list/Menu = list()
for(var/mob/T in world) if(T.name != usr.name && T.client) Menu.Add(T)
recip = input("Who would you wish to whisper to?","Whisper to whom?") as null|mob in Menu
else recip = args[1]
//If something IS passed, the first thing passed to the proc is the recip

if(!recip) return //If there is no recip, we can't continue.
var/msg = input("What do you wish to whisper to [recip]?") as text
if(!msg) return //No message, don't continue

msg = html_encode(msg)
recip << "<B>\[From <A HREF='?private&src=\ref[usr]'>[name]</A>\]</B> [msg]"
usr << "<B>\[To <A HREF='?private&src=\ref[recip]'>[recip]</A>\]</B> [msg]"

client/Topic(href, list/href_list, hsrc)
if("private" in href_list)
if(!hsrc) return
mob.Private(hsrc) //Just call the proc, with hrsc as the only argument.
//the proc already asks for the message, so
//no reason for repetitive code
return
..()


This way, the verb arguments remain empty. If the verb is clicked, the verb's args list is empty, and you are prompted for the person to whisper to, and the message.

But, if you invoke the proc, such as you do in client/Topic(), you can provide an argument, and then look up the arguments using the args list. The first (and only) thing in the args list would be accessed with args[1]. This method only asks for input once, from the message.

I believe this also cuts down on unnecessary repetitive code, such as having two separate prompts for message input in two separate locations.

Though, there might be better ways to do this. This is just if he doesn't want to overhaul his PM/whisper system.
I apologize for taking so long to respond. College is making it quite difficult to code. I'm pleased to say that it worked beautifully thank you Super Saiyan X. And thanks so much guy's you've been a great help.