Jump to content

Recommended Posts

Before the migration to make everyone host dedicated servers, I used to be able to use print() to recieve data from the server when I hosted using the client.  Now hosting using the client will only allow remote access, and print no longer works, I used to gather information about the mod's I'm working on by doing this and now I feel a little lost as to how I can gather information easily from the client.

 

Is there a different command I can use now to get data remotely?

 

Edit: Well this is embarrassing, the entire time I never realized that all I had to do was stop testing on a sharded server, by launching the map as overworld OR caves ONLY, I could get back the client/server merge that I was used too.  I was just too damn stupid to think (Let me try testing mods without a shard)

Edited by Zackreaver

You can read the prints in the server's log (search for "server_log.txt" under your Documents\Klei folder).

Although,

On 11/21/2016 at 11:10 PM, Zackreaver said:

Before the migration to make everyone host dedicated servers, I used to be able to use print() to recieve data from the server when I hosted using the client.  

That doesn't sound quite right. Yes, that happens when you host a world with caves, but only then. A world without hosted from in-game is still a "combined server and client", and you are able to see printed output from it in both the console and the "client_log.txt" file. So it could be convenient to test your mod under a caveless server most of the time, and occasionally test it with caves, as well as when it is near-finished.

 

Or, you could do what CarlZalph said. Wrap it in a function so that it's easier to type:

local function pchat(msg,allshards) --short for printchat
	return GLOBAL.TheNet:SystemMessage(msg,allshards or false)
end

--usage:
pchat("my message")

 

I guess you could even automatically convert all uses of print() in your modmain.lua to chat output by putting this at the top of the file, if you wanted:

local function print(...) --remove "local" to affect other files that are modimport()ed, too.
	local msg, argnum = "", GLOBAL.select("#",...)
	for i = 1, argnum do
		local v = GLOBAL.select(i,...)
		msg = msg .. tostring(v) .. ( (i < argnum) and "\t" or "" )
	end
	return GLOBAL.TheNet:SystemMessage(msg,true)
end

 

Edited by blubuild

Oh unsharded servers still do that?  Well there's my problem right there, I never bothered to check.

 

I've been so used to hosting dedicated servers and doing servers with caves that I never realized the client and server merged if there wasn't a shard.  Well now I feel embarrassed.

Edited by Zackreaver

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...