ID:261571
 
I was wondering if there is a way to make a message that is only sent to a GM or Host.. thx
mob/verb/MessageHost(T as text)
for(var/mob/M in world)
if(!M.client.address)// The host never has an address var
usr << "You told [M]: [T]"
M << "HostMessage from [usr]: [T]"
else
continue//continue looping
In response to Nadrew
umm thx but im gettin an error maybe you can help out?


runtime error: Cannot read null.address
proc name: MessageHost (/mob/verb/MessageHost)
usr: \[Master GM] Shy_guy197 (/mob/NormalLink)
src: \[Master GM] Shy_guy197 (/mob/NormalLink)
call stack:
\[Master GM] Shy_guy197 (/mob/NormalLink): MessageHost("jjjhjh")

or maybe im just sending it to myself is a prob?
In response to Shy_guy197
Have you tried testing it with someone else? It's been ages since I've used the address var, let me run some tests.
In response to Nadrew
yeah i tested says still the same thing...
In response to Shy_guy197
This works in tests:

mob
verb
MessageHost(T as text)
for(var/mob/M in world)
if(M.client.address)
continue
else if(!M.client.address || M.client.address == world.address)
M << "Message to host from [usr]: [T]"
usr << "Messaged host: [T]"
In response to Nadrew
im still gettin an error...

runtime error: Cannot read null.address
proc name: MessageHost (/mob/verb/MessageHost)
usr: \[Master GM] Shy_guy197 (/mob/NormalLink)
src: \[Master GM] Shy_guy197 (/mob/NormalLink)
call stack:
\[Master GM] Shy_guy197 (/mob/NormalLink): MessageHost("gtgg")


and this is when another player sends me a message
runtime error: Cannot read null.address
proc name: MessageHost (/mob/verb/MessageHost)
usr: Zaltron (/mob/NormalLink)
src: Zaltron (/mob/NormalLink)
call stack:
Zaltron (/mob/NormalLink): MessageHost("yes")
In response to Shy_guy197
What is the exact code you're using? My tests worked 100%.
In response to Shy_guy197
Maybe if you are on a networked computer? Are you? Just thinking why it dont work.
In response to Nadrew
umm i dont know exactly what you mean but its what you just gave me...

mob
verb
MessageHost(T as text)
for(var/mob/M in world)
if(M.client.address)
continue
else if(!M.client.address || M.client.address == world.address)
M << "Message to host from [usr]: [T]"
usr << "Messaged host: [T]"

In response to Shy_guy197
Shy_guy197 wrote:
umm i dont know exactly what you mean but its what you just gave me...
> mob
> verb
> MessageHost(T as text)
> for(var/mob/M in world)
> if(M.client.address)
> continue
> else if(!M.client.address || M.client.address == world.address)
> M << "Message to host from [usr]: [T]"
> usr << "Messaged host: [T]"
>



Your indentation is messed up, move the if() and else if() over one tab to the right, and everything under them, too.



In response to Nadrew
mob
verb
MessageHost(T as text)
for(var/mob/M in world)
if(M.client.address)
continue
else if(!M.client.address || M.client.address == world.address)
M << "Message to host from [usr]: [T]"
usr << "Messaged host: [T]"



still got an error and the same one
In response to Shy_guy197
All I can think of is that it's a problem with your computer or the way you're hosting.
In response to Nadrew
is there ne thing also like another .address you use?
to identify yourself? or where did you get the verb for it in one of the demos? or something?
In response to Shy_guy197
I don't really use demos, it was a code I typed up in 5 seconds, and it works fine on my system, I had my sister connect from her computer 300 miles away and it worked, I had my cousin connect, and it still worked.
In response to Nadrew
well im not sayin its wrong.. yeah theres something wrong with the way in hosting because my other game worked with the code... ummmmmmmmmmmm
In response to Shy_guy197
It must be a conflict with your current code setup, I'm not really willing to read more than 40 lines of code on the forum so posting the whole code really wouldn't help.
In response to Nadrew
well i tested it on my game without a map works fine... i added a map it doesnt work get an error..... the same error
In response to Shy_guy197
I added a map to mine, and I get the error, this is very weird, it might be a bug, but I doubt it.
In response to Nadrew
NPCs?
Page: 1 2