xcafe Posted December 11, 2016 Share Posted December 11, 2016 (edited) I found a pretty useful script, but I don't know anything about floats so I don't know how to make it work! Scriptname reregisterscript extends ObjectReference Float fPreviousUpdate Float fUpdateTime = 1.5 Float fMinimumUpdateTime = 0.1 Int iCounter Event OnSomeEvent() ;The first time that you register for an update fPreviousUpdate = Utility.GetCurrentGameTime() RegisterForSingleUpdateGameTime(fUpdateTimer) EndEvent Event OnUpdateGameTime() Float fCurrentTime = Utility.GetCurrentGameTime() Float fNumUpdates = (fCurrentTime - fPreviousUpdate) * 24 / fUpdateTimer Int iNumUpdates = Math.Floor(fNumUpdates) If(iNumUpdates > 0) iCounter += 1 * iNumUpdates Else iCounter += 1 EndIf fPreviousUpdate = fCurrentTime Float fRemainingTime = fUpdateTime * (1.0 - (fNumUpdates - (iNumUpdates as Float))) If(fRemainingTime > fMinimumUpdateTime) RegisterForSingleUpdateGameTime(fRemainingTime) Else RegisterForSingleUpdateGameTime(fMinimumUpdateTime) EndIf EndEvent I found it here, http://www.gamesas.com/time-remainder-after-onupdategametime-t371450.html, and tried to compile it, but it brings up a bunch of compiler errors and I know literally nothing about floats so I don't know how to fix them. Here are the errors, for reference: C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\reregisterscript.psc(16,24): required (...)+ loop did not match anything at input 'iCounter' C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\reregisterscript.psc(17,9): required (...)+ loop did not match anything at input 'iCounter' C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\reregisterscript.psc(23,12): required (...)+ loop did not match anything at input 'RegisterForSingleUpdateGameTime' Edited December 11, 2016 by xcafe Link to comment Share on other sites More sharing options...
NexusComa Posted December 11, 2016 Share Posted December 11, 2016 Scriptname __reregisterscript extends ObjectReference Float fPreviousUpdate Float fUpdateTime = 1.5 Float fMinimumUpdateTime = 0.1 Int iCounter Event OnSomeEvent() ;The first time that you register for an update fPreviousUpdate = Utility.GetCurrentGameTime() RegisterForSingleUpdateGameTime(fUpdateTime) EndEvent Event OnUpdateGameTime() Float fCurrentTime = Utility.GetCurrentGameTime() Float fNumUpdates = (fCurrentTime - fPreviousUpdate) * 24 / fUpdateTime Int iNumUpdates = Math.Floor(fNumUpdates) If(iNumUpdates > 0) iCounter += 1 * iNumUpdates Else iCounter += 1 EndIf fPreviousUpdate = fCurrentTime Float fRemainingTime = fUpdateTime * (1.0 - (fNumUpdates - (iNumUpdates as Float))) If(fRemainingTime > fMinimumUpdateTime) RegisterForSingleUpdateGameTime(fRemainingTime) Else RegisterForSingleUpdateGameTime(fMinimumUpdateTime) EndIf EndEvent Link to comment Share on other sites More sharing options...
NexusComa Posted December 11, 2016 Share Posted December 11, 2016 (edited) Btw, a Float is just a number with a "."Exps: 1 is a INTeger (a whole number; a number that is not a fraction) 1.1 is a FLOATing point (no fixed number of digits before and after the decimal point) 1.5 is the same as saying I have 1 part and 1/2 of a part or 1 1/21.9 is the same as saying I have 1 part and 9/10 of a part or 1 9/10 Edited December 11, 2016 by NexusComa Link to comment Share on other sites More sharing options...
Recommended Posts