Leurnid wrote...
Ok, now, what variables do I need to create on the module...
Here is a sample of how to do it.
void SetFace(string sFacePrefix, int nSidesPerFace, int nDoorsPerSide)
{
SetLocalInt(GetModule(), sFacePrefix, nSidesPerFace);
SetLocalInt(GetModule(), sFacePrefix + "door", nDoorsPerSide);
int n = nSidesPerFace * nDoorsPerSide +1;
string sTag, sTag2;
while(--n)
{
sTag = sFacePrefix + "_" + IntToString(n);
sTag2 = GetTag(GetTransitionTarget(GetObjectByTag(sTag)));
SetLocalString(GetModule(), sTag, sTag2);
}
}
void main()
{
SetFace("RubixA", 4, 2);
SetFace("RubixB", 4, 2);
SetFace("RubixC", 4, 2);
SetFace("RubixD", 4, 2);
SetFace("RubixE", 4, 2);
SetFace("RubixF", 4, 2);
}
I have also added a few lines to the switch function to account for doors per side.
void RotateFaces(string sFacePrefix, int nShift = 1)
{
int nSidesOnFace = GetLocalInt(GetModule(), sFacePrefix);
int nDoorsOnSide = GetLocalInt(GetModule(), sFacePrefix + "door");
nShift *= nDoorsOnSide;
nSidesOnFace *= nDoorsOnSide;
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");
}
}