ID:264824
 
Code:
mob/proc
Season()
if(time2text(world.realtime,"MM"==11))
src<<"The current season is: Fall."
if(time2text(world.realtime,"MM"==12))
src<<"The current season is: Winter."


Problem description:

Ok so this proc is supposed to name the current season like if it's november it would tell you it's fall and if it's december it would tell you it's winter, when I log in it tells me "The current season is: Fall. The current season is: Winter." Please help.

Your parenthesis are off.

Also comparing a text string to a number isn't going to work. You need to compare text strings to text strings.
In response to Garthor
What do you mean they are off?
In response to Leggo my Wonder Waffle
I mean your parenthesis need to be rearranged because the order of operations is not what you want.
Your parenthesis are off, as Garthor stated.

Instead, you'll want to find the value of time2text(world.realtime,"MM") and not time2text(world.realtime,"MM"==#).

mob/proc
Season()
if(text2num(time2text(world.realtime,"MM" )) == 11 )
src<<"The current season is: Fall."
if(text2num(time2text(world.realtime,"MM" )) == 12 )
src<<"The current season is: Winter."


I took the liberty to space-out what you made an error on.
Compare and contrast your snippet, and you'll see the parenthesis issue.

EDIT:
Sorry, Garthor pointed something out that I wasn't really concerned about.
In response to Maximus_Alex2003
You still haven't fixed the issue of trying to compare a text string to a number.
In response to Garthor
They're using text2num to convert the text to a number.
In response to Warlord Fred
Last edited: 11/10/10 7:20 pm