//credits
//Fluffypoopo- the main scripter
//Varrience- Helping fix errors
//NOTE: you must change all tables at the same time if you are updating the table or it will undo it
/////////////////////////////////////////////////////////
//this is the things that only run once
if (1==1) {
//this spicific system is for as many as you want to protect, please remember more you task it with slower it will be at reacting, It my be missing the last one but to fix that add one table and make sure all the tables are the same
//there is a min of 3 tables total in a group
//Tables too look after, groups are tables with diffrent data then another group, you can add groups as many as you want
var group1 = ["Test1", "Test2", "Test3"];
var group2 = ["Test4", "Test5", "Test6"];
/////////////////////////////////////////////////////////
//inorder for it do see the group you must put the group id here without any " or ' and it does not matter about the name as long as it is put here
var group_ids = [group1, group2];
/////////////////////////////////////////////////////////
//time between ticks (Default 600)
var interval = 600;
/////////////////////////////////////////////////////////
var content_in_group = 0;
var groups = 0;
var ID;
var ID2;
var ID3;
var x;
var y;
var z;
var Gate = true;
var i = 0;
var c = 0;
var o = 0;
var u = 0;
var gate2 = true;
}
/////////////////////////////////////////////////////////
//this is the system
timedLoop(interval, function() {
if (gate2) {
gate2 = false;
groups = groups + 1;
content_in_group = content_in_group + 1;
if (group_ids[groups] == undefined) {
groups = 0;
}
}
var list = group_ids[groups];
if (i != undefined) {
i = list[i+2] === undefined ? 0: i;
var T = list[i++];
var TA = list[i++];
var TAB = list[i];
var rawID = getColumn(T, "id");
ID = rawID[c++];
var rawID2 = getColumn(TA, "id") || "";
ID2 = rawID2[o++];
var rawID3 = getColumn(TAB, "id");
ID3 = rawID3[u++];
if (ID3 == undefined) {
gate2 = true;
i = 0;
}
/////////////////////////////////////////////////////////
//edit protection main
if (Gate) {
Gate = false;
if (ID != undefined) {
readRecords(T, {id:ID}, function(r1) {
for (var i =0; i < r1.length; i++) {
x = JSON.stringify(r1[0]);
}
readRecords(TA, {id:ID2}, function(r2) {
for (var i =0; i < r2.length; i++) {
y = JSON.stringify(r2[0]);
}
readRecords(TAB, {id:ID3}, function(r3) {
for (var i =0; i < r3.length; i++) {
z = JSON.stringify(r3[0]);
}
if (x != z || y != z || x != y) {
if (x != z && x != y) {
updateRecord(T, JSON.parse(y));
} else if ((y != x && y != z)) {
updateRecord(TA, JSON.parse(z));
} else if ((z != x && z != y)) {
updateRecord(TAB, JSON.parse(x));
}
}
Gate = true;
});
});
});
} else {
Gate = true;
c = 0;
o = 0;
u = 0;
}
}
}
});