Forum Discussion

SachaMagne's avatar
11 years ago

[Fixed] How to use properly AlarmHandlde ?

I made a script that use AlarmHandle and the function is never called nor return any compiling/python errors.
I'm a bit puzzled on that one as i need this function to be called every sim hour.


ts = services.time_service()
span = interval_in_sim_hours(1)
alarm_hour= ts.sim_now.hour()
time=create_date_and_time(hours=alarm_hour)
time=ts.sim_timeline.now + span
write_debug_log('time={} , span {}'.format(time,span)) ---> time=02:18:57.280 day:1 week:2 , span 1.00 hours
AlarmHandle(StartMod, DoJob, ts.sim_timeline,time, repeating=True, repeat_interval=span, accurate_repeat=True)


Is there something else to do to activate it ?
Thanks for all feedback!

13 Replies

Replies have been turned off for this discussion
  • alarm_handle is a global and i checked if it was valid elsewhere. The code is here pastebin.com/RtgjV9Hf
  • fixed by declaring def callback (self,_) I have no clue what _ means in that context...
    Anyway thanks Eugi and Ingejones !
  • SimGuruEugi's avatar
    SimGuruEugi
    Icon for EA Staff (Retired) rankEA Staff (Retired)
    11 years ago
    "sachaMagne;13862639" wrote:
    fixed by declaring def callback (self,_) I have no clue what _ means in that context...
    Anyway thanks Eugi and Ingejones !


    Ah, right, the alarm handle is passed back into the callback. Weird, I would have expected errors in lastException.txt due to that.

About The Sims 4 Mods & Custom Content

Find expert tips, troubleshooting help, tutorials for mods and custom content, and The Sims 4 patch files in our forum.15,672 PostsLatest Activity: 4 hours ago