Determine zodiac sign by a day

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
User avatar
Posts: 439
Joined: Mon Jan 26, 2009 7:21 pm

Determine zodiac sign by a day

#1 Post by gas » Tue Apr 17, 2018 3:04 pm

This snippet allow you, giving a day and a month number, to come with the proper Zodiac sign.

It's not as easy as it seems, as zodiac signs are not starting the first day of the year, so you need some math.

Once upon a time, in Ancient Rome, people believed that your behaviour in life could be predicted by the constellation that was rising the day you've born.
Each period of about 30 days a new constellation rise. From that, you got 12 Zodiac Signs.
That simple statement created a pseudo-science called 'ASTROLOGY', that pretend you can predict how an individual will behave and what he'll face day by day based on his zodiac sign, computing the whole stars position.

That freaky fantasy is followed on some degrees by actual people in 2018. A LOT of people.

If you're japanese, is like Blood Type behaviours. If you're Chinese, is like your annual Zodiac animal.
The only difference is the uncanny, incredible INDEPTH they did with that, we talk of computing billions of stars to determine if today you'll face fortune or migraine.

Astrology is fun to follow for many people even today, altough it was quit controversial when Christianity rised in the same lands as Astrology (read: when the roman empire become christian thanks to Emperor Costantino).
Whatever, everyday a LOT of people read Astrology predictions on magazines, did by 'pseudoscientists' called Astrologers.

The common uses people do of astrology (and you can use in your game at will) are:
1) To determine the broad behaviour of an individual (Pisces? You're a sad artist. Leo? You're a passionate girl).
2) To determine the best period of the year
3) To determine if you get along with another individual: each sign have different relationship with the others. For example, Pisces and Taurus could create a deep intellectual relation, Pisces and Scorpio usually are good lovers, and so on.
Those things sound perfect for a dating sim ;).

Each zodiac sign belong to one of 4 elements: Fire, Air, Water, Earth. Ancient romans had fun to categorize them based on a greek principle, with some astounding results.
(To note that this could give a broad relationships between elements, the OPPOSITE way you can think: water and fire signs get along well).
Each zodiac sign also have an ancient symbol, and while some is explicit, some other is easier to understand by knowning exactly what the sign represent.
You can find those symbols in any good type set too, like DejaVu.

Pisces ('fishes': two fishes tied together, forced to swim in circle)
Cancer (commonly is a 'crab', but that's a fun mispell! It's a mythical creature with pincers)
Scorpio ('scorpion')

Taurus ('bull')
Capricorn (a mythical creature with the upper part of an ibex, and the lower part of a sea snake)
Virgo ('virgin', but more something like 'female oracle')

Aquarius (Yeah, strangely enough is an Air sign: is a flying girl, pouring water)
Libra ('balance', but mostly represent 'intuition')
Gemini ('twins', each one trying to undress the brother to dress himself)

Aries ('ram')
Leo ('lion')
Sagittarius ('archer', mostly represented with wings, but in fact is a centaur!)

Add this at the start of your script.

Code: Select all

default monthlen=[0,31,28,31,30,31,30,31,31,30,31,30,31]
default zodiac_name=["capricorn","aquarius","pisces",
default zodiacrange=[[1,21,0],[21,51,1],[51,80,2],
default elerange=[[2,10,6],[1,9,5],[4,0,8],[7,3,11]]
Those defaults compute the lenght of each month (always usefull if you manage a calendar). Note the starting '0', is mandatory (so January is 1, February is 2 and so on).
The latin name of each sign.
The lenght of each sign inside a calendar. Don't change it, that's the actual core.
It also compute the element of each sign.
KEEP FAITH! I did a lot of math to compute the whole thing and is correct. Those are given values you can't compute programmatically, I've used a calendar and a silly TV magazine XD.

Add this function to the start or the end of your script.

Code: Select all

init python:
    def computezodiac(birthday,birthmonth):
        if prevmonth:
            for x in range(prevmonth):
        for i in range(13):
            if zday in zrang:
        return thesign
This function use a terrible math to come with the sign number.
(for pros: the issue stand into how the 'capricorn' sign goes across december to january of the next year, so forcing me creating the third element in the list to retrieve the actual sign in 'zodiacrange').

To determine a sign, and assign it to a variable, use a statement like that:

Code: Select all

    $ myzodiac=computezodiac(25,2)
Where the first number is the day, the second is the month.

What you got is the number of the sign. To know the name, is

Code: Select all

    $ thename=zodiac_name[myzodiac]
    e "Hahaha, I belong to [thename]!"
To come with the element of a sign, add this at the start or end of your script:

Code: Select all

init python:
    def getelem(thesign):
        for g in range(4):
            if thesign in store.elerange[g]:
        return elem
Then, to get the element, you can do this:

Code: Select all

    $ mysign=getelem(myzodiac)
And 'mysign' will be a value like:
0: Water
1: Air
2: Fire
3: Earth

To know the element could be used to greatly simplify how characters get along, to give some skill bonus or any other thing you can figure out.
10 ? "RENPY"
20 GOTO 10


Posts: 27
Joined: Thu Sep 24, 2009 10:42 am
Completed: High School Life:HSL
Deviantart: greeeed

Re: Determine zodiac sign by a day

#2 Post by Hseo » Mon Jul 23, 2018 10:58 am

Thanks, I used to have one with dozen if-else which was a nightmare to used.

Post Reply

Who is online

Users browsing this forum: No registered users