The world of Krynn...in digital, interactive form.
 
HomeHome  MemberlistMemberlist  GalleryGallery  CalendarCalendar  FAQFAQ  SearchSearch  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Sticky Time

Go down 
AuthorMessage
winterhawk99

avatar

Posts : 28
Join date : 2018-06-03
Age : 51
Location : Texas

PostSubject: Sticky Time   Sat Jul 21, 2018 2:30 pm

Hi everyone was on the server today and noticed the time was stuck. I have a simple function to fix that if not intentional. This is one of the On_Mod_Load scripts to my old module. The important part for this instance is the function called SemiBeat. It resets the time on the server if time gets sleepy.

Code:
//::///////////////////////////////////////////////
//:: Name hm_mod_onload
//:://////////////////////////////////////////////
/*
    Harvest Moon Module on Load script
*/
//:://////////////////////////////////////////////
//:: Created By: Mermut
//:: Created On: November 28, 2007
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "aps_include"

void SemiBeat();

void main()
{
    SetLocalString(GetModule(),"EPICCOORDINATOR","Winterhawk1");
    DelayCommand(0.1,ExecuteScript("24_spell_modload",OBJECT_SELF));
    DelayCommand(1.0,ExecuteScript("24_act_encounter",OBJECT_SELF));
    DelayCommand(1.2,ExecuteScript("lds_module_load", GetModule()));


    // Set Module Switches
    SetModuleSwitch (MODULE_SWITCH_ENABLE_UMD_SCROLLS, TRUE);
    SetModuleSwitch (MODULE_SWITCH_AOE_HURT_NEUTRAL_NPCS, TRUE);
    SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);
    SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);

    SetMaxHenchmen(5);

    /* Initilize APS/NWNX ODBC connection */
    SQLInit();

    // Semi-Beat that runs every 10 minutes
    // Currently it only manually sets the time gets tired
    DelayCommand(600.0, SemiBeat());
}

void SemiBeat()
{
    int iHour = GetTimeHour();
    int iMilli = GetTimeMillisecond();
    int iMinute = GetTimeMinute();
    int iSecond = GetTimeSecond();
    SetTime(iHour, iMinute, iSecond, iMilli);
    DelayCommand(600.0, SemiBeat());
}
Back to top Go down
View user profile http://www.harvestmoonconsortium.com
Black Rider
Admin
avatar

Posts : 715
Join date : 2010-02-11
Location : Germany

Character sheet
Character Name:
Race:
Class:

PostSubject: Re: Sticky Time   Sun Jul 22, 2018 6:44 am

Hi Winterhawk!
Thank you! I'll check that out!

_________________


AKA TheOneBlackRider / An-Marcach
Back to top Go down
View user profile
Black Rider
Admin
avatar

Posts : 715
Join date : 2010-02-11
Location : Germany

Character sheet
Character Name:
Race:
Class:

PostSubject: Re: Sticky Time   Sun Jul 22, 2018 10:09 am

OK, the time is hanging at Month 10 Day 27 Hour 17

I checked the script and don't get 2 things:
1. At the begining, it says void SemiBeat(); and then void main(). Then main runs DelayCommand(600.0, SemiBeat());. At the end ist the complete function of SemiBeat. Is the first SemiBeat call necessary?
2. It should do it every 10 Minutes? If yes, isn't there a module heartbeat entry required? Or does "// Currently it only manually sets the time" mean, that it should be called via commandline IG?

_________________


AKA TheOneBlackRider / An-Marcach
Back to top Go down
View user profile
winterhawk99

avatar

Posts : 28
Join date : 2018-06-03
Age : 51
Location : Texas

PostSubject: Re: Sticky Time   Sun Jul 22, 2018 12:07 pm

Hey BR,

    I'm a bit of a guerilla scripter so I might be wrong on this if so I can check with Mermut she worked with Axe, Nereng and Micheal Darkangel in DLA and was my lead scripter, but I think I got this one.

She defined the function at the bottom of the script. That's where the void SemiBeat () is. As I understand it you may define a function anywhere within a script or connecting script and it will work. The Void SemiBeat (); is the actual use of the function.

On the other part Yes It runs every ten minutes and bump starts the clock if it has stopped. It is completely separate from the modular heartbeat script. it simply restarts the clock every ten minutes and doesn't need any parameters the variables are already hardcoded within the game.

I do know it works and the stopped clock is a persistent irritation to large pws. Its a common problem in NWN once a world goes over a certain number of areas and scripts. This function always seems to correct it. My other major scripter and Ai scripter was RDJparadis all his scripts are so nested with module I have a hard time following it. but both were professional programmers so I usually trusted their instincts. So I wont go into all my heartbeat scripts because there are so many connecting scripts I would have to post 20 scripts on the forums just for everyone to understand it. his script id was _24 mine was _06 you'll see the ids in my load script. mermuts was _mer so if I post scripts you'll know who wrote the original.

Back to top Go down
View user profile http://www.harvestmoonconsortium.com
Black Rider
Admin
avatar

Posts : 715
Join date : 2010-02-11
Location : Germany

Character sheet
Character Name:
Race:
Class:

PostSubject: Re: Sticky Time   Sun Jul 22, 2018 12:49 pm

OK, I'll work that in during the week and will do a server reset for now. (Server is reset!)

_________________


AKA TheOneBlackRider / An-Marcach
Back to top Go down
View user profile
Black Rider
Admin
avatar

Posts : 715
Join date : 2010-02-11
Location : Germany

Character sheet
Character Name:
Race:
Class:

PostSubject: Re: Sticky Time   Sat Jul 28, 2018 1:50 pm

I worked in the code. While I was doing it, the server was down due to another uncontrolable restart by Win10 - me things.

Anyways, new version is 2.4c and time was ticking, when I checked. But a longer time period will show, if this really does the trick (or I made mistakes...  Shocked ).

_________________


AKA TheOneBlackRider / An-Marcach
Back to top Go down
View user profile
winterhawk99

avatar

Posts : 28
Join date : 2018-06-03
Age : 51
Location : Texas

PostSubject: Re: Sticky Time   Fri Aug 03, 2018 9:37 pm

very cool BR. Its Mermut's scripting so I trust it. After a very long time at work I'll be able to play again. I'll be coming home tomorrow, saturday (not sure when so I may be getting home at 11pm) for almost a week. Thank God because doing 12 hour shifts for 10 days is starting to tax my brain. Hope someone can come on to play
Back to top Go down
View user profile http://www.harvestmoonconsortium.com
Sponsored content




PostSubject: Re: Sticky Time   

Back to top Go down
 
Sticky Time
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
DragonLance Chronicles Reborn :: DragonLance Chronicles Re-Born :: Bugs and Errors-
Jump to: