Forum

Please note that you can subscribe to the individual forums. A subscription for news only covers the news.

Notifications
Clear all

Using time variables  

   RSS

0

First off thanks again for all your help. So I'm trying to get a part of my script to work using a time variable. Basically in the first run I ask when would you like to wake up. 

[question-cSchedule]
Text=Would you like to set a time to wake up?
?Yes=cWakeYes
?No=cWakeNo
NoInputProcedure=cWakeNo

[procedure-cWakeYes]
inputTime!=!WakeupTime,When would you like to wake up and start your day? 

 

But once I set the time variable I have no idea how to use it to call a timer, or procedure or anything really. Basically I just want to make this work:

[timer-]

start=!Wakeuptime

procedure=alarm playlist

 

I've tried a few different things using flags and ifs and even dabbled in a case phrase, but I can't figure it out. 

@subbie53
Hi there, this might not be what you're looking for but I'm gonna assume you have a "Go To Sleep/Bedtime" report set up so maybe you can use something like this :-

 

[report-up from bed]
procedure=checkwakeuptime

 

[procedure-checkwakeuptime]
If=!Wakeuptime<!zzTime
message=You did not wake up early enough!
punish=50

 

Hope this helps. I'm fairly new to dabbling with the script and time variables myself, but it seems like they let you do a lot more interesting things with the program. 

Not exactly. I actually have multiple uses in mind but the basics behind having a timer launch a music playlist that is able to be set in the program and not having to use the script to adjust the time is what I'm looking for. Basically the sub can set a timer for auto actions without having to adjust the script. Thanks though

6 Answers
0

Unfortunately it is not possible to use time variables in timers. It is a technical issue, because of the way that timers work. 

Sven

@admin
So is it possible to use one in any capacity other than inside of a message or text? Say like a duration of a flag?

0

It is possible in many situations. The manual mentions it for every keyword where variables can be used. (Unless I have forgotten to mention it. 😉 )

String variables can be used in almost any kind of text using the {$xxx} syntax. Time variables and counters must be mentioned in the manual. 

Sven

0

yeah it says you can use variable flags in reports, confessions, permission, procedures, timers, and pop ups. However when you scroll down to using a time variable it says "you can use variables in text, messages, etc"  Then there is no example. And since it can't be used in start= or duration= or any spot that uses a time where hh:mm is the only thing that works I'm really having trouble understanding how it can be used in timers. 

 

scrolling further down to using variables in if and notif, it gives an example that I don't really understand. The variables used are not defined and I'm guessing it was used in a permission but that isn't clear as well, so I'm have trouble understanding it. 

 

so essentially what im trying to do is set up a way for the sub to input the times to set their own schedule for listed jobs without having to write their own script. My schedule changes pretty often, and having to go into the script to change the times is fine for me but if I were to encrypt the script for someone else, then they would not be able to change it.

0

I figured it out!! OMG that was a lot of trial and error. I literally was manually setting my computers clock to test the script over and over until I figured out a way to make it out. If anyone is interested here it is:

 

 

[report-Set Schedule]
PreStatus=Normal
Procedure=Schedule

[procedure-Schedule]
message=Ok {$name}, lets set your schedule.
question=cJob1

[question-cJob1]
Text=Would you like to set a time for Job1?
?Yes=cJob1
?No=cJobno
NoInputProcedure=cJobno

[procedure-cJob1]
inputInterval!=!Job1,When would you like to start Job1?

[procedure-cJobno]
set#=#pWake,0

[Timer-Midnight]
start=00:00
setflag=job1

[Flag-Job1]
Duration=00:01
Expireprocedure=Job1case

[procedure-Job1case]    
Case=First
When=!Job1<!zzTime    
job=Jobs1
When=!Job1>!zzTime
setflag=Job1
Case=End

 

0

I'm glad you found a solution. It looks like it should work.

I admit that the manual is a little unclear about the use of time variables. Too much cutting and pasting and too little changing what should be changed. I will fix that. 

In a timer you can manipulate time variables, just as you can in a procedure, a permission, a report, etc. Using the keywords listed for manipulation of time variables. Just as you in your example sets a flag in a timer. But you cannot use time variables to start or stop a timer due to the nature of timers. 

You are right that the examples uses variables that is not defined. It is just to show how to code it. The variables assumes to have been set somewhere else. In a permission as you suggest. Or in a timer. Or one of the other places where variables can be manipulated. 

I hope that this helps you understand it.

Sven

 

0

Yeah that does help a lot.  I had some  issues getting that case statement to work when I used !zztime first followed by the job time.  Im not 100% why that was but once I switched it around it worked out just fine.  I might have had something off as well but once I actually got that script to work I felt so proud of myself lol.  Im even working on expanding it to include days and such.  That little piece of script help me learn so much.  Using flags mixed with cases opens up my script writing to a whole new level.  Also I had a "ah ha!" Moment when I was going over the basics in the demo script and read the add/subpermin for merits.  That was what really inspired this script.  To have a flag check every minute for a change is the one thing that my script was lacking for the longest time to get it to work.