Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

This Script Used To Work

Not sure what happened here. This tiny fun script used to work and now it does not. Anyone interested in taking a look at this.

Code:

IF ($month = 4 And $day =16)
sayezb("happy birthday christian")
sleep(1500)


ElseIf ($month = 4 And $day = 17)
sayezb("happy birthday natalie")
sleep(1500)





ElseIf($month = 6 And $day = 12)
sayezb("happy birthday grace")
sleep(1500)





ElseIF($month = 10 And $day = 21)
sayezb("happy birthday cole")
sleep(1500)

EndIf

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
PRO
USA
#1  
Works for me, what is it not doing?
#2  
Can you explain what its doing on your end? None of the days of the month are equal so it should not work, but it does?
#3  
BTW this script runs in my personality generator. It should not just randomly speaking "happy birthday" unless it is the actual birthday.
#4  
This script keeps looping for me. Shouldn't do that without a Goto and a label.

Try changing all your Elesif to Else like this (however I'm not sure Else will compare two things). If I do this at least it won't keep looping :

Code:


IF ($month = 4 And $day =16)
sayezb("happy birthday christian")
sleep(1500)

Else ($month = 4 And $day = 17)
sayezb("happy birthday natalie")
sleep(1500)

Else ($month = 6 And $day = 12)
sayezb("happy birthday grace")
sleep(1500)

Else ($month = 10 And $day = 21)
sayezb("happy birthday cole")
sleep(1500)

EndIf


Not sure anymore but I think you also may need a space after each else.
#5  
Work fine for me. It does nothing. If I change the Natalie one to today's date it says Happy Birthday Natalie, once.
PRO
Synthiam
#6  
Dave, you have a bunch of ELSE but they should be ELSEIF

I recommend using Blockly to learn how to program first. It's real easy and can't make mistakes.
PRO
Synthiam
#8  
It really helps with logic, for loops and specifically IF conditions. The most number of questions people experience when programming is IF conditions or loops. Blockly helps with that - at least to visually see what you're making
#9  
It gets even more confusing when you have a bunch of "IF, ELSE and ENDIF" statements nested. I used to do this all the time and when something doesn't work it's hard to trace the problem... A while back when I first joined the forum @DJ (you probably don't remember) altered one of my scripts that had multiple nested IF statements. You showed me how to do the same thing without having to nest so many if statements... Funny, it was pretty simple so I am not sure why I never discovered it myself before ... Sometimes you will have to nest IF statements but try to avoid it if there is another way... Anyway, bottom line make your code easy to read so it's easy to follow the logic and debug...
#10  
I guess the thing is, is this used to work. Now it just says it randomly not waiting for its specific date.
#11  
This works perfectly for me...

Code:


IF($month = 4 And $day = 16)
sayezbWait("happy birthday christian")


ElseIf($month = 4 And $day = 17)
sayezbWait("happy birthday natalie")


ElseIf($month = 6 And $day = 12)
sayezbWait("happy birthday grace")


ElseIF($month = 10 And $day = 21)
sayezbWait("happy birthday cole")


EndIf
PRO
USA
#12  
@kamaran68

Is your ARC updated ? If not update and test again.
#13  
As a couple of us have said, your code works. Do you have another script that says "Happy Birthday" attached to a voice command? If so, maybe it's hearing that command and saying "Happy Birthday". If the code you attached is running it would have a name said after the "Happy Birthday"?
#14  
Nope, just that code all in one place, personality generator. When I tell the robot to " stop listening" it pauses speech recognition and starts personality generator. So the machine starts randomly looking around and says hello and a few other things. Then all of s sudden it just starts saying happy birthday and none of the dates match. Weird but I'm not going to worry about it anymore. Thanks