New Zealand
Asked — Edited

Stating The Time

Tidied up the time routine a bit to include AM and PM and some other stuff...



Print ("+---------------------+") Print ("| Announcing the time |") Print ("+---------------------+")

say("The time is ")

IF ($hour>12) $hour_word=$hour-12 $hour_word+":" ENDIF IF ($Minute = 0) Say ("$hour") goto (AM_PM) ELSEIF ($minute 1 and $hour<12) say ("a.m.") ELSE say ("p.m.") ENDIF



Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

United Kingdom

Awesome, this should help Josh out with his project too.

New Zealand

Made a few mods so this can be called over and over again without getting confused


Time |


:Initialise $hour_word=$hour say("The time is " )

IF ($hour>12) $hour_word=$hour-12 Elseif ($hour="0" ) $hour_word=12 ENDIF


IF ($Minute = 0) Say ("$hour" ) goto (AM_PM) ELSEIF ($minute <10) Say ("$minute minutes past $hour_word" ) ELSE say("$hour_word $minute" ) goto(AM_PM) ENDIF halt()

:AM_PM IF ($hour<12) say ("a.m." ) ELSE say ("p.m." ) ENDIF



Much appreciated Tameion for all your scripts! They are great as is and also for modify/adapting/learning to unique circumstances!


i think i'll use this as a wake up alarm for my robot! thank you for sharing. :D


not to mention its beeroclock time!



When trying to run this script I get a error here?


What am I doing wrong?


United Kingdom


say(&quot;The time is &quot; )

IF ($hour&gt;12)

IF ($hour_word=0)

IF ($Minute = 0)
  Say (&quot;$hour_word&quot; )
ELSEIF ($minute &lt;10)
  Say (&quot;$minute minutes past $hour_word&quot; )
  say(&quot;$hour_word $minute&quot; )

IF ($hour&lt;12)
  say (&quot;a.m.&quot; )
  say (&quot;p.m.&quot; )

Removed some redundant code and fixed a couple of errors. To be honest I'm not sure what the $hour_word+":" was for, it didn't look like it was needed.

Hope you don't mind my doing that @tameion



Sorry but recieved an error too.

Syntax Error on line 12. This command requires 0 parameters. You passed one parameters.

I believe line 12 here is

Else say("$hour_word $minute")

United Kingdom

That should be on 2 lines. Else Say("$hour_word $minute")



Works :)

Thanks for the help, very grateful:) I think it's about time I try my hand at a little scripting. I took a couple of programming classes MANY years back so we will see just how much a old man can remember ... lol

Your a good asset to our community, hope you keep up the good work!


New Zealand

@Rich & @ Herr Ball

Hi Guys

Apologies @Herr Ball for the error in the script and thanks @Rich for the modifications.

@Rich - The $hour_word+":" was purely cosmetic and designed to make the printout in the script window look correct. If I remember it worked fine in the version of ARC at the time so I am going to blame the error on @DJSures for upgrading the code. (NOT! - LOL)

I smacked my own hand for this one - If we post we have an obligation to make sure our scripts work.... and I guess that extends to making sure they work in later updated versions of the code.

Fortunately we have a pritty good forum and awesome people like yourself willing to contribute, correct and educate.

Myself I do what I can but life is pritty full on and unless I make time I ain't got time - that's why I need robots and A.I.'s to do 'stuff' for me.....