Page 1 of 1

[0.15.35] - Output from custom commands RCON

Posted: Tue Oct 10, 2017 1:57 pm
by badgamernl
Hello,

The output (just the output) from a custom command added by scenario is not being outputted to RCON.

Normal commands like "/p" output work fine.

The documentation is not really clear on how to do it and if it is possible...

but I tried returning in the function and printing to the player but it all doesn't seem to work.

FYI I am talking about this: http://lua-api.factorio.com/latest/LuaC ... essor.html

Re: [0.15.35] - Output from custom commands RCON

Posted: Tue Oct 10, 2017 6:33 pm
by Rseding91
Thanks for the report. That's however working as intended: the lua commands are not part of the RCON interface and as such have no concept of RCON or where they're called from.

For example: in the Lua command it calls "player.print(...)" which is sent to the player - the game isn't going to also send that to RCON.

Re: [0.15.35] - Output from custom commands RCON

Posted: Tue Oct 10, 2017 9:23 pm
by badgamernl
Rseding91 wrote:Thanks for the report. That's however working as intended: the lua commands are not part of the RCON interface and as such have no concept of RCON or where they're called from.

For example: in the Lua command it calls "player.print(...)" which is sent to the player - the game isn't going to also send that to RCON.
Then the command system should be redone then because to just output back the returned String or another workaround... because it's getting pretty frustrating...

i had a pm conversation with you a long time ago:
badgamernl wrote:Hello Rseding91,

Thank you for the tip yesterday on the bug topic, i think its fixed now but well see once i get a load of players at once.

I have one question, is there a way to get data into the game. i know HTTP requests aren't a thing but is there any other way to do it? If not is it in any way a thing you developers are interested in?

It would help us server owners allot, because i have got no way to get data in the game i cant put the hours players have spend back into the server(i got a anti deconstruction that is based on if a player has more than 3 hours).

Kind regards,

badgamernl
Rseding91 wrote:We were talking about a possible "read_file" method that would take a file name and identifying string and fire an event at some point in the future with the file contents.

Right now there's only the rcon interface when you're running a server.
badgamernl wrote:The problem with RCON is that it also disables achievements. Also is there a hidden option to turn of auto admin first player?
We found a way that doesn't disable achievements and it's still not working how it's supposed to. ( even if you say RCON is supposed to work like that it really shouldn't ) :cry:

!RANT
Sometimes I think you guys don't take non-game breaking bugs serious like a "bug" I have posted:
viewtopic.php?f=23&t=50354 ( I may have rage quit life for a second after reading the last reply )

It should be not even a day work and would make the headless look more polished.

And I am not even talking about the long-lasting bug:
The first player that plays on a headless generated map get auto-promoted to admin when not even on the admin list!

Well, I hope you guys take the rant/feedback whatever you want to call it serious and don't just leave it like some of my posts.

Have a nice day and MAKE FACTORIO GREAT AGAIN!

Re: [0.15.35] - Output from custom commands RCON

Posted: Tue Oct 10, 2017 10:27 pm
by Rseding91
badgamernl wrote:
Rseding91 wrote:Thanks for the report. That's however working as intended: the lua commands are not part of the RCON interface and as such have no concept of RCON or where they're called from.

For example: in the Lua command it calls "player.print(...)" which is sent to the player - the game isn't going to also send that to RCON.
Then the command system should be redone then because to just output back the returned String or another workaround... because it's getting pretty frustrating...
It's not a matter of redoing anything: it's a fundamental part of how game logic works: you're telling the game to execute a Lua command and it does so. The Lua command doesn't know who executed it - it's simply going to run and do what it was programmed to do. A lua command has no "output" - it could do nothing or it could create 10,000 files - the RCON interface simply tells the game to execute the command and that's what happens.

Re: [0.15.35] - Output from custom commands RCON

Posted: Thu Oct 12, 2017 7:27 am
by badgamernl
I'll just go back to parsing an inconsistent log :cry:

Re: [0.15.35] - Output from custom commands RCON

