10.02.2019, 03:24

I am confused when to use Global Timer or Unique Timer and how Global Timers will affects server performance same goes to Unique Timers.

I'm currently using Y_Timer.

here is one of my example of using timer:

this code loops all 1000 buildings if exists and loop again if furnace found is this a good way to use this? any recommendation and advice? or should I use single timer in every base.

EDIT: Also should I use Timer Fix plugin for improving accuracy of each timers?

I'm currently using Y_Timer.

here is one of my example of using timer:

Code:

task FurnaceTimer[1000]() { for(new x = 0; x < MAX_BASES; x++) { if(BaseData[x][baseCreated]) { if(BaseData[x][baseTotalFurnace] != 0) { for(new y = 0; y < MAX_BASEOBJECTS; y++) { if(BaseObjectData[x][y][oID] != INVALID_OBJECT_ID && BaseObjectData[x][y][oFurnace] && BaseObjectData[x][y][oFurnaceStatus]) { if(BaseFurnaceData[x][y][furnaceMainItem] != -1 && BaseFurnaceData[x][y][furnaceSecondItem] != -1 || BaseFurnaceData[x][y][furnaceSecondItem] != -1) { if(BaseFurnaceData[x][y][furnaceSItemQuantity] < 2) return BaseObjectData[x][y][oFurnaceStatus] = 0; if(++BaseObjectData[x][y][oFurnaceTimer] >= 120) { if(BaseFurnaceData[x][y][furnaceMainItem] != -1 && BaseFurnaceData[x][y][furnaceSecondItem] != -1) { if(BaseFurnaceData[x][y][furnaceMItemQuantity] > 0) BaseFurnaceData[x][y][furnaceMItemQuantity]--; if(BaseFurnaceData[x][y][furnaceMItemQuantity] <= 0) { //BaseObjectData[x][y][oFurnaceStatus] = 0; //BaseObjectData[x][y][oFurnaceTimer] = 0; BaseFurnaceData[x][y][furnaceMainItem] = -1; BaseFurnaceData[x][y][furnaceMItemQuantity] = 0; } switch(BaseFurnaceData[x][y][furnaceMainItem]) { case ITEM_IRON: { if(BaseFurnaceData[x][y][furnaceFinalItem] == ITEM_IRONBAR && BaseFurnaceData[x][y][furnaceFinalItem] != -1) { BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } else { if(BaseFurnaceData[x][y][furnaceFinalItem] == -1) { BaseFurnaceData[x][y][furnaceFinalItem] = ITEM_IRONBAR; BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } } } case ITEM_BLUEIRON: { if(BaseFurnaceData[x][y][furnaceFinalItem] == ITEM_BLUEIRON && BaseFurnaceData[x][y][furnaceFinalItem] != -1) { BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } else { if(BaseFurnaceData[x][y][furnaceFinalItem] == -1) { BaseFurnaceData[x][y][furnaceFinalItem] = ITEM_BLUEIRON; BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } } } case ITEM_REDIRON: { if(BaseFurnaceData[x][y][furnaceFinalItem] == ITEM_REDIRON && BaseFurnaceData[x][y][furnaceFinalItem] != -1) { BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } else { if(BaseFurnaceData[x][y][furnaceFinalItem] == -1) { BaseFurnaceData[x][y][furnaceFinalItem] = ITEM_REDIRONBAR; BaseFurnaceData[x][y][furnaceFItemQuantity]++; UpdateBaseFurnace(x, y); } } } } } if(BaseFurnaceData[x][y][furnaceSItemQuantity] > 0) BaseFurnaceData[x][y][furnaceSItemQuantity] -= 2; if(BaseFurnaceData[x][y][furnaceMItemQuantity] <= 0) { BaseObjectData[x][y][oFurnaceStatus] = 0; BaseFurnaceData[x][y][furnaceSItemQuantity] = -1; BaseFurnaceData[x][y][furnaceSItemQuantity] = 0; } BaseObjectData[x][y][oFurnaceTimer] = 0; } } else BaseObjectData[x][y][oFurnaceStatus] = 0; } } } } } return 1; }

EDIT: Also should I use Timer Fix plugin for improving accuracy of each timers?