If i am not mistaken you are confused by the colors the print commands have. The color of someething you print is not defined by the enviorment you print it in(as far as i know). Also all this seems just fine for me. Maybe you can explain more clear what your problem is?
Also I am not sure if there is a Shared envioment in SF. I think there is just Server and Client
16-06-2015, 05:28 PM, (This post was last modified: 16-06-2015, 05:29 PM by shinji144.)
(16-06-2015, 04:54 PM)SuperPlayer Wrote: If i am not mistaken you are confused by the colors the print commands have. The color of someething you print is not defined by the enviorment you print it in(as far as i know). Also all this seems just fine for me. Maybe you can explain more clear what your problem is?
Also I am not sure if there is a Shared envioment in SF. I think there is just Server and Client
SF does have shared, that is the area after the directives and before the "if SERVER then". In gmod's lua, printing on client is yellow, whereas printing on server is blue. My question/problem is why does each print() print twice, once on server and client for both client and server environments- and why does the shared environment print twice.
As Divran mentioned to me, all my fuss is probably debug print. However, why does shared print twice (two sets of ones)
as shown
It prints "1" twice because the server runs, prints it, then a while later, your client receives the code and then runs the print again on the client. Client and server do not run at the same time at startup (or ever really). Bear in mind that the "shared" environment still exists in 2 places, it's not really an environment so much as you're just happy to have code run on both sides.
The reason for the double coloured print, is that the "print" is actually GLua's PlayerrintMessage( HUD_PRINTTALK, Message ). The blue is the chat being replicated to the console, the yellow is PrintMessage replicating its output to the console. I don't really see the point in making a special snowflake print function just to avoid that. If you really want a useful print, just use printConsole instead and avoid the chat version.
I was tempted to change print to be console based and deprecate printConsole, but people are pretty used to chat-based printing. Not sure if it would go down well.
16-06-2015, 06:01 PM, (This post was last modified: 16-06-2015, 06:04 PM by shinji144.)
Thanks for the thorough explanation, that cleared up everything.
(16-06-2015, 05:53 PM)Person8880 Wrote: I don't really see the point in making a special snowflake print function just to avoid that. If you really want a useful print, just use printConsole instead and avoid the chat version.
Fair enough. I'd actually forgotten about the printConsole command- I'll use that from now on.
(16-06-2015, 05:53 PM)Person8880 Wrote: I was tempted to change print to be console based and deprecate printConsole, but people are pretty used to chat-based printing. Not sure if it would go down well.