For the love of all that is holy… use TAB to organize things…
Secondly, read FAQ - Check Before Posting on how you should post your code.
Thirdly, Number will be your friend.
var sign = this.findByType("sign")[0];
var message = sign.message;
var i=0;
this.say(message);
var summonArray = {a:"archer", s:"soldier", p:"peasant", g:"griffin-rider"}
loop{
var m = message.slice(i*5,i*5+1);
this.summon(summonArray[m]);
var friend = this.built[this.built.length-1];
if (friend){
var x1 = Number(message.slice(i*5+1,i*5+2));
var x2 = Number(message.slice(i*5+2,i*5+3));
var y1 = Number(message.slice(i*5+3,i*5+4));
var y2 = Number(message.slice(i*5+4,i*5+5));
var target = {x:x1*10+x2,y:y1*10+y2};
this.command(friend, "move", target);
}
i++;
}
^ here is compact version of your script, hope that helps a bit
And some advice, whenever you’re using math in your code, encapsule everything as much as you can, just to make sure, because it can be weird.
aka:
var target = {x:x1*10+x2,y:y1*10+y2};
becomes
var target = {x:(x1*10)+x2, y:(y1*10)+y2};
or
var target = {x:x1*(10+x2), y:y1*(10+y2)};
because the code doesn’t know which one you want to use at that point.