Difference between revisions of "Utility Script"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Plplecuyer
 
imported>Qazaaq
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
Collection of generic utility global functions.
[[Category:Papyrus]]
[[Category:Script Objects]]
 
Collection of generic utility global functions


== Definition ==
== Definition ==
Line 18: Line 14:
*Function [[CallGlobalFunctionNoWait - Utility|CallGlobalFunctionNoWait]](string asScriptName, string asFuncName, Var[] aParams)
*Function [[CallGlobalFunctionNoWait - Utility|CallGlobalFunctionNoWait]](string asScriptName, string asFuncName, Var[] aParams)
**Call a global function asynchronously without depending on the script containing the function.
**Call a global function asynchronously without depending on the script containing the function.
*string Function [[CaptureFrameRate - Utility|CaptureFrameRate]](int numFrames)
**Obtains a string describing the frame rate for a certain number of frames. The string will be no longer than 1,000 characters, and will be separated by commas.
*Function [[EndFrameRateCapture - Utility|EndFrameRateCapture]]()
**Ends a framerate capture.
*Function [[EnterTestData - Utility|EnterTestData]](string astestType, string astestMatter, string astestDetails, string astestResultContext, string astestResult)
**Sends the passed in test data to the tests website.
*string Function [[GameTimeToString - Utility|GameTimeToString]](float afGameTime)
*string Function [[GameTimeToString - Utility|GameTimeToString]](float afGameTime)
**Converts a float game time (in terms of game days passed) to a string detailing the date and time it represents.
**Converts a float game time (in terms of game days passed) to a string detailing the date and time it represents.
*float Function [[GetAverageFrameRate - Utility|GetAverageFrameRate]]()
**Gets the average frame rate achieved during the frame rate capture.
*string Function [[GetCurrentBudget - Utility|GetCurrentBudget]](int aiBudgetNumber)
**Obtains the current memory budget.
*float Function [[GetCurrentGameTime - Utility|GetCurrentGameTime]]()
*float Function [[GetCurrentGameTime - Utility|GetCurrentGameTime]]()
**Obtains the current game time in terms of game days passed (the same as the global variable of a similar name)
**Obtains the current game time in terms of game days passed (the same as the global variable of a similar name).
*string Function [[GetCurrentMemory - Utility|GetCurrentMemory]]()
**This function must be called first when using memory tracking functions, as it sets up the memory stats used by the other functions.
*float Function [[GetCurrentRealTime - Utility|GetCurrentRealTime]]()
*float Function [[GetCurrentRealTime - Utility|GetCurrentRealTime]]()
**Obtains the number of real-world seconds that have passed since the game has launched (ignoring time alt-tabbed away, or other cases where the game might be frozen)
**Obtains the number of real-world seconds that have passed since the game has launched (ignoring time alt-tabbed away, or other cases where the game might be frozen).
*int Function [[GetCurrentStackID - Utility|GetCurrentStackID]]()
*int Function [[GetCurrentStackID - Utility|GetCurrentStackID]]()
**Obtains the ID number of the stack this function was called on.
**Obtains the ID number of the stack this function was called on.
*int Function [[GetBudgetCount - Utility|GetBudgetCount]]()
**Obtains the memory budget count.
*string Function [[GetBudgetLimit - Utility|GetBudgetLimit]](int aiBudgetNumber)
** Returns the specified memory budget's limit.
*string Function [[GetBudgetName - Utility|GetBudgetName]](int aiBudgetNumber)
**Returns the name of the specified memory budget.
*float Function [[GetMinFrameRate - Utility|GetMinFrameRate]]()
**Obtains the minimum frame rate achieved during the frame rate capture.
*float Function [[GetMaxFrameRate - Utility|GetMaxFrameRate]]()
**Obtains the maximum frame rate achieved during the frame rate capture.
*bool Function [[IsInMenuMode - Utility|IsInMenuMode]]()
*bool Function [[IsInMenuMode - Utility|IsInMenuMode]]()
**Returns whether the game is currently in "menu mode" or not.
**Returns whether the game is currently in "menu mode" or not.
*bool Function [[OverBudget - Utility|OverBudget]](int aiBudgetNumber)
**Returns whether the system is over the memory budget limit.
*Function [[PostStartUpTimes - Utility|PostStartUpTimes]]()
**Sends the start up times to the tests website.
*float Function [[RandomFloat - Utility|RandomFloat]](float afMin, float afMax)
*float Function [[RandomFloat - Utility|RandomFloat]](float afMin, float afMax)
**Generates a random float between the minimum and maximum (inclusive)
**Generates a random float between the minimum and maximum (inclusive).
*int Function [[RandomInt - Utility|RandomInt]](int aiMin, int aiMax)
*int Function [[RandomInt - Utility|RandomInt]](int aiMin, int aiMax)
**Generates a random integer between the minimum and maximum (inclusive)
**Generates a random integer between the minimum and maximum (inclusive).
*Function [[SetINIBool - Utility|SetINIBool]](string ini, bool value)
*Function [[SetINIBool - Utility|SetINIBool]](string ini, bool value)
**Sets a pre-existing bool ini value
**Sets a pre-existing bool ini value.
*Function [[SetINIFloat - Utility|SetINIFloat]](string ini, float value)
*Function [[SetINIFloat - Utility|SetINIFloat]](string ini, float value)
**Sets a pre-existing float ini value
**Sets a pre-existing float ini value.
*Function [[SetINIInt - Utility|SetINIInt]](string ini, int value)
*Function [[SetINIInt - Utility|SetINIInt]](string ini, int value)
**Sets a pre-existing int ini value
**Sets a pre-existing int ini value.
*Function [[SetINIString - Utility|SetINIString]](string ini, string value)
*Function [[SetINIString - Utility|SetINIString]](string ini, string value)
**Sets a pre-existing string ini value
**Sets a pre-existing string ini value.
*Function [[StartFrameRateCapture - Utility|StartFrameRateCapture]]()
**Starts a frame rate capture.
*Function [[Wait - Utility|Wait]](float afSeconds)
*Function [[Wait - Utility|Wait]](float afSeconds)
**Pauses the script for at least the specified time (latent). Does not count time spent in a menu.
**Pauses the script for at least the specified time (latent). Does not count time spent in a menu.
Line 46: Line 70:
*Function [[WaitMenuMode - Utility|WaitMenuMode]](float afSeconds)
*Function [[WaitMenuMode - Utility|WaitMenuMode]](float afSeconds)
**Pauses the script for at least the specified time (latent). ''Does'' count time spent in a menu.
**Pauses the script for at least the specified time (latent). ''Does'' count time spent in a menu.
== F4SE Global Functions ==
*var[] Function [[VarToVarArray - Utility|VarToVarArray]](var v)
**Converts var to var[], for [[UI_Script|UI Script]] functions.
*var Function [[VarArrayToVar - Utility|VarArrayToVar]](var[] v)
**Converts var[] to var, for [[UI_Script|UI Script]] functions.


