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...")
 
Line 7: Line 7:
 
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).
  
 +
<nwscript>
 
  [[float | float ]] HoursToSeconds(
 
  [[float | float ]] HoursToSeconds(
 
      [[int | int ]] nHours
 
      [[int | int ]] nHours
 
  );
 
  );
 +
</nwscript>
  
 
====Parameters====
 
====Parameters====
Line 31: Line 33:
 
====Example====
 
====Example====
  
<font color="#007f00">// Delay a speakstring command for 1 hour (executed on the object that calls it)
+
<nwscript>
  </font><font color="#0000ff">void</font> main()
+
// Delay a speakstring command for 1 hour (executed on the object that calls it)
 +
  void main()
 
  {
 
  {
     <font color="#007f00">// Declare the variables
+
     // Declare the variables
</font>    <font color="#0000ff">string</font> sHello = <font color="#00007f">"Hello"</font>;
+
    string sHello = "Hello";
     <font color="#0000ff">float</font> fSeconds = HoursToSeconds(<font color="#7f007f">1</font>);
+
     float fSeconds = HoursToSeconds(1);
     <font color="#007f00">// Delay the speakstring
+
     // Delay the speakstring
</font>    DelayCommand(fSeconds, SpeakString(sHello));
+
    DelayCommand(fSeconds, SpeakString(sHello));
 
  }
 
  }
 
   
 
   
 
   
 
   
 +
</nwscript>
  
 
====See Also====
 
====See Also====

Revision as of 20:47, 25 August 2012



HoursToSeconds(int)

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

 [[float | float ]] HoursToSeconds(
     [[int | 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