This Script Used To Work

 
#1

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

#2

Works for me, what is it not doing?

#3

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?

#4

BTW this script runs in my personality generator. It should not just randomly speaking "happy birthday" unless it is the actual birthday.

#5

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.

#6

Work fine for me. It does nothing. If I change the Natalie one to today's date it says Happy Birthday Natalie, once.

#7

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.

#8

Yep. I agree. Blocky works great.

#9

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

#10

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...