Difference between revisions of "HoursToSeconds"

From NWN Lexicon
Jump to: navigation, search
(Created page with " =HoursToSeconds(int)= This function calculates the number of actual seconds in n game hour(s). float  HoursToSeconds(      int  nHo...")
 
m (Wikified article formatting)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
 
 
 
=HoursToSeconds(int)=
 
 
 
This function calculates the number of actual seconds in n game hour(s).
 
This function calculates the number of actual seconds in n game hour(s).
  
[[float | float ]] HoursToSeconds(
+
<nwscript>
    [[int | int ]] nHours
+
float HoursToSeconds(
);
+
    int nHours
 +
);
 +
</nwscript>
  
====Parameters====
+
===Parameters===
 
+
; nHours
''nHours''
+
: The number of hours to turn into seconds.
 
 
The number of hours to turn into seconds.
 
 
 
<br />
 
 
 
====Description====
 
  
 +
===Description===
 
Converts nHours into a number of seconds. The result will depend on how many minutes there are per hour, configured in the advanced properties of the module (default is 2 minutes per hour, so the default settings would return 120 seconds if nHours were 1).
 
Converts nHours into a number of seconds. The result will depend on how many minutes there are per hour, configured in the advanced properties of the module (default is 2 minutes per hour, so the default settings would return 120 seconds if nHours were 1).
  
<br /><br />
+
===Version===
 
 
====Version====
 
 
 
 
1.28
 
1.28
  
====Example====
+
===Example===
 +
<nwscript>
 +
// Delay a speakstring command for 1 hour (executed on the object that calls it)
 +
void main()
 +
{
 +
    // Declare the variables
 +
    string sHello = "Hello";
 +
    float fSeconds = HoursToSeconds(1);
 +
    // Delay the speakstring
 +
    DelayCommand(fSeconds, SpeakString(sHello));
 +
}
  
<font color="#007f00">// Delay a speakstring command for 1 hour (executed on the object that calls it)
 
</font><font color="#0000ff">void</font> main()
 
{
 
    <font color="#007f00">// Declare the variables
 
</font>    <font color="#0000ff">string</font> sHello = <font color="#00007f">"Hello"</font>;
 
    <font color="#0000ff">float</font> fSeconds = HoursToSeconds(<font color="#7f007f">1</font>);
 
    <font color="#007f00">// Delay the speakstring
 
</font>    DelayCommand(fSeconds, SpeakString(sHello));
 
}
 
 
 
  
====See Also====
+
</nwscript>
  
 +
===See Also===
 
{| class="seealso"
 
{| class="seealso"
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
|
+
| [[SetTime]]
[[ SetTime  | SetTime ]]
 
|-
 
 
|}
 
|}
  
<br />
 
 
----
 
----
<font color="gray">  author: Charles Feduke, editor: Jasperre, additional contributor(s): Lilac Soul</font><br />  <br />
+
<font color="gray">  author: Charles Feduke, editor: Jasperre, additional contributor(s): Lilac Soul</font>
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Time_Functions]]
 
[[Category:Time_Functions]]
 +
{{DISPLAYTITLE:HoursToSeconds(int)}}

Latest revision as of 09:37, 30 December 2020

This function calculates the number of actual seconds in n game hour(s).

float HoursToSeconds(
    int nHours
);

Parameters

nHours
The number of hours to turn into seconds.

Description

Converts nHours into a number of seconds. The result will depend on how many minutes there are per hour, configured in the advanced properties of the module (default is 2 minutes per hour, so the default settings would return 120 seconds if nHours were 1).

Version

1.28

Example

// Delay a speakstring command for 1 hour (executed on the object that calls it)
void main()
{
    // Declare the variables
    string sHello = "Hello";
    float fSeconds = HoursToSeconds(1);
    // Delay the speakstring
    DelayCommand(fSeconds, SpeakString(sHello));
}

See Also

functions:  SetTime

 author: Charles Feduke, editor: Jasperre, additional contributor(s): Lilac Soul