Author Sticky: Post Working Scripts Here
Arckon Posted: Thursday, 04 July 10:26PM
Configurable Sundial time script

This is merely a derivitive of prior work. It allows the DM to use this script for their sundials in their world and adjust its time for how long their game hours are. It also allows the DM to set the intervals of the hour to be returned, every quarter hour, every twelfth, etc.

Code:
  

//:://///////////////////////////////

/*

    When placed on a sun dial's ONUSED event, this

    script will provide the actual game time to a

    resolution defined by the DM with the game hour

    as defined by the DM. 

*/

//::////////////////////////////////

//:: Created By: Brett Lathrope

//:: Created On: July 3, 2002

//:: Modified By: RG Cheek 7-4-02  - *NOTE: user defines MIN_GHR & NUM_INT*

//::///////////////////////////////

void main()

{

  int MIN_GHR = 2;    // The modules time rate of minutes per game hour

  int NUM_INT = 12;   // Minint = number of intervals of time per hour - marks per hour

  int nGHour = GetTimeHour();

  int nRMinute = GetTimeMinute();

  int nRSeconds = GetTimeSecond();

  int lMinint  = ( MIN_GHR * 60 / NUM_INT);

                  // lMinint = number of seconds per interval per hour

  int nFM;                          //False Minute we'll build.

  string sFM;                       // String storage of our false minute.

  if (GetIsNight()){

    SpeakString( "Sun dials don't work at night.", TALKVOLUME_TALK);

    return;

  }

  nFM = ( ( (60 * nRMinute) + nRSeconds ) / lMinint ) * ( 60 / NUM_INT );

  sFM = IntToString( nFM );

  if (GetStringLength( sFM ) == 1) sFM = "0" + sFM;

  string sDesignate = " AM";

  if ( nGHour > 12 ){

    nGHour = nGHour - 12;

    sDesignate = " PM";

  }

  string sTmp = IntToString( nGHour ) + ":" + sFM + sDesignate;

  SpeakString("It is about " + sTmp, TALKVOLUME_TALK);

}





_________________
Acolyte of the Ancient Mystic Order of Old Fogeys

http://andalusiarpg.org