Difference between revisions of "Private Server Common Tasks"

From Screeps Wiki
Jump to navigation Jump to search
(section remove invader cores)
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Private Server]]
+
[[Category:Private Server|Common Tasks]]
 
= Server CLI =
 
= Server CLI =
  +
  +
== Changing & Checking Tick-Rate ==
  +
In server CLI
  +
<code>system.setTickDuration(1000)</code>
  +
Will set the tick-duration to 1000 milliseconds per tick, default is 1000.
  +
<code>system.getTickDuration()</code>
  +
Will print the current tick duration.
  +
  +
== Pausing and Resuming ticks ==
  +
In server CLI
  +
<code>system.pauseSimulation()</code>
  +
Will pause the simulation ticking
  +
<code>system.resumeSimulation()</code>
  +
Will resume the server ticking
   
 
== Setting GCL ==
 
== Setting GCL ==
Line 16: Line 30:
 
In server CLI
 
In server CLI
 
<code>storage.db['users'].update({ username: 'username' },{ $set: { money: 2000000 }})</code>
 
<code>storage.db['users'].update({ username: 'username' },{ $set: { money: 2000000 }})</code>
  +
  +
== Setting Power ==
  +
<code>storage.db['users'].update({ username: 'username' },{ $set: { power: 540000 }})</code>
   
 
== Setting User CPU Limit ==
 
== Setting User CPU Limit ==
Line 21: Line 38:
 
In server CLI
 
In server CLI
 
<code>storage.db['users'].update({ username: 'username' },{ $set: { cpu: 500 }})</code>
 
<code>storage.db['users'].update({ username: 'username' },{ $set: { cpu: 500 }})</code>
  +
  +
== Adding a new room ==
  +
  +
In server CLI
  +
<code>map.generateRoom(roomName, options)</code>
  +
  +
for options use "help(map)" this will display the help data for map editing stuff
  +
  +
<code>map.generateRoom("W11N11", {sources: 13, controller: false})</code>
  +
The above code for example will generate a room with 13 sources & no controller.
  +
  +
== Opening / closing a room ==
  +
  +
In server CLI
  +
<code>map.openRoom("W5N1", [timestamp])</code>
  +
  +
timestamp is optional<br>
  +
e.g. on timestamp usage is to add: Date.now() + (300*1000)<br>
  +
This will mean that the room will open in 5 minutes.
  +
  +
<code>map.closeRoom("W5N1")</code>
   
 
== Adding NPC Terminals ==
 
== Adding NPC Terminals ==
Line 29: Line 67:
 
Repeat as many times as desired changing rooms (Use highway rooms or SK rooms)
 
Repeat as many times as desired changing rooms (Use highway rooms or SK rooms)
 
NPC orders should appear on the market automatically after a little while
 
NPC orders should appear on the market automatically after a little while
  +
  +
== Adding PowerBank ==
  +
  +
In server CLI
  +
<code>storage.db["rooms.objects"].insert({ room: "W4N10", type: "powerBank", x: 25, y: 25, store: {power: 4000}, hits: 10000, hitsMax: 10000, decayTime: 1000000 });</code>
   
 
== Manipulating Memory ==
 
== Manipulating Memory ==
Line 35: Line 78:
 
<code>storage.env.get(storage.env.keys.MEMORY + '41dbd8207f1bf62');</code>
 
<code>storage.env.get(storage.env.keys.MEMORY + '41dbd8207f1bf62');</code>
 
<code>storage.env.get('memory:41dbd8207f1bf62');</code>
 
<code>storage.env.get('memory:41dbd8207f1bf62');</code>
  +
  +
== Adding Portals ==
  +
  +
Although it isn't required, it is likely that you will want to run this command at least twice to create a portal in each direction.
  +
<code>storage.db["rooms.objects"].insert({ room: "W5N5", type: "portal", x: 25, y: 25, destination: { x: 25, y: 25, room: "E5N5" }, ticksToDecay: 100000 });</code>
  +
  +
== Complete All Construction sites ==
  +
  +
This fills up the progress of all construction sites. As soon as a creep does any construction on them, they'll be done.
  +
<code>storage.db['rooms.objects'].update({ type: 'constructionSite' },{ $set: { progress: 99999 }})</code>
  +
  +
== Add a Deposit ==
  +
