Negative cpuUnlock



  • I've just encountered the problem that I've got -16 cpu token. In my automatic market code there is a condition like if (!Game.resources[itemName]) continue;. my cpuToken are 0 all times. Yesterday evening at around 22 p.m. (CET) my script suddenly sells cpuUnlocks which I do not own., so that now I have -16 cpuUnlock.

    The actual code is:

    const globalResources = ['cpuUnlock', 'pixel', 'accessKey'];
    ...
            for (var itemName of globalResources) {
                if (!Game.resources[itemName]) continue;
    ...
    if (Game.market.deal(bestOrder.id, Math.min(Game.resources[itemName], bestOrder.amount)) === OK)
    ...
    

    So the engine must have delivered some Game.resources for cpuUnlock that were not existing, whatever evaluates to false after given to the ! operator. Even then Game.market.deal should have refused the deal because no cpuUnlock are owned to sell, instead it returned OK.

    My market code runs on shard2.



  • PandaMaster had the same issue buying a lot of things from the market at once and getting into a very high debt that way. He seemingly bought stuff with credits he didn't have. This issue was reported to @o4kapuk immediately, I think transactions were undone/rolled back, and he did let us know that he fixed it. Now I am wondering if you got the same issue with game resources trading, but for the sell intent. If it is, o4 must have not considered adding it to the other actions.