Search found 8 matches

by Northsoft
Sat Jun 12, 2021 6:56 am
Forum: Modding help
Topic: Print to server console only
Replies: 7
Views: 3581

Re: Print to server console only

script.on_event(defines.events.on_console_chat,function(ev)
if #game.connected_players == 0 then mystate='server'
end end)

function serverprint(text) if mystate=='server' then print (type(text)=='string' and text or serpent.line(text)) end
Looks like a duck tape, but as I can understand, this ...
by Northsoft
Fri Jun 11, 2021 9:44 am
Forum: Modding help
Topic: Print to server console only
Replies: 7
Views: 3581

Re: Print to server console only

Wouldn't "tail -f" do what you need?
`Tail -f`, and `watch` work in another console . Also, they don't work on Windows (yes, I am that crazy man who hosts Factorio server on dualboot system). That's why I ask a way to output something to server console .

Plain print() should do the job.
I know ...
by Northsoft
Fri Jun 11, 2021 5:15 am
Forum: Modding help
Topic: Print to server console only
Replies: 7
Views: 3581

Print to server console only

Hello, is there any way to print some message to server console only?
I understand that there is game.write_file which I already use, but I'd like to have a way to see messages immediately, without using period-based tools like watch.
by Northsoft
Sat Jun 05, 2021 12:36 pm
Forum: Modding help
Topic: Server-side only things
Replies: 4
Views: 1668

Re: Server-side only things

eradicator wrote: Sat Jun 05, 2021 9:18 amReal time? Nope. Game.tick time is the only thing mods are allowed to know. You'd have to run a script on the server (outside factorio) that re-processes the output in real time.
Thanks!
by Northsoft
Sat Jun 05, 2021 4:37 am
Forum: Modding help
Topic: Server-side only things
Replies: 4
Views: 1668

Re: Server-side only things

Thanks, is there a way to add a date and time to output string?
by Northsoft
Sat Jun 05, 2021 3:25 am
Forum: Modding help
Topic: Server-side only things
Replies: 4
Views: 1668

Server-side only things

Hello, is there any way to limit some code to server-side only execution?
Examples:
— make a record to some server-side log file, with date and time if possible;
— store an object with server-side only storage, with some internal scores which shouldn't be disclosed to another players.
by Northsoft
Tue Jun 01, 2021 1:20 pm
Forum: Modding help
Topic: Counter-griefing quadrant approach: what should I read?
Replies: 6
Views: 2347

Re: Counter-griefing quadrant approach: what should I read?

I assume you know https://lua-api.factorio.com/latest/
Thanks a lot for your answer, I will read that.

The main problem is that the modding api does not have any way to prevent or undo things. Realistically you have to deal with all events post-factum.
Well, there could be old “action–reaction ...
by Northsoft
Tue Jun 01, 2021 8:40 am
Forum: Modding help
Topic: Counter-griefing quadrant approach: what should I read?
Replies: 6
Views: 2347

Counter-griefing quadrant approach: what should I read?

Hello, I'm absolutely new in Lua and Factorio modding (but I'm familiar with C, C++, Java and JavaScript), and I want to host a server for 4 players and enforce rules below:
— all players have separate research progress, and because of this, belong to separate forces;
— despite that, players are not ...

Go to advanced search