== Member Functions ==
== Member Functions ==
Line 52: Line 83:
== Events ==
== Events ==
None
None
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]

Latest revision as of 18:56, 21 January 2018

Collection of generic utility global functions.

Definition[edit | edit source]

ScriptName Utility Native Hidden

Properties[edit | edit source]

None

Global Functions[edit | edit source]

  • Var Function CallGlobalFunction(string asScriptName, string asFuncName, Var[] aParams)
    • Call a global function synchronously without depending on the script containing the function.
  • Function CallGlobalFunctionNoWait(string asScriptName, string asFuncName, Var[] aParams)
    • Call a global function asynchronously without depending on the script containing the function.
  • string Function CaptureFrameRate(int numFrames)
    • Obtains a string describing the frame rate for a certain number of frames. The string will be no longer than 1,000 characters, and will be separated by commas.
  • Function EndFrameRateCapture()
    • Ends a framerate capture.
  • Function EnterTestData(string astestType, string astestMatter, string astestDetails, string astestResultContext, string astestResult)
    • Sends the passed in test data to the tests website.
  • string Function GameTimeToString(float afGameTime)
    • Converts a float game time (in terms of game days passed) to a string detailing the date and time it represents.
  • float Function GetAverageFrameRate()
    • Gets the average frame rate achieved during the frame rate capture.
  • string Function GetCurrentBudget(int aiBudgetNumber)
    • Obtains the current memory budget.
  • float Function GetCurrentGameTime()
    • Obtains the current game time in terms of game days passed (the same as the global variable of a similar name).
  • string Function GetCurrentMemory()
    • This function must be called first when using memory tracking functions, as it sets up the memory stats used by the other functions.
  • float Function GetCurrentRealTime()
    • Obtains the number of real-world seconds that have passed since the game has launched (ignoring time alt-tabbed away, or other cases where the game might be frozen).
  • int Function GetCurrentStackID()
    • Obtains the ID number of the stack this function was called on.
  • int Function GetBudgetCount()
    • Obtains the memory budget count.
  • string Function GetBudgetLimit(int aiBudgetNumber)
    • Returns the specified memory budget's limit.
  • string Function GetBudgetName(int aiBudgetNumber)
    • Returns the name of the specified memory budget.
  • float Function GetMinFrameRate()
    • Obtains the minimum frame rate achieved during the frame rate capture.
  • float Function GetMaxFrameRate()
    • Obtains the maximum frame rate achieved during the frame rate capture.
  • bool Function IsInMenuMode()
    • Returns whether the game is currently in "menu mode" or not.
  • bool Function OverBudget(int aiBudgetNumber)
    • Returns whether the system is over the memory budget limit.
  • Function PostStartUpTimes()
    • Sends the start up times to the tests website.
  • float Function RandomFloat(float afMin, float afMax)
    • Generates a random float between the minimum and maximum (inclusive).
  • int Function RandomInt(int aiMin, int aiMax)
    • Generates a random integer between the minimum and maximum (inclusive).
  • Function SetINIBool(string ini, bool value)
    • Sets a pre-existing bool ini value.
  • Function SetINIFloat(string ini, float value)
    • Sets a pre-existing float ini value.
  • Function SetINIInt(string ini, int value)
    • Sets a pre-existing int ini value.
  • Function SetINIString(string ini, string value)
    • Sets a pre-existing string ini value.
  • Function StartFrameRateCapture()
    • Starts a frame rate capture.
  • Function Wait(float afSeconds)
    • Pauses the script for at least the specified time (latent). Does not count time spent in a menu.
  • Function WaitGameTime(float afHours)
    • Pauses the script for at least the specified amount of game time (latent).
  • Function WaitMenuMode(float afSeconds)
    • Pauses the script for at least the specified time (latent). Does count time spent in a menu.

F4SE Global Functions[edit | edit source]

Member Functions[edit | edit source]

None

Events[edit | edit source]

None