ScreepsMods / screepsmod-gcltocpu

Mod for Screeps to change the CPU with the change of GCL
3 stars 1 forks source link

updateCPU() does not update CPU #1

Closed ghost closed 7 years ago

ghost commented 7 years ago

My user still has 100 cpu even after updateCPU(), only after updateCPU(playerName) did it actually update.

Another question: Does this run automatically or is it manual cli command only?

ghost commented 7 years ago

Another question, I see the sandbox.log but where does console.log in updateUser go?

Thanks.

iKlem commented 7 years ago

For the updateCPU command, it will be removed for the next version or will be other commands. I don't know how I'll do it at the moment, but i want it more configurable with the storage or a json config file.

For the second question, the runners update automatically. The update works only when you hit the GCL 9. (edit) This is why I wanted the cli command to update it manually.

And for the last one : the console.log appear in the "used config". Example: if I do console.log in the (config.storage), the log will be in the storage.log file. This is what I've seen when testing.

ghost commented 7 years ago

Thanks for the detailed answers! I found the console.log in backend.log for the one updateCPU(playerName) call I made.

Would you mind pointing me to the code that makes the runner update automatically? I don't see a cronjob in index.js.

It would be nice if there was an option to force update cpu for all users (and bots) according to their GCL, even if it was lower than their current CPU, as I was thinking of adding versions of my old code to my server as bots for testing.

iKlem commented 7 years ago

Would you mind pointing me to the code that makes the runner update automatically? I don't see a cronjob in index.js.

You can test it by adding a console.log() or another way to print debug messages in the main loop, after the if (constants) { and look at any runner log file. This is how i know it can be called each tick. So no need for now for a cronjob. Maybe it's not a good way but that way can work.

The force update was the CLI command but it really don't work the way i though about it. Like i explained on the slack :

For now i'm not sure if i want to always force the update or to generate some configuration for the admin for changing on the fly with some CLI commands

So this is why i put the help wanted on this to have some ideas for the next update.

iKlem commented 7 years ago

Since the 0.3.0, the mod will act like on the official server.