ID:148685
 
I can't seem to get this to function properly:

obj/Say
icon = 'say.png'
layer = MOB_LAYER + 1//appears above mobs
Click()
var/T = input("Say what?")as null|text//Works as a say verb
if(!T)//If there's no text
return//Stops the proc
else
world << "[usr]: [T]"
New(client/C)
screen_loc = "1,10,1"
C.screen+=src


By "function properly", I mean it doesn't show up.
There is no Z coordinate in screen_loc.
In response to Skysaw
Doesn't work, still. This is the new code:

obj/Say
icon = 'say.png'
layer = MOB_LAYER + 1//appears above mobs
Click()
var/T = input("Say what?")as null|text//Works as a say verb
if(!T)//If there's no text
return//Stops the proc
else
world << "[usr]: [T]"
New(client/C)
screen_loc = "1,10"
C.screen+=src
In response to Drafonis
Is New getting called correctly, with the client argument?
Did you forget to call it like...
client/New()
..()
new/obj/Say(src)
In response to Drafonis
Drafonis wrote:
Doesn't work, still. This is the new code:

obj/Say
> icon = 'say.png'
> layer = MOB_LAYER + 1//appears above mobs
> Click()
> var/T = input("Say what?")as null|text//Works as a say verb
> if(!T)//If there's no text
> return//Stops the proc
> else
> world << "[usr]: [T]"
> New(client/C)
> screen_loc = "1,10"
> C.screen+=src


You have to make sure you have something like this in your code:

client
New()
..()
var/obj/Say = new(src)
In response to Skysaw
Still doesn't work.

obj/Say
icon = 'say.png'
layer = MOB_LAYER + 1//appears above mobs
Click()
var/T = input("Say what?")as null|text//Works as a say verb
if(!T)//If there's no text
return//Stops the proc
else
world << "[usr]: [T]"
client
New()
..()
var/obj/Say = new(src)
screen_loc = "1,10"
In response to Drafonis
This is what you want. You need to override New() for clients and the obj.
obj/Say
icon = 'say.png'
layer = MOB_LAYER + 1//appears above mobs
Click()
var/T = input("Say what?")as null|text//Works as a say verb
if(!T)//If there's no text
return//Stops the proc
else
world << "[usr]: [T]"

New(client/C)
..()
screen_loc = "1,10"
C.screen += src

client/New()
..()
new/obj/Say(src)
In response to Drafonis
Drafonis wrote:
Still doesn't work.
obj/Say
icon = 'say.png'
layer = MOB_LAYER + 1//appears above mobs
Click()
var/T = input("Say what?")as null|text//Works as a say verb
if(!T)//If there's no text
return//Stops the proc
else
world << "[usr]: [T]"
client
New()
..()
var/obj/Say = new(src)
screen_loc = "1,10"

Because you're still creating /obj/Say instead of an /obj/Say/client, the New() proc is now not being called at all.
What you should really do is make /obj/Say a subset of a special type for screen objects:
obj/screen
var/client/owner
layer=MOB_LAYER+1

New(client/C)
owner=C
if(C) C.screen+=src

Del()
if(owner) owner.screen-=src
..()

obj/screen/Say
icon='say.png'
screen_loc="1,10"

Click()
usr.Say()

mob
var/isadmin
var/ismute

verb/Say(msg as text)
if(!msg)
msg=input("What do you want to say?","Say") as null|text
if(!msg) return
if(!isadmin)
if(ismute || SpamCheck(msg)) return
// don't forget html_encode() no matter what else you do
// because people *will* abuse HTML if they can
world << "<B>[usr]:</B> [html_encode(msg)]"

Lummox JR
In response to Lummox JR
Erm, still doesn't work. I have to remove SpamCheck because I don't have it.

obj/screen
var/client/owner
layer=MOB_LAYER+1

New(client/C)
owner=C
if(C) C.screen+=src

Del()
if(owner) owner.screen-=src
..()

obj/screen/Say
icon='say.png'
screen_loc="1,10"

Click()
usr.Say()

mob
var/isadmin
var/ismute

verb/Say(msg as text)
if(!msg)
msg=input("What do you want to say?","Say") as null|text
if(!msg) return
if(!isadmin)
// don't forget html_encode() no matter what else you do
// because people *will* abuse HTML if they can
world << "<B>[usr]:</B> [html_encode(msg)]"
In response to tenkuu
Tenkuu's code worked.
In response to Drafonis
Drafonis wrote:
Tenkuu's code worked.

It was identical to mine. Why you wanted to indent the client.New() proc under your say object is beyond me.
In response to Skysaw
lmao. It was a mistake. I'm kinda new to HUD, so bear with me. (No, I do NOT mean put a bear in my computer!)