Request: CURRENT_ROOM constant in console
-
When I'm working in the console, which is often, as a new player, I find it extremely tedious to have to type E78N48 all of the time, especially when I'm in a nearby room whose name I don't really know.
I am _frequently_ having to look up what room I'm in and type it out. This is particularly bad when I'm using the game client rather than a web browser. In the web browser the address bar makes it easy to see the room, but in the game client I must ensure to scroll up to the top of the right scroll area so I can see the room title. Super annoying.
An easy fix for this would be a new constant available when in console mode, something like CURRENT_ROOM or maybe just CURRENT.
Example usage:
JSON.stringify(Game.rooms[CURRENT].memory.something)
Or maybe:
Memory.rooms[CURRENT].something = true
Or even
require('utils').doSomething(Game.rooms[CURRENT])
This would make the console far more useful for new players like myself that are trying to inspect quick data or make config changes to a room.
I'm open to suggestions for improvement.
Thanks for your consideration.
-
The problem is the server won't know your current room. You could have server tabs open with different rooms.. then you would have serveral current rooms.
I have created a debug flag for this purpose I have named "r" and added property to `global` to access the flag. Now I can do stuff like `r.room.doSomething()`
-
The server has no idea, correct. But the console does - it is displayed from a web client which does know exactly what room I'm currently looking at.
The console itself would have to implement this feature, not the server.
-
The console does not run your code, the server does.
-
Yes, I understand that.
I'm just asking for the console to not be so simple, and instead of passing my command thru verbatim, do a little pre-processing on it. Recognize that I want to refer to the current room, which the console knows and the server doesn't, and convert it before sending to the server.
It would be like a client-side macro or something.
-
If I'm not mistaken then the console module of Screeps-SC supports this: https://github.com/stybbe/Screeps-SC
-
How would this work if someone had two browsers open in different rooms?
-
Multiple browsers with attached consoles: `CURRENT_ROOM` in window A would be room A, in window B would be room B. Should be very easy for the console to sniff the URL to see what the current page is but I suspect it's even easier than URL sniffing.
In a popout console, I'm not sure it would be able to deduce which room you meant, and so the console should probably throw an exception if you use the macro in that context.
Just a thought.
-
Or is there a way to get the url(s) directly to manage it in the own scripts?
Preferably without the plugin because I am not a huge fan of Crome.