<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Negative cpuUnlock]]></title><description><![CDATA[<p>I've just encountered the problem that I've got -16 cpu token. In my automatic market code there is a condition like <code>if (!Game.resources[itemName]) continue;</code>. 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.</p>
<p>The actual code is:</p>
<pre><code>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)
...
</code></pre>
<p>So the engine must have delivered some <code>Game.resources</code> 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 <code>OK</code>.</p>
<p>My market code runs on shard2.</p>
]]></description><link>http://screeps.com/forum/topic/3286/negative-cpuunlock</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 07:41:34 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/3286.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 Jan 2024 12:58:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Negative cpuUnlock on Tue, 09 Jan 2024 19:00:54 GMT]]></title><description><![CDATA[<p>I've just encountered the problem that I've got -16 cpu token. In my automatic market code there is a condition like <code>if (!Game.resources[itemName]) continue;</code>. 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.</p>
<p>The actual code is:</p>
<pre><code>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)
...
</code></pre>
<p>So the engine must have delivered some <code>Game.resources</code> 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 <code>OK</code>.</p>
<p>My market code runs on shard2.</p>
]]></description><link>http://screeps.com/forum/post/16747</link><guid isPermaLink="true">http://screeps.com/forum/post/16747</guid><dc:creator><![CDATA[Xenofix]]></dc:creator><pubDate>Tue, 09 Jan 2024 19:00:54 GMT</pubDate></item><item><title><![CDATA[Reply to Negative cpuUnlock on Invalid Date]]></title><description><![CDATA[<p>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 <a class="plugin-mentions-user plugin-mentions-a" href="http://screeps.com/forum/uid/183">@o4kapuk</a> 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.</p>
]]></description><link>http://screeps.com/forum/post/16748</link><guid isPermaLink="true">http://screeps.com/forum/post/16748</guid><dc:creator><![CDATA[DefaultO]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>