Difference between revisions of "Function for Current Week of Month"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Lisselli
(added page for getting the current week of a month.)
 
imported>Lisselli
 
Line 6: Line 6:
<source lang="papyrus">
<source lang="papyrus">
Int Function GetCurrentWeekOfMonth(Int aiCurrentDay)
Int Function GetCurrentWeekOfMonth(Int aiCurrentDay)
     return (aiCurrentDay / 7) + 1
     return (aiCurrentDay / 7) + 1 as int
EndFunction
EndFunction
</source>
</source>

Latest revision as of 11:37, 31 August 2017


The global variable GameDay can be used to return the current week of a month.

Syntax[edit | edit source]

Int Function GetCurrentWeekOfMonth(Int aiCurrentDay)
    return (aiCurrentDay / 7) + 1 as int
EndFunction

Return Value[edit | edit source]

  • The current week of this month.

Examples[edit | edit source]

GlobalVariable property GameDay auto

Event OnInit()
debug.trace("Current week of this month is: " +GetCurrentWeekOfMonth(GameDay.GetValue() as int))
EndEvent

Notes[edit | edit source]

  • Week 1 is represented as 1 and week 4 is presented as week 5. Remove +1 if you want week 1 and 4 to be 0 and 4 respectively.