Posted: Thu Oct 26, 2017 7:08 pm
by Kovus
Rseding91 wrote: It's not a matter of redoing anything: it's a fundamental part of how game logic works: you're telling the game to execute a Lua command and it does so. The Lua command doesn't know who executed it - it's simply going to run and do what it was programmed to do. A lua command has no "output" - it could do nothing or it could create 10,000 files - the RCON interface simply tells the game to execute the command and that's what happens.
Would it be possible in the future to add the aforementioned functionality, so that we could create commands which work in similar fashion to the way the built-in commands work? I too would like to be able to run custom commands via rcon and get results returned to the rcon caller; similar to the way I see built-in commands like /players, /admins, and /bans operate.

Re: [0.15.35] - Output from custom commands RCON

Posted: Sat Mar 10, 2018 7:21 am
by riot2212
Rseding91 wrote:
badgamernl wrote:
Rseding91 wrote:Thanks for the report. That's however working as intended: the lua commands are not part of the RCON interface and as such have no concept of RCON or where they're called from.

For example: in the Lua command it calls "player.print(...)" which is sent to the player - the game isn't going to also send that to RCON.
Then the command system should be redone then because to just output back the returned String or another workaround... because it's getting pretty frustrating...
It's not a matter of redoing anything: it's a fundamental part of how game logic works: you're telling the game to execute a Lua command and it does so. The Lua command doesn't know who executed it - it's simply going to run and do what it was programmed to do. A lua command has no "output" - it could do nothing or it could create 10,000 files - the RCON interface simply tells the game to execute the command and that's what happens.
It would be nice to have a method to do this, and as a programmer I know its not that hard (determining how the game is coded) and certainly not impossible to do, so please don't push that bs on me. the lua command KNOW who sent it when in game, normal commands KNOW where it came from, OTHERWISE it would NOT reply to rcon when you do /time or /players, so in turn the lua commands could have another piece of code added for printing to rcon, that only works when rcon is detected, should not be difficult to do since the underlining code is already there.

but here is the REAL issue I see here, its a matter of a player who is requesting a feature that would NOT be hard to do, but to me it seems like you are making excuses, saying "thats how its suppose to work because it doesn't know that it came from rcon" or "rcon works that way, you send it commands and it does what you send it", what happen to the day that developers actually game a damn? Don't get me wrong, the game is great, I am a very big fan, and that is why I am running a server. I know its an alpha game, and it will get better, but it seems all the developers now a days only care about themselves or their bottom line. Maybe I am mistaken, but when all I see from most of the developers lately is excuses, its pretty sad. Its not just games, its all over, I stopped supporting invision power board, I wont purchase a new license anymore from them, because of 1 simple thing, a developer plain out being disrespectful to a CUSTOMER about a feature they removed that pissed a HUGE amount of their customer's off, and it was because the developers did not see a point in the feature anymore, but 100s of customers were using it, upgraded and got screwed over. Now I know that is not the situation here, but my point still stands, an hour or 2 of your time could fix this simple request, but instead you are disregarding it because "that is how it is suppose to work", excuse my language here, but that is pure bullshit. Such a setup would be a huge benefit to anyone with custom mods or custom code on their server that use rcon.

Let me explain a simple situation that I encounter that would make this request a good one in my eyes. right now I using the command.lua in the save file so that I don't have to force players to download a mod, especially since there is no way for the players to know what mod needs to be downloaded unless they know the server and are in the server's discord, or on the server's website. Can't forget the fact that my code is custom, its not a mod that is on a website, its all custom. The command is quite simple, take the stats using

Code: Select all

table.tostring(game.forces['player'].item_production_statistics.input_counts)
(and the other stats)

and save them to files server side only, this allows me to using a script to download it via ftp and parse it, the script takes some time to do the handshake, connect and download it via ftp. however when I parse it, its fast, I then can save the stats to a database and then my players can use my discord bot to get the stats or see it online. Now with a way to run commands via rcon I could skip the whole script downloading the files, save on resources, and do live stats since rcon is quick and painless for my other scripts to access with less performance hits then the way I am doing now.

Now as it seems the original poster has a different plan, another situation in which it would help. Sadly what I am seeing is excuses and total disregard to what the original poster is asking about, quite sad really. If I was in that situation as a developer, I would take it as a challenge, look at the code and figure it out, since it wouldn't just benefit 1 or 2 server admins, it would benefit any of them that do custom mods or code. However, it seems in your eyes, my views as well as the original poster are not of your concern, guess making money does that to developers. An indie developer just starting out would of looked at this as a challenge or a benefit to help players out, but like you, most established developers shrug it off or make excuses.

