DMH-Online

Dungeon Masters Helper · Est. 2005

Placeables Scripts

NWN Script: useable_sundial_006.htm

Author Sticky: Post Working Scripts Here
Dscaper Posted: Friday, 05 July 04:11PM
Name: DS_GLOBAL_SDIAL

Function: Displays Time in hh:mm format, hh format at dawn/dusk and no time at night. Thanks to Zinderin for minute/second workaround.

If anyone has functions to grab any environmental vars that will relay weather, please forward them to the address in the code header.

Keywords for forum search: sundial, time, hours, minutes

NWScript:
//::///////////////////////////////////////////////
//:: FileName: ds_global_sdial
//:://////////////////////////////////////////////
/*
Shows the time in hh:mm[am/pm] style for daytime and
hh[am/pm] for dawn and dusk. Will not show time at night.
If you know of a way to grab the weather conditions, please
mail me at craig [at] derby.co.uk.
Attach to OnUsed event.
*/
//:://////////////////////////////////////////////
//:: Created By: Dscaper
//:: with thanks to Brett Lathrope (aka Zinderin) for his beautiful minute and second twink.
//:: Created On: 5th July 2002
//:://////////////////////////////////////////////
void main()
{
  if (GetIsNight()) {
    SpeakString("It is night, therefore you cannot tell the time.",TALKVOLUME_TALK);
    return;
  } else {
    // Get Current Hour
    int workHour = GetTimeHour();
    // Get Current Minute, then Multiply up by 30 (as value returned is 0 or 1)
    int workMinute = GetTimeMinute();
    workMinute = workMinute * 30;
    // Get Current Second, then calc through to generate 15 minute markers
    int workSecond = GetTimeSecond();
    if (workSecond >= 30) workMinute = workMinute + 15;
// DEBUGGER
// string workResult = "Debug ";
// workResult = workResult + IntToString(workHour);
// workResult = workResult + ":";
// workResult = workResult + IntToString(workMinute);
    // Setup Checker Vars
    int workShowMinute;
    string workShowTimeframe;
    string workSMinute;
    if (GetIsDawn()) {
      // Dawn
      workShowMinute = 0;
      workShowTimeframe = "dawn";
    } else {
      if (GetIsDusk()) {
        // Dusk
        workShowMinute = 0;
        workShowTimeframe = "dusk";
      } else {
        // Daytime
        workShowMinute = 1;
        workShowTimeframe = "daytime";
        workSMinute = IntToString(workMinute);
        if (GetStringLength(workSMinute) == 1) {
          // Append 0 to minute
          workSMinute = "0" + workSMinute;
        }
      } // End Daytime Code
    } // End Not Dawn
    // Generate AM - PM
    string workDesignate = "AM";
    if (workHour >= 13) {
      workHour = workHour - 12;
      workDesignate = "PM";
    }
    string workResult = "Because it is ";
    workResult = workResult + workShowTimeframe;
    workResult = workResult + ", you can work out that the time is ";
    if (workShowMinute == 0) {
      workResult = workResult + "roughly ";
    }
    workResult = workResult + IntToString(workHour);
    if (workShowMinute == 1) {
      workResult = workResult + ":" + workSMinute;
    }
    workResult = workResult + workDesignate;
    SpeakString(workResult,TALKVOLUME_TALK);
  } // End Not Night
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Placeables Scripts

📄 cast_haste 📄 check_fire 📄 chest_puzzle 📄 close_door 📄 close_door_002 📄 close_door_003 📄 close_door_004 📄 create_item_with_delay 📄 darklamp 📄 darklamp_002 📄 day_night_lights 📄 day_night_lights_002 📄 destroy_spawned_items 📄 destroy_spawned_items_002 📄 door_guard 📄 door_lock_item 📄 dragging_placeables 📄 encounter_on_open 📄 encounter_on_open_002 📄 fair_loot 📄 fire_burns 📄 guarded_chest 📄 kill_attacker 📄 kill_nearby 📄 lights_on_off 📄 linked_doors 📄 moveable_placeables 📄 multi_door 📄 open_doors 📄 poly_attacker 📄 polymorph_pc 📄 polymorph_pc_002 📄 random_teleport 📄 refil_chest 📄 refil_chest_002 📄 refil_chest_003 📄 refil_chest_004 📄 refil_chest_005 📄 refil_chest_006 📄 refil_chest_007 📄 remove_with_item 📄 respawner 📄 smart_doors 📄 spit_treasure 📄 talkable_placeables 📄 talking_door 📄 talking_sign 📄 talking_sign_002 📄 talking_sign_003 📄 talking_sign_004 📄 teleporting_chairs 📄 useable_bedroll 📄 useable_birdcage 📄 useable_cannon 📄 useable_catapult 📄 useable_chair 📄 useable_chair_002 📄 useable_chair_003 📄 useable_chair_004 📄 useable_couch 📄 useable_divining_pool 📄 useable_gong 📄 useable_kegs 📄 useable_kegs_002 📄 useable_placeables_002 📄 useable_sign 📄 useable_sign_002 📄 useable_sundial 📄 useable_sundial_002 📄 useable_sundial_003 📄 useable_sundial_004 📄 useable_sundial_005 📄 useable_sundial_006 📄 useable_training_dummy 📄 useable_training_dummy_002 📄 useable_training_dummy_003 📄 useable_training_dummy_004 📄 useable_trapdoor 📄 useable_trapdoor_002 📄 useable_trapdoor_003 📄 useable_trapdoor_004 📄 weapon_spawn_per_class 📄 worth