[CVars - Singleplayer] Constantly saved CVars?
Posted: Thu Dec 11, 2014 9:48 pm
I have made a script that loops every tic, and besides some other coding in it, I have something that will calculate for how long you have played IN TOTAL (after closing and opening the game too). For this I use CVars, but is it a good idea to make it save all CVars each second in singleplayer? Or will it lag/eat up your RAM/CPU? (I do this because disconnect scripts only work in multiplayer).
Please note that there are other scripts that uses CVars too, and those scripts executes when you kill a monster etc...
Code: Select all
Script 513 ENTER CLIENTSIDE
{
Int Tics = 0;
Int SecondsTotal = 0;
While(TRUE)
{
If(PlayerNumber() != ConsolePlayerNumber())
{
Terminate;
}
Tics ++;
If(Tics >= 35)
{
Tics = 0;
SecondsTotal ++;
If(GameType() == GAME_SINGLE_PLAYER)
{
SaveAllStatsAndSettings();
}
}
... other code here ...
Delay(1);
}
}