ID:264206
 
Code:
mob
verb
send(var/mob/M in world,var/txt as text)
M << output("[usr.name]: [html_encode(txt)]", "[usr].output")
winshow(M,"[usr]",1)
usr << output("[usr.name]: [html_encode(txt)]", "[M].output")
proc
Whisper(mob/M)
winclone(M,"window8","[usr]")
winclone(usr,"window8","[M]")
winset(usr, "[M].input", "command=\"send [M] \"")
winset(M, "[usr].input", "command=\"send [usr] \"")
winshow(usr,"[M]",1)


Problem description:

I'm not very good with the winset proc and for the lines marked 1 and 2, when you go To whisper to someone that uses a space in their name(ex Bob smith)it will give an error (Sorry, the following is not valid: Bob usage: send mob in world "text")
Is there a way around this? lol

Try putting the [M] and [usr] from those two lines in quotes as well.

winset(usr, "[M].input", "command=\"send \"[M]\" \"")
In response to Xooxer
Same problem, thanks for the help though. I don't get those /"///" things lol
In response to King killer 113711
Those slashes escape the quotes so they don't cause the text to end. That should have worked. I have a similar system in Chatters that does almost the same thing.

winset(C, "[winname].input", "command='IM \"[name]\" \"'")


I use single quotes around the command text, though. You could try that and see if it helps. Hrm, I also seem to have an extra escaped quote at the end. You might need that as well.
In response to Xooxer
Code:
This is the current code I'm using with Your help.
mob
verb
send(var/mob/M in world,var/txt as text)
set hidden = 1
for(var/obj/Mail/X in M.client.screen)
X.icon_state = "Hasmail"
M << output("[usr.name]: [html_encode(txt)]", "[usr].output")
winshow(M,"[usr]",1)
winshow(usr,"[M]",1)
usr << output("[usr.name]: [html_encode(txt)]", "[M].output")
proc
Whisper(mob/M)
winclone(M,"window8","[usr]")
winclone(usr,"window8","[M]")
winset(usr, "[M].input", "command='send \"[M]\" \"'")
winset(M, "[usr].input", "command='send \"[usr]\" \"'")
winshow(M,"[usr]",1)
winshow(usr,"[M]",1)


O.K. now I'm getting Sorry, the following is not valid: "King killer 113711"
usage: send mob in world "text" as the error instead of the previously posted one.
In response to King killer 113711
Oooh! You're sending a text string to the verb, not a mob. Your verb needs to expect the mob variable to be text. You'll need to re-locate the actual mob in the verb by matching it's name to the name given by the winset().
In response to Xooxer
Wait what? I'm sending the mob a text string...If I get what your saying lol.
In response to King killer 113711
Your verb is expecting a mob. Like: var/mob/M or whatever is in the () for your verb definition. But, the command for the input you just set with winset() is gving the verb a text string of the player's name, not their mob. Your verb needs changing. var/mob_name instead of var/mob/M. Then you need to find out which mob in the world is mob_name referring to. So, loop through all the mobs in the world and pick the one who's name matches the mob_name.
In response to Xooxer
mob
verb
send(var/ckeyx as text,var/txt as text)
set hidden = 1
for(var/mob/M in world)
if(M.ckey == ckeyx)
M << output("[usr.name]: [html_encode(txt)]", "[usr].output")
winshow(M,"[usr]",1)
winshow(usr,"[M]",1)
usr << output("[usr.name]: [html_encode(txt)]", "[M].output")


To send it

            winset(usr, "[M].input", "command=\"send [M.ckey] \"")
winset(M, "[usr].input", "command=\"send [usr.ckey] \"")


To set it.

EDIT: For some reason I had the feeling this would work, Apparently not...I'm stumped? XD

Sorry, the following is not valid: kingkiller113711
usage: send "text" "text"

EDIT #2: Tried another way to set it.
winset(usr, "[M].input", "command='send \"[M.ckey]\" \"'")
winset(M, "[usr].input", "command='send \"[usr.ckey]\" \"'")


Thanks for the help =p
In response to King killer 113711
That should do it. Also, you could mke finding mob by ckey a seprate proc, so you cn use it lter for other things.

proc/findmob(var/name)
for(var/mob/M in world)
if(M.ckey == ckey(name))
return M
mob
verb
send(var/ckeyx as text,var/txt as text)
set hidden = 1
var/mob/M = findmob(ckeyx)
if(M)
M << output("[usr.name]: [html_encode(txt)]", "[usr].output")
winshow(M,"[usr]",1)
winshow(usr,"[M]",1)
usr << output("[usr.name]: [html_encode(txt)]", "[M].output")


winset(usr, "[M].input", "command='send \"[M.name]\" \"'")

In response to Xooxer
Xooxer wrote:
That should do it. Also, you could mke finding mob by ckey a seprate proc, so you cn use it lter for other things.

Good call, though it should loop through clients instead for efficiency, unless you're sure you specifically want to get playerless mobs, which you probably don't.
Also, instead of the whole searching for name/key thing, he should really just use the \ref text macro and locate() - that's the way to go with passing object references through text, and since the reference is used immediately it's foolproof here (otherwise it could be unsafe to use an 'old' reference). Just like you do with Topic().