Difference between revisions of "Math Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>CraftySentinel
m (Formatting Change)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
[[Category:SKSE]]
[[Category:SKSE Script Objects]]
Collection of generic math-related global functions
Collection of generic math-related global functions


Line 20: Line 14:
== Global Functions ==
== Global Functions ==


{|class="wikitable" width =100%
:'''Float [[abs - Math|abs]](Float ''afValue'')'''
!style="text-align:left;"|Function
:*Calculates the absolute value of its parameter.
!style="text-align:left;"|Description
|-
|[[abs - Math|Float '''abs'''(Float ''afValue'')]]
|Calculates the absolute value of its parameter.
|-


|[[acos - Math|Float '''acos'''(Float ''afValue'')]]
:'''Float [[acos - Math|acos]](Float ''afValue'')'''
|Calculates the arccosine of its value (returns degrees).
:*Calculates the arccosine of its value (returns degrees).
|-


|[[asin - Math|Float '''asin'''(Float ''afValue'')]]
:'''Float [[asin - Math|asin]](Float ''afValue'')'''
|Calculates the arcsine of its value (returns degrees).
:*Calculates the arcsine of its value (returns degrees).
|-


|[[atan - Math|Float '''atan'''(Float ''afValue'')]]
:'''Float [[atan - Math|atan]](Float ''afValue'')'''
|Calculates the arctangent of its value (returns degrees).
:*Calculates the arctangent of its value (returns degrees).
|-


|[[Ceiling - Math|Int '''Ceiling'''(Float ''afValue'')]]
:'''Int [[Ceiling - Math|Ceiling]](Float ''afValue'')'''
|Calculates the smallest integer greater than or equal to the value.
:*Calculates the smallest integer greater than or equal to the value.
|-


|[[cos - Math|Float '''cos'''(Float ''afValue'')]]
:'''Float [[cos - Math|cos]](Float ''afValue'')'''
|Calculates the cosine of its value (in degrees).
:*Calculates the cosine of its value (in degrees).
|-


|[[DegreesToRadians - Math|Float '''DegreesToRadians'''(Float ''afDegrees'')]]
:'''Float [[DegreesToRadians - Math|DegreesToRadians]](Float ''afDegrees'')'''
|Converts its argument in degrees to radians.
:*Converts its argument in degrees to radians.
|-


|[[Floor - Math|Int '''Floor'''(Float ''afValue'')]]
:'''Int [[Floor - Math|Floor]](Float ''afValue'')'''
|Calculates the largest integer less than or equal to the value.
:*Calculates the largest integer less than or equal to the value.
|-


|[[pow - Math|Float '''pow'''(Float ''x'', Float ''y'')]]
:'''Float [[pow - Math|pow]](Float ''x'', Float ''y'')'''
|Raises x to the y power.
:*Raises x to the y power.
|-


|[[RadiansToDegrees - Math|Float '''RadiansToDegrees'''(Float ''afRadians'')]]
:'''Float [[RadiansToDegrees - Math|RadiansToDegrees]](Float ''afRadians'')'''
|Converts its argument in radians to degrees.
:*Converts its argument in radians to degrees.
|-


|[[sin - Math|Float '''sin'''(Float ''afValue'')]]
:'''Float [[sin - Math|sin]](Float ''afValue'')'''
|Calculates the sine of its argument (in degrees).
:*Calculates the sine of its argument (in degrees).
|-


|[[sqrt - Math|Float '''sqrt'''(Float ''afValue'')]]
:'''Float [[sqrt - Math|sqrt]](Float ''afValue'')'''
|Calculates the square root of its argument.
:*Calculates the square root of its argument.
|-


|[[tan - Math|Float '''tan'''(Float ''afValue'')]]
:'''Float [[tan - Math|tan]](Float ''afValue'')'''
|Calculates the tangent of its value (in degrees).
:*Calculates the tangent of its value (in degrees).
|-


|}


== SKSE Global Functions ==
== SKSE Global Functions ==