Well mark that is another situation the factorio developers losing my respect.

I thank you for reading this, because I know that your schedule is busy, and because even if I do have less respect for you, I still respect this game you have made, regardless of the little things like this.

Re: [0.15.35] - Output from custom commands RCON

Posted: Sat Mar 10, 2018 4:46 pm
by Rseding91
That's a wall of text ...
... an hour or 2 of your time could fix this simple request ...
What are you actually asking for? Because like the original "report" there's nothing I can see to fix. player.print(...) will go to the player, What's to fix about that?

Did you want rcon.print(...)? Because I could add that but mod API requests typically go in: viewforum.php?f=28

Re: [0.15.35] - Output from custom commands RCON

Posted: Sat Mar 10, 2018 5:27 pm
by riot2212
Rseding91 wrote:That's a wall of text ...
... an hour or 2 of your time could fix this simple request ...
What are you actually asking for? Because like the original "report" there's nothing I can see to fix. player.print(...) will go to the player, What's to fix about that?

Did you want rcon.print(...)? Because I could add that but mod API requests typically go in: viewforum.php?f=28
well that seemed a little side-stepped, could of told the original poster the same thing, because I am sure that is what he would of like as well is a way to print to rcon, I will do the mod request.

Re: [0.15.35] - Output from custom commands RCON

Posted: Wed Jun 24, 2020 2:32 am
by movax20h
Is there any recommended solution for this problem?

I want to be able to run a `/silent-command`, and return some value (a string, i.e. using game.table_to_json), back to the RCON client.

Only few RCON commands do return back that to the RCON client. like `/help` or `/players`. But not much more in general.

Ability to built an RCON response using `rcon.print`, or taking a return value of the command and returning it back (if it is a simple string or number), would be reasonably easy to handle I guess?

Right now the only option is to call RCON command, then parse a log file. Which is a PITA (and for some reasons I am getting multiple responses in the log, maybe related to number of connected players).

Re: [0.15.35] - Output from custom commands RCON

Posted: Wed Jun 24, 2020 5:17 am
by boskid
movax20h wrote: Wed Jun 24, 2020 2:32 am Is there any recommended solution for this problem?

I want to be able to run a `/silent-command`, and return some value (a string, i.e. using game.table_to_json), back to the RCON client.

Only few RCON commands do return back that to the RCON client. like `/help` or `/players`. But not much more in general.

Ability to built an RCON response using `rcon.print`, or taking a return value of the command and returning it back (if it is a simple string or number), would be reasonably easy to handle I guess?

Right now the only option is to call RCON command, then parse a log file. Which is a PITA (and for some reasons I am getting multiple responses in the log, maybe related to number of connected players).
What? why parsing log file?

In 0.16.29 (>2y ago) there was LuaRCON (rcon) added that supports print, isn't it what you are asking for? Release happened liteally 2 days after post before yours.

Re: [0.15.35] - Output from custom commands RCON

Posted: Thu Jun 25, 2020 1:04 am
by movax20h
boskid wrote: Wed Jun 24, 2020 5:17 am
movax20h wrote: Wed Jun 24, 2020 2:32 am Is there any recommended solution for this problem?

I want to be able to run a `/silent-command`, and return some value (a string, i.e. using game.table_to_json), back to the RCON client.

Only few RCON commands do return back that to the RCON client. like `/help` or `/players`. But not much more in general.

Ability to built an RCON response using `rcon.print`, or taking a return value of the command and returning it back (if it is a simple string or number), would be reasonably easy to handle I guess?

Right now the only option is to call RCON command, then parse a log file. Which is a PITA (and for some reasons I am getting multiple responses in the log, maybe related to number of connected players).
What? why parsing log file?

In 0.16.29 (>2y ago) there was LuaRCON (rcon) added that supports print, isn't it what you are asking for? Release happened liteally 2 days after post before yours.
I was not aware of that by reading this thread.

I just discovered LuaRCON, and that it can be accessed i.e. using `rcon.print`. I just tested it, and it works, and solves the problem! Awesome.