Exampelscript: Time of Day in 24 Hour Format

From the CreationKit Wiki
Jump to navigation Jump to search



The Global Variable GameHour can be used to return the actual time in-game. However, the return value is in float format: So the output value is, for example: 10.25 for 10:15 o'clock.

Because of that, we must use Math.Floor to remove the portion after the decimal point and then store the remaining integer in a additional variable.


Message Property ZeitAnzeigen Auto
GlobalVariable Property GameHour Auto

float Function ZeigeZeit() 

	Float Time = GameHour.GetValue()
	Int Std = Math.Floor(Time)
	Time = Time - Std
	Time = ((Time / 5)*3)
	Time = Time + Std
	Return Time
EndFunction

Event OnEffectStart(Actor akTarget,Actor akCaster)

ZeitAnzeigen.Show(ZeigeZeit())
EndEvent


Language: [[::Exampelscript: Time of Day in 24 Hour Format|English]]  • [[::Exampelscript: Time of Day in 24 Hour Format/de|Deutsch]]