<?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[Untitled RSS Feed]]></title><description><![CDATA[<p>I need a role and script only to fix my roads
I'm new to the game and programming in general. so dont make fun of the code I'm about to post, but what am I doing wrong and how can I make a code just to repair roads only?</p>
<pre><code>	var roleRepairer = 
</code></pre>
<p>{
/** @param {Creep} creep **/
run: function(creep) {</p>
<p>if(creep.memory.repairing &amp;&amp; creep.carry.energy == 0) {
creep.memory.repairing = false;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--arrows_counterclockwise"
      title=":arrows_counterclockwise:"
      alt="🔄"
    /> R: Hrv');
}
else if(!creep.memory.repairing &amp;&amp; creep.carry.energy &lt; creep.carryCapacity) {
creep.memory.repairing = false;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--arrows_counterclockwise"
      title=":arrows_counterclockwise:"
      alt="🔄"
    /> R: Hrv');
}
else if(!creep.memory.repairing &amp;&amp; creep.carry.energy == creep.carryCapacity) {
creep.memory.repairing = true;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f6a7.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--construction"
      title=":construction:"
      alt="🚧"
    /> repair');
}</p>
<p>if(creep.memory.repairing)
{
const targets = creep.room.find(STRUCTURE_ROAD);
targets.sort((a,b) =&gt; a.hits - b.hits);
if(targets.length) {
if(creep.repair(targets[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0], {visualizePathStyle: {stroke: '#ffffff'}});
creep.say('repair');
}
}
}
else
{
var sources = creep.room.find(FIND_SOURCES);
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0], {visualizePathStyle: {stroke: '#ffaa00'}});
}
}
}
}</p>
<p>module.exports = roleRepairer;</p>
<p>and this is posted in my role</p>
<p>repairer and I have
var roleRepairer = require('role.repairer');
and
for(var name in Game.creeps) {
var creep = Game.creeps[name];
if(creep.memory.role == 'repairer') {
roleRepairer.run(creep);</p>
<p>included in the main as well
thanks in advance for teh help</p>
]]></description><link>http://screeps.com/forum/topic/2091/topic</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 07:51:08 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/2091.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Feb 2018 05:19:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to  on Fri, 09 Feb 2018 05:22:18 GMT]]></title><description><![CDATA[<p>I need a role and script only to fix my roads
I'm new to the game and programming in general. so dont make fun of the code I'm about to post, but what am I doing wrong and how can I make a code just to repair roads only?</p>
<pre><code>	var roleRepairer = 
</code></pre>
<p>{
/** @param {Creep} creep **/
run: function(creep) {</p>
<p>if(creep.memory.repairing &amp;&amp; creep.carry.energy == 0) {
creep.memory.repairing = false;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--arrows_counterclockwise"
      title=":arrows_counterclockwise:"
      alt="🔄"
    /> R: Hrv');
}
else if(!creep.memory.repairing &amp;&amp; creep.carry.energy &lt; creep.carryCapacity) {
creep.memory.repairing = false;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f504.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--arrows_counterclockwise"
      title=":arrows_counterclockwise:"
      alt="🔄"
    /> R: Hrv');
}
else if(!creep.memory.repairing &amp;&amp; creep.carry.energy == creep.carryCapacity) {
creep.memory.repairing = true;
creep.say('<img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f6a7.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--construction"
      title=":construction:"
      alt="🚧"
    /> repair');
}</p>
<p>if(creep.memory.repairing)
{
const targets = creep.room.find(STRUCTURE_ROAD);
targets.sort((a,b) =&gt; a.hits - b.hits);
if(targets.length) {
if(creep.repair(targets[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(targets[0], {visualizePathStyle: {stroke: '#ffffff'}});
creep.say('repair');
}
}
}
else
{
var sources = creep.room.find(FIND_SOURCES);
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0], {visualizePathStyle: {stroke: '#ffaa00'}});
}
}
}
}</p>
<p>module.exports = roleRepairer;</p>
<p>and this is posted in my role</p>
<p>repairer and I have
var roleRepairer = require('role.repairer');
and
for(var name in Game.creeps) {
var creep = Game.creeps[name];
if(creep.memory.role == 'repairer') {
roleRepairer.run(creep);</p>
<p>included in the main as well
thanks in advance for teh help</p>
]]></description><link>http://screeps.com/forum/post/9489</link><guid isPermaLink="true">http://screeps.com/forum/post/9489</guid><dc:creator><![CDATA[Ch1ck3n_L0rd]]></dc:creator><pubDate>Fri, 09 Feb 2018 05:22:18 GMT</pubDate></item><item><title><![CDATA[Reply to  on Fri, 09 Feb 2018 08:17:12 GMT]]></title><description><![CDATA[<p>Could you try to fix your post and add a title?<br />
The markup implementation in the forum takes a bit to get used to but it is actually very usable.<br />
Try the tutorial the reference card is missing a lot of details.</p>
<p>And make new post so I get a notification when you updated it <img
      src="http://screeps.com/forum/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=a1k070tfs06"
      class="not-responsive emoji emoji-android emoji--slightly_smiling_face"
      title=":slight_smile:"
      alt="🙂"
    /></p>
]]></description><link>http://screeps.com/forum/post/9493</link><guid isPermaLink="true">http://screeps.com/forum/post/9493</guid><dc:creator><![CDATA[MrFaul]]></dc:creator><pubDate>Fri, 09 Feb 2018 08:17:12 GMT</pubDate></item></channel></rss>