kamaroman68
I found these two scripts in the online section of ez robot script examples. Neither of them are working, not sure why.. Could someone please take a look? This is say time........
if ($hour>12) $hour_word=($hour-12) ELSE $hour_word=$hour endif
if ($hour_word=0) $hour_word=12 endif
if ($Minute = 0) $thetime = $hour_word ELSEif ($minute = 1) $thetime = "one minute past" + $hour_word ELSEif ($minute = 15) $thetime = "quarter past" + $hour_word ELSEif ($minute = 30) $thetime = "half past " + $hour_word ELSEif ($minute 30) $hour_word=$hour_word+1 $minute_word = 60-$minute $thetime = $minute_word + " minutes to " + $hour_word ELSE $thetime = $hour_word + $minute endif
if ($hour 21) $thetime = $thetime + " at night" ELSEif ($hour > 17) $thetime = $thetime+ " in the evening" ELSEif ($hour > 11) $thetime = $thetime + " in the afternoon" endif
$phrase=("The time is " +$thetime) ControlCommand("Script Manager", ScriptStart, "Speak phrase")
Sorry not sure how to format this code for the forum. Chris
Where did you find this? This isn't from an ezrobot example project. What are you wanting to do? It will make more sense to help if you could share what you're expected result is.
I cleaned the code to create this... is this what you wanted to happen?
Thanks for replying. The expected result is for the robot to tell the time thru the ezb when asked. Thanks
Hui, this script is very hard. In germany we have 1-24°clock. I have try this but EZB say "The time is 31". Do you have a script for europeans?
The first 2 if sections are converting it to a 12 hour clock. Just delete them and it will work on a 24 hour clock.
Alan
Oh i have found my old post here. With Blockly you can create your time really easy.
Oh its in german. Translating here ;-) Es ist = It is Stunden und = houers and Minuten = minutes
I have tested this script and disabled the blocks for PC.
Glad that you're enjoying blockly