Here we are without the delayed command. I managed to do it with a second loop.
EDIT:Redid the second loop what was there before worked only when the shift amount and number of sides were relatively prime. Thus a shift of 2 on 4 sides did not work as only half of the sides would make it through the second loop. Now this should work without delayed command as it uses the "#Temp" designation as a deletable placeholder.
object GetTargetForTransition()
{
return GetObjectByTag(GetLocalString(GetModule(), GetTag(OBJECT_SELF)));
}
void RotateFaces(string sFacePrefix, int nShift = 1)
{
int nSidesOnFace = GetLocalInt(GetModule(), sFacePrefix);
int n = nSidesOnFace + 1;
int nSide = 1;
int nPosition;
string sSide1;
string sSide2;
while(--n)
{
sSide1 = sFacePrefix + "_" + IntToString(n);
nPosition = 1 + FindSubString(sSide1, "_");
nSide = StringToInt(GetSubString(sSide1, nPosition, GetStringLength(sSide1) - nPosition));
nSide = ((nSide + nShift - 1) % nSidesOnFace) + 1;
sSide2 = GetLocalString(GetModule(), GetStringLeft(sSide1, nPosition) + IntToString(nSide));
SetLocalString(GetModule(), sSide2, sSide1);
SetLocalString(GetModule(), sSide1 + "#Temp", sSide2);
}
while(++n <= nSidesOnFace)
{
sSide1 = sFacePrefix + "_" + IntToString(n);
SetLocalString(GetModule(), sSide1, GetLocalString(GetModule(), sSide1 + "#Temp"));
DeleteLocalString(GetModule(), sSide1 + "#Temp");
}
}
Modifié par WhiZard, 13 avril 2012 - 08:13 .