Add a [https://docs.screeps.com/api/#Deposit Deposit] into a room, change the depositType to change type of the deposit.
  +
  +
<code>storage.db['rooms.objects'].insert({ type: 'deposit', room: 'W0N9', x: 16, y:26, depositType: 'mist' })</code>
  +
== Reset The Server Data ==
  +
Reset user data, rooms, GCL and PCL, server settings, etc.
  +
  +
<code>system.resetAllData()</code>
  +
== Disable Inactive Room Activity ==
  +
Sometimes a server has an issue where all rooms are set as active for the system to process, instead of only those with player objects in them. It's unknown why this happens, and can result in the server running very slowly for no good reason. setting it as inactive will resolve the issue.
  +
<nowiki>storage.db.rooms.update({ active: true }, { $set: { active: false }})</nowiki>
  +
  +
==Remove Invader Cores==
  +
Can also be used to delete <code>ruins</code> and other room objects
  +
storage.db["rooms.objects"].removeWhere({type:"invaderCore"})

Latest revision as of 02:42, 24 October 2023

Server CLI[edit | edit source]

Changing & Checking Tick-Rate[edit | edit source]

In server CLI

system.setTickDuration(1000)

Will set the tick-duration to 1000 milliseconds per tick, default is 1000.

system.getTickDuration() 

Will print the current tick duration.

Pausing and Resuming ticks[edit | edit source]

In server CLI

system.pauseSimulation()

Will pause the simulation ticking

system.resumeSimulation()

Will resume the server ticking

Setting GCL[edit | edit source]

In server CLI

storage.db['users'].update({ username: 'username' },{ $set: { gcl: 65000000000 }})

Setting RCL[edit | edit source]

In server CLI

storage.db['rooms.objects'].update({ _id: 'idOfController' },{ $set: { level: 8 }})

Setting Credits[edit | edit source]

In server CLI

storage.db['users'].update({ username: 'username' },{ $set: { money: 2000000 }})

Setting Power[edit | edit source]

storage.db['users'].update({ username: 'username' },{ $set: { power: 540000 }})

Setting User CPU Limit[edit | edit source]

In server CLI

storage.db['users'].update({ username: 'username' },{ $set: { cpu: 500 }})

Adding a new room[edit | edit source]

In server CLI

map.generateRoom(roomName, options)

for options use "help(map)" this will display the help data for map editing stuff

map.generateRoom("W11N11", {sources: 13, controller: false})

The above code for example will generate a room with 13 sources & no controller.

Opening / closing a room[edit | edit source]

In server CLI

map.openRoom("W5N1", [timestamp])

timestamp is optional
e.g. on timestamp usage is to add: Date.now() + (300*1000)
This will mean that the room will open in 5 minutes.

map.closeRoom("W5N1")

Adding NPC Terminals[edit | edit source]

In server CLI

storage.db['rooms.objects'].insert({ type: 'terminal', room: 'W0N0', x: 0, y:0 })

Repeat as many times as desired changing rooms (Use highway rooms or SK rooms) NPC orders should appear on the market automatically after a little while

Adding PowerBank[edit | edit source]

In server CLI

storage.db["rooms.objects"].insert({ room: "W4N10", type: "powerBank", x: 25, y: 25, store: {power: 4000}, hits: 10000, hitsMax: 10000, decayTime: 1000000 });

Manipulating Memory[edit | edit source]

In server CLI (you need the user id first)

storage.env.get(storage.env.keys.MEMORY + '41dbd8207f1bf62');
storage.env.get('memory:41dbd8207f1bf62');

Adding Portals[edit | edit source]

Although it isn't required, it is likely that you will want to run this command at least twice to create a portal in each direction.

storage.db["rooms.objects"].insert({ room: "W5N5", type: "portal", x: 25, y: 25, destination: { x: 25, y: 25, room: "E5N5" }, ticksToDecay: 100000 });

Complete All Construction sites[edit | edit source]

This fills up the progress of all construction sites. As soon as a creep does any construction on them, they'll be done.

storage.db['rooms.objects'].update({ type: 'constructionSite' },{ $set: { progress: 99999 }})

Add a Deposit[edit | edit source]

Add a Deposit into a room, change the depositType to change type of the deposit.

storage.db['rooms.objects'].insert({ type: 'deposit', room: 'W0N9', x: 16, y:26, depositType: 'mist' })

Reset The Server Data[edit | edit source]

Reset user data, rooms, GCL and PCL, server settings, etc.

system.resetAllData()

Disable Inactive Room Activity[edit | edit source]

Sometimes a server has an issue where all rooms are set as active for the system to process, instead of only those with player objects in them. It's unknown why this happens, and can result in the server running very slowly for no good reason. setting it as inactive will resolve the issue.

storage.db.rooms.update({ active: true }, { $set: { active: false }})

Remove Invader Cores[edit | edit source]

Can also be used to delete ruins and other room objects

storage.db["rooms.objects"].removeWhere({type:"invaderCore"})