{|class="wikitable" width =100%
:'''Int [[LeftShift - Math|LeftShift]](Int ''value'', Int ''n'')'''
!style="text-align:left;"|Function
:*Shifts value left by n number of bits.
!style="text-align:left;"|Description
|-
|[[LeftShift - Math|Int '''LeftShift'''(Int ''value'', Int ''n'')]]
|Shifts value left by n number of bits.
|-


|[[RightShift - Math|Int '''RightShift'''(Int ''value'', Int ''n'')]]
:'''Int [[RightShift - Math|RightShift]](Int ''value'', Int ''n'')'''
|Shifts value right by n number of bits.
:*Shifts value right by n number of bits.
|-


|[[LogicalAnd - Math|Int '''LogicalAnd'''(Int ''arg1'', Int ''arg2'')]]
:'''Int [[LogicalAnd - Math|LogicalAnd]](Int ''arg1'', Int ''arg2'')'''
|ANDs arg1 with arg2.
:*ANDs arg1 with arg2.
|-


|[[LogicalOr - Math|Int '''LogicalOr'''(Int ''arg1'', Int ''arg2'')]]
:'''Int [[LogicalOr - Math|LogicalOr]](Int ''arg1'', Int ''arg2'')'''
|ORs arg1 with arg2.
:*ORs arg1 with arg2.
|-


|[[LogicalXor - Math|Int '''LogicalXor'''(Int ''arg1'', Int ''arg2'')]]
:'''Int [[LogicalXor - Math|LogicalXor]](Int ''arg1'', Int ''arg2'')'''
|Exclusive ORs arg1 with arg2.
:*Exclusive ORs arg1 with arg2.
|-


|[[LogicalNot - Math|Int '''LogicalNot'''(Int ''arg1'')]]
:'''Int [[LogicalNot - Math|LogicalNot]](Int ''arg1'')'''
|Inverts arg1's bits.
:*Inverts arg1's bits.
|-


|}
:'''Float [[Log - Math|Log]](Float ''arg1'')'''
:*Returns arg1's '''natural''' logarithm (see discussion).


== Events ==
== Events ==
None
None
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Script Objects]]
[[Category:SKSE]]
[[Category:SKSE Script Objects]]

Latest revision as of 14:50, 14 July 2023

Collection of generic math-related global functions

Definition[edit | edit source]

ScriptName Math

Properties[edit | edit source]

None

Member Functions[edit | edit source]

None

Global Functions[edit | edit source]

Float abs(Float afValue)
  • Calculates the absolute value of its parameter.
Float acos(Float afValue)
  • Calculates the arccosine of its value (returns degrees).
Float asin(Float afValue)
  • Calculates the arcsine of its value (returns degrees).
Float atan(Float afValue)
  • Calculates the arctangent of its value (returns degrees).
Int Ceiling(Float afValue)
  • Calculates the smallest integer greater than or equal to the value.
Float cos(Float afValue)
  • Calculates the cosine of its value (in degrees).
Float DegreesToRadians(Float afDegrees)
  • Converts its argument in degrees to radians.
Int Floor(Float afValue)
  • Calculates the largest integer less than or equal to the value.
Float pow(Float x, Float y)
  • Raises x to the y power.
Float RadiansToDegrees(Float afRadians)
  • Converts its argument in radians to degrees.
Float sin(Float afValue)
  • Calculates the sine of its argument (in degrees).
Float sqrt(Float afValue)
  • Calculates the square root of its argument.
Float tan(Float afValue)
  • Calculates the tangent of its value (in degrees).


SKSE Global Functions[edit | edit source]

Int LeftShift(Int value, Int n)
  • Shifts value left by n number of bits.
Int RightShift(Int value, Int n)
  • Shifts value right by n number of bits.
Int LogicalAnd(Int arg1, Int arg2)
  • ANDs arg1 with arg2.
Int LogicalOr(Int arg1, Int arg2)
  • ORs arg1 with arg2.
Int LogicalXor(Int arg1, Int arg2)
  • Exclusive ORs arg1 with arg2.
Int LogicalNot(Int arg1)
  • Inverts arg1's bits.
Float Log(Float arg1)
  • Returns arg1's natural logarithm (see discussion).

Events[edit | edit source]

None