As I’m sure you’ve already seen in mineos.js, MineOS uses pretty much the same arguments you’re trying in your test (or you used this as your reference).
However, it’s to be expected that when you add backslashes that things will not execute as expected if you don’t properly indicate where you want a backslash. A \
is a special character, known as an escape character, and to ensure that the command actually gets executed, mineos.js
appends \012
, which is the \n
newline character.
Any \
's you add would then tell screen to parse the next few characters differently, which isn’t likely what you’re expecting.
So for example:
screen -S mc-ff -p 0 -X eval 'stuff "say whitespace works!\012"'
nodejs mineos_console.js -s ff stuff 'say whitespace works!!'
produces:
[21:52:46] [Server thread/INFO]: [Server] whitespace works!
[21:52:56] [Server thread/INFO]: [Server] whitespace works!!
And further:
screen -S mc-ff -p 0 -X eval 'stuff "say backslashes work (\\)\012"'
nodejs mineos_console.js -s ff stuff 'say \\ these work!!'
produces:
[21:54:02] [Server thread/INFO]: [Server] backslashes work (\)
[21:54:28] [Server thread/INFO]: [Server] \ these work!!
So we do know that whitespace should work just fine, and backslashes should as well, provided you do the complete escape sequence.
Unfortunately, I don’t have a Minecraft client with me (here at work), so I can’t log in as myself to tellraw myself, but it looks like you likely just need to escape your double quotes like this: \""
, because your actual quotes are prematurely ending the ‘stuff’ command.
screen -S mc-ff -p 0 -X eval 'stuff "say backslashes \""work\""\012"'
[22:01:13] [Server thread/INFO]: [Server] backslashes "work"
That said, it might take a bit to find out why escaping works so peculiarly with mineos_console.js
, since the escape sequences have to go through so many translations. Not sure where the issue lies, because double quote is \042
, but here’s the underlying behavior:
nodejs mineos_console.js -s ff stuff 'say 041 attempt: \041'
nodejs mineos_console.js -s ff stuff 'say 042 attempt: \042'
nodejs mineos_console.js -s ff stuff 'say 043 attempt: \043'
produces:
[22:10:44] [Server thread/INFO]: [Server] 041 attempt: !
[22:10:52] [Server thread/INFO]: [Server] 043 attempt: #
No idea why \042
is treated specially, but it is, and I’m not deliberately pruning it out. In fact, it just doesn’t work with screen
. It looks like it’s a parsing issue with bash/screen.
mc@mineos games/minecraft$ screen -S mc-ff -p 0 -X eval 'stuff "say this works \012"'
mc@mineos games/minecraft$ screen -S mc-ff -p 0 -X eval 'stuff "say this doesnt \042 \012"'
SO THE ACTUAL ANSWER IS: We need to escape the backslash, so that the quote can pass normally:
nodejs mineos_console.js -s ff stuff 'say 042 attempt: \\"yup\\"'
[22:33:14] [Server thread/INFO]: [Server] 042 attempt: "yup"