Skipping certain defined text on random selection [SOLVED]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
EmberSH
Newbie
Posts: 7
Joined: Sun Dec 16, 2018 1:23 am
Tumblr: EmberSHx
Deviantart: EmberShadowHawk
Contact:

Skipping certain defined text on random selection [SOLVED]

#1 Post by EmberSH »

Ok - this is gonna be a lot of code because I don't know where the problem is.

I'm using the code in the first and second box to access the defined text in the third. It's working for the named and Fire cards but not for Earth Air or Water. I can't work out what the problem is and it's driving me insane.
(Don't worry about the xNumber codes, they were just so I could see what was working and what wasn't)

(The same problem is happening on two other chunks that follow the same format as the first box but since it's with the same cards I didn't want to stick more code than I had to - I know it's already a lot to look through)

(The problem isn't the jump, I just cut out the in between sections because this is one of three drawn cards)

Code: Select all

default t1 = 0
default Tpast = "x"

label TarotPast:

    $ t1 = renpy.random.randint(1, 78)
    if t1 == 1:
        $ Tpast = "The Fool"
    elif t1 == 2:
        $ Tpast = "The Magician"
    elif t1 == 3:
        $ Tpast = "The High Priestess"
    elif t1 == 4:
        $ Tpast = "The Empress"
    elif t1 == 5:
        $ Tpast = "The Emperor"
    elif t1 == 6:
        $ Tpast = "The Heirophant"
    elif t1 == 7:
        $ Tpast = "The Lovers"
    elif t1 == 8:
        $ Tpast = "The Chariot"
    elif t1 == 9:
        $ Tpast = "Justice"
    elif t1 == 10:
        $ Tpast = "The Hermit"
    elif t1 == 11:
        $ Tpast = "The Wheel of Fortune"
    elif t1 == 12:
        $ Tpast = "Strength"
    elif t1 == 13:
        $ Tpast = "The Hanged Man"
    elif t1 == 14:
        $ Tpast = "Death"
    elif t1 == 15:
        $ Tpast = "Temperance"
    elif t1 == 16:
        $ Tpast = "The Devil"
    elif t1 == 17:
        $ Tpast = "The Tower"
    elif t1 == 18:
        $ Tpast = "The Star"
    elif t1 == 19:
        $ Tpast = "The Moon"
    elif t1 == 20:
        $ Tpast = "The Sun"
    elif t1 == 21:
        $ Tpast = "Judgement"
    elif t1 == 22:
        $ Tpast = "The World"
    elif t1 == 23:
        $ Tpast = "Ace of Fire"
    elif t1 == 24:
        $ Tpast = "Two of Fire"
    elif t1 == 25:
        $ Tpast = "Three of Fire"
    elif t1 == 26:
        $ Tpast = "Four of Fire"
    elif t1 == 27:
        $ Tpast = "Five of Fire"
    elif t1 == 28:
        $ Tpast = "Six of Fire"
    elif t1 == 29:
        $ Tpast = "Seven of Fire"
    elif t1 == 30:
        $ Tpast = "Eight of Fire"
    elif t1 == 31:
        $ Tpast = "Nine of Fire"
    elif t1 == 32:
     $ Tpast = "Ten of Fire"
    elif t1 == 33:
     $ Tpast = "Princess of Fire"
    elif t1 == 34:
     $ Tpast = "Prince of Fire"
    elif t1 == 35:
     $ Tpast = "Queen of Fire"
    elif t1 == 36:
     $ Tpast = "King of Fire"
    elif t1 == 37:
     $ Tpast = "Ace of Water"
    elif t1 == 38:
     $ Tpast = "Two of Water"
    elif t1 == 39:
     $ Tpast = "Three of Water"
    elif t1 == 40:
     $ Tpast = "Four of Water"
    elif t1 == 41:
     $ Tpast = "Five of Water"
    elif t1 == 42:
     $ Tpast = "Six of Water"
    elif t1 == 43:
     $ Tpast = "Seven of Water"
    elif t1 == 44:
     $ Tpast = "Eight of Water"
    elif t1 == 45:
     $ Tpast = "Nine of Water"
    elif t1 == 46:
     $ Tpast = "Ten of Water"
    elif t1 == 47:
     $ Tpast = "Princess of Water"
    elif t1 == 48:
     $ Tpast = "Prince of Water"
    elif t1 == 49:
     $ Tpast = "Queen of Water"
    elif t1 == 50:
     $ Tpast = "King of Water"
    elif t1 == 51:
     $ Tpast = "Ace of Air"
    elif t1 == 52:
     $ Tpast = "Two of Air"
    elif t1 == 53:
     $ Tpast = "Three of Air"
    elif t1 == 54:
     $ Tpast = "Four of Air"
    elif t1 == 55:
     $ Tpast = "Five of Air"
    elif t1 == 56:
     $ Tpast = "Six of Air"
    elif t1 == 57:
     $ Tpast = "Seven of Air"
    elif t1 == 58:
     $ Tpast = "Eight of Air"
    elif t1 == 59:
     $ Tpast = "Nine of Air"
    elif t1 == 60:
     $ Tpast = "Ten of Air"
    elif t1 == 61:
     $ Tpast = "Princess of Air"
    elif t1 == 62:
     $ Tpast = "Prince of Air"
    elif t1 == 63:
     $ Tpast = "Queen of Air"
    elif t1 == 64:
     $ Tpast = "King of Air"
    elif t1 == 65:
     $ Tpast = "Ace of Earth"
    elif t1 == 66:
     $ Tpast = "Two of Earth"
    elif t1 == 67:
     $ Tpast = "Three of Earth"
    elif t1 == 68:
     $ Tpast = "Four of Earth"
    elif t1 == 69:
     $ Tpast = "Five of Earth"
    elif t1 == 70:
     $ Tpast = "Six of Earth"
    elif t1 == 71:
     $ Tpast = "Seven of Earth"
    elif t1 == 72:
     $ Tpast = "Eight of Earth"
    elif t1 == 73:
     $ Tpast = "Nine of Earth"
    elif t1 == 74:
     $ Tpast = "Ten of Earth"
    elif t1 == 75:
     $ Tpast = "Princess of Earth"
    elif t1 == 76:
     $ Tpast = "Prince of Earth"
    elif t1 == 77:
     $ Tpast = "Queen of Earth"
    elif t1 == 78:
     $ Tpast = "King of Earth"

jump TarotPresent

Code: Select all

label TPastCard1:
    if Tpast == "The Fool":
        e "[Foolp1]"
        e "[Foolp2]"
    elif Tpast == "The Magician":
        e "[Magicianp1]"
        e "[Magicianp2]"
    elif Tpast == "The High Priestess":
        e "[Priestessp1]"
        e "[Priestessp2]"
    elif Tpast == "The Empress":
        e "[Empressp1]"
        e "[Empressp2]"
    elif Tpast == "The Emperor":
        e "[Emperorp1]"
        e "[Emperorp2]"
    elif Tpast == "The Heirophant":
        e "[Heirophantp1]"
        e "[Heirophantp2]"
    elif Tpast == "The Lovers":
        e "[Loversp1]"
        e "[Loversp2]"
    elif Tpast == "The Chariot":
        e "[Chariotp1]"
        e "[Chariotp1]"
    elif Tpast == "Justice":
        e "[Justicep1]"
        e "[Justicep2]"
    elif Tpast == "The Hermit":
        e "[Hermitp1]"
        e "[Hermitp2]"
    elif Tpast == "The Wheel of Fortune":
        e "[Fortunep1]"
        e "[Fortunep2]"
    elif Tpast == "Strength":
        e "[Strengethp1]"
        e "[Strengthp2]"
    elif Tpast == "The Hanged Man":
        e "[Hangedp1]"
        e "[Hangedp2]"
    elif Tpast == "Death":
        e "[Deathp1]"
        e "[Deathp2]"
    elif Tpast == "Temperance":
        e "[Temperancep1]"
        e "[Temperancep2]"
    elif Tpast == "The Devil":
        e "[Devilp1]"
        e "[Devilp2]"
    elif Tpast == "The Tower":
        e "[Towerp1]"
        e "[Towerp2]"
    elif Tpast == "The Star":
        e "[Starp1]"
        e "[Starp2]"
    elif Tpast == "The Moon":
        e "[Moonp1]"
        e "[Moonp2]"
    elif Tpast == "The Sun":
        e "[Sunp1]"
        e "[Sunp2]"
    elif Tpast == "Judgement":
        e "[Judgementp1]"
        e "[Judgementp2]"
    elif Tpast == "The World":
        e "[Worldp1]"
        e "[Worldp2]"
    elif Tpast == "Ace of Fire":
        e "[fire1p1]"
        e "[fire1p2]"
    elif Tpast == "Two of Fire":
        e "[fire2p1]"
        e "[fire2p2]"
    elif Tpast == "Three of Fire":
        e "[fire3p1]"
        e "[fire3p2]"
    elif Tpast == "Four of Fire":
        e "[fire4p1]"
        e "[fire4p2]"
    elif Tpast == "Five of Fire":
        e "[fire5p1]"
        e "[fire5p2]"
    elif Tpast == "Six of Fire":
        e "[fire6p1]"
        e "[fire6p2]"
    elif Tpast == "Seven of Fire":
        e "[fire7p1]"
        e "[fire7p2]"
    elif Tpast == "Eight of Fire":
        e "[fire8p1]"
        e "[fire8p2]"
    elif Tpast == "Nine of Fire":
        e "[fire9p1]"
        e "[fire9p2]"
    elif Tpast == "Ten of Fire":
        e "[fire10p1]"
        e "[fire10p2]"
    elif Tpast == "Princess of Fire":
        e "[fireap1]"
        e "[fireap2]"
    elif Tpast == "Prince of Fire":
        e "[firebp1]"
        e "[firebp2]"
    elif Tpast == "Queen of Fire":
        e "[firecp1]"
        e "[firecp2]"
    elif Tpast == "King of Fire":
        e "[firedp1]"
        e "[firedp1]"
    elif Tpast == "Ace of water":
        e "[water1p1]"
        e "[water1p2]"
    elif Tpast == "Two of water":
        e "[water2p1]"
        e "[water2p2]"
    elif Tpast == "Three of water":
        e "[water3p1]"
        e "[water3p2]"
    elif Tpast == "Four of water":
        e "[water4p1]"
        e "[water4p2]"
    elif Tpast == "Five of water":
        e "[water5p1]"
        e "[water5p2]"
    elif Tpast == "Six of water":
        e "[water6p1]"
        e "[water6p2]"
    elif Tpast == "Seven of water":
        e "[water7p1]"
        e "[water7p2]"
    elif Tpast == "Eight of water":
        e "[water8p1]"
        e "[water8p2]"
    elif Tpast == "Nine of water":
        e "[water9p1]"
        e "[water9p2]"
    elif Tpast == "Ten of water":
        e "[water10p1]"
        e "[water10p2]"
    elif Tpast == "Princess of water":
        e "[waterap1]"
        e "[waterap2]"
    elif Tpast == "Prince of water":
        e "[waterbp1]"
        e "[waterbp2]"
    elif Tpast == "Queen of water":
        e "[watercp1]"
        e "[watercp2]"
    elif Tpast == "King of water":
        e "[waterdp1]"
        e "[waterdp1]"
    elif Tpast == "Ace of air":
        e "[air1p1]"
        e "[air1p2]"
    elif Tpast == "Two of air":
        e "[air2p1]"
        e "[air2p2]"
    elif Tpast == "Three of air":
        e "[air3p1]"
        e "[air3p2]"
    elif Tpast == "Four of air":
        e "[air4p1]"
        e "[air4p2]"
    elif Tpast == "Five of air":
        e "[air5p1]"
        e "[air5p2]"
    elif Tpast == "Six of air":
        e "[air6p1]"
        e "[air6p2]"
    elif Tpast == "Seven of air":
        e "[air7p1]"
        e "[air7p2]"
    elif Tpast == "Eight of air":
        e "[air8p1]"
        e "[air8p2]"
    elif Tpast == "Nine of air":
        e "[air9p1]"
        e "[air9p2]"
    elif Tpast == "Ten of air":
        e "[air10p1]"
        e "[air10p2]"
    elif Tpast == "Princess of air":
        e "[airap1]"
        e "[airap2]"
    elif Tpast == "Prince of air":
        e "[airbp1]"
        e "[airbp2]"
    elif Tpast == "Queen of air":
        e "[aircp1]"
        e "[aircp2]"
    elif Tpast == "King of air":
        e "[airdp1]"
        e "[airdp1]"
    elif Tpast == "Ace of earth":
        e "[earth1p1]"
        e "[earth1p2]"
    elif Tpast == "Two of earth":
        e "[earth2p1]"
        e "[earth2p2]"
    elif Tpast == "Three of earth":
        e "[earth3p1]"
        e "[earth3p2]"
    elif Tpast == "Four of earth":
        e "[earth4p1]"
        e "[earth4p2]"
    elif Tpast == "Five of earth":
        e "[earth5p1]"
        e "[earth5p2]"
    elif Tpast == "Six of earth":
        e "[earth6p1]"
        e "[earth6p2]"
    elif Tpast == "Seven of earth":
        e "[earth7p1]"
        e "[earth7p2]"
    elif Tpast == "Eight of earth":
        e "[earth8p1]"
        e "[earth8p2]"
    elif Tpast == "Nine of earth":
        e "[earth9p1]"
        e "[earth9p2]"
    elif Tpast == "Ten of earth":
        e "[earth10p1]"
        e "[earth10p2]"
    elif Tpast == "Princess of earth":
        e "[earthap1]"
        e "[earthap2]"
    elif Tpast == "Prince of earth":
        e "[earthbp1]"
        e "[earthbp2]"
    elif Tpast == "Queen of earth":
        e "[earthcp1]"
        e "[earthcp2]"
    elif Tpast == "King of earth":
        e "[earthdp1]"
        e "[earthdp1]"
        
        

Code: Select all

define Foolp1 = "x12"
define Foolp2 = "x1"
define FoolPast1 = "x12"
define FoolPast2 = "x1"
define FoolPresent1 = "x12"
define FoolPresent2 = "x1"
define FoolFuture1 = "x12"
define FoolFuture2 = "x1"

define Magicianp1 = "x2"
define Magicianp2 = "x22"
define MagicianPast1 = "x2"
define MagicianPast2 = "x22"
define MagicianPresent1 = "x2"
define MagicianPresent2 = "x22"
define MagicianFuture1 = "x2"
define MagicianFuture2 = "x22"

define Preistessp1 = "x32"
define Preistessp2 = "x3"
define PreistessPast1 = "x32"
define PreistessPast2 = "x32"
define PreistessPresent1 = "x32"
define PreistessPresent2 = "x3"
define PreistessFuture1 = "x32"
define PreistessFuture2 = "x32"

define Empressp1 = "x4"
define Empressp2 = "x42"
define EmpressPast1 = "x4"
define EmpressPast2 = "x42"
define EmpressPresent1 = "x4"
define EmpressPresent2 = "x42"
define EmpressFuture1 = "x4"
define EmpressFuture2 = "x42"

define Emperorp1 = "x52"
define Emperorp2 = "x5"
define EmperorPast1 = "x52"
define EmperorPast2 = "x5"
define EmperorPresent1 = "x52"
define EmperorPresent2 = "x5"
define EmperorFuture1 = "x52"
define EmperorFuture2 = "x5"

define Heirophantp1 = "x6"
define Heirophantp2 = "x62"
define HeirophantPast1 = "x6"
define HeirophantPast2 = "x62"
define HeirophantPresent1 = "x6"
define HeirophantPresent2 = "x62"
define HeirophantFuture1 = "x6"
define HeirophantFuture2 = "x62"

define Loversp1 = "x72"
define Loversp2 = "x7"
define LoversPast1 = "x72"
define LoversPast2 = "x7"
define LoversPresent1 = "x72"
define LoversPresent2 = "x7"
define LoversFuture1 = "x72"
define LoversFuture2 = "x7"

define Chariotp1 = "x8"
define Chariotp2 = "x82"
define ChariotPast1 = "x8"
define ChariotPast2 = "x82"
define ChariotPresent1 = "x8"
define ChariotPresent2 = "x82"
define ChariotFuture1 = "x8"
define ChariotFuture2 = "x82"

define Justicep1 = "x92"
define Justicep2 = "x9"
define JusticePast1 = "x92"
define JusticePast2 = "x9"
define JusticePresent1 = "x92"
define JusticePresent2 = "x9"
define JusticeFuture1 = "x92"
define JusticeFuture2 = "x9"

define Hermitp1 = "x10"
define Hermitp2 = "x102"
define HermitPast1 = "x10"
define HermitPast2 = "x102"
define HermitPresent1 = "x10"
define HermitPresent2 = "x102"
define HermitFuture1 = "x10"
define HermitFuture2 = "x102"

define Fortunep1 = "x112"
define Fortunep2 = "x11"
define FortunePast1 = "x112"
define FortunePast2 = "x11"
define FortunePresent1 = "x112"
define FortunePresent2 = "x11"
define FortuneFuture1 = "x112"
define FortuneFuture2 = "x11"

define Strengthp1 = "x12"
define Strengthp2 = "x122"
define StrengthPast1 = "x12"
define StrengthPast2 = "x122"
define StrengthPresent1 = "x12"
define StrengthPresent2 = "x122"
define StrengthFuture1 = "x12"
define StrengthFuture2 = "x122"


define Hangedp1 = "x132"
define Hangedp2 = "x13"
define HangedPast1 = "x132"
define HangedPast2 = "x13"
define HangedPresent1 = "x132"
define HangedPresent2 = "x13"
define HangedFuture1 = "x132"
define HangedFuture2 = "x13"

define Deathp1 = "x14"
define Deathp2 = "x142"
define DeathPast1 = "x14"
define DeathPast2 = "x142"
define DeathPresent1 = "x14"
define DeathPresent2 = "x142"
define DeathFuture1 = "x14"
define DeathFuture2 = "x142"

define Temperancep1 = "x152"
define Temperancep2 = "x15"
define TemperancePast1 = "x152"
define TemperancePast2 = "x15"
define TemperancePresent1 = "x152"
define TemperancePresent2 = "x15"
define TemperanceFuture1 = "x152"
define TemperanceFuture2 = "x15"

define Devilp1 = "x16"
define Devilp2 = "x162"
define DevilPast1 = "x16"
define DevilPast2 = "x162"
define DevilPresent1 = "x16"
define DevilPresent2 = "x162"
define DevilFuture1 = "x16"
define DevilFuture2 = "x162"

define Towerp1 = "x172"
define Towerp2 = "x17"
define TowerPast1 = "x172"
define TowerPast2 = "x17"
define TowerPresent1 = "x172"
define TowerPresent2 = "x17"
define TowerFuture1 = "x172"
define TowerFuture2 = "x17"

define Starp1 = "x18"
define Starp2 = "x182"
define StarPast1 = "x18"
define StarPast2 = "x182"
define StarPresent1 = "x18"
define StarPresent2 = "x182"
define StarFuture1 = "x18"
define StarFuture2 = "x182"

define Moonp1 = "x192"
define Moonp2 = "x19"
define MoonPast1 = "x192"
define MoonPast2 = "x19"
define MoonPresent1 = "x192"
define MoonPresent2 = "x19"
define MoonFuture1 = "x192"
define MoonFuture2 = "x19"

define Sunp1 = "x20"
define Sunp2 = "x202"
define SunPast1 = "x20"
define SunPast2 = "x202"
define SunPresent1 = "x20"
define SunPresent2 = "x202"
define SunFuture1 = "x20"
define SunFuture2 = "x202"

define Judgementp1 = "x212"
define Judgementp2 = "x21"
define JudgementPast1 = "x212"
define JudgementPast2 = "x21"
define JudgementPresent1 = "x212"
define JudgementPresent2 = "x21"
define JudgementFuture1 = "x21"
define JudgementFuture2 = "x212"

define Worldp1 = "x22"
define Worldp2 = "x222"
define WorldPast1 = "x22"
define WorldPast2 = "x222"
define WorldPresent1 = "x22"
define WorldPresent2 = "x222"
define WorldFuture1 = "x22"
define WorldFuture2 = "x222"

define fire1p1 = "x232"
define fire1p2 = "x23"
define fire1Past1 = "x232"
define fire1Past2 = "x23"
define fire1Present1 = "x232"
define fire1Present2 = "x23"
define fire1Future1 = "x232"
define fire1Future2 = "x23"

define fire2p1 = "x24"
define fire2p2 = "x242"
define fire2Past1 = "x24"
define fire2Past2 = "x242"
define fire2Present1 = "x24"
define fire2Present2 = "x242"
define fire2Future1 = "x24"
define fire2Future2 = "x242"

define fire3p1 = "x252"
define fire3p2 = "x25"
define fire3Past1 = "x252"
define fire3Past2 = "x25"
define fire3Present1 = "x252"
define fire3Present2 = "x25"
define fire3Future1 = "x252"
define fire3Future2 = "x25"

define fire4p1 = "x26"
define fire4p2 = "x262"
define fire4Past1 = "x26"
define fire4Past2 = "x262"
define fire4Present1 = "x26"
define fire4Present2 = "x262"
define fire4Future1 = "x26"
define fire4Future2 = "x262"

define fire5p1 = "x272"
define fire5p2 = "x27"
define fire5Past1 = "x272"
define fire5Past2 = "x27"
define fire5Present1 = "x272"
define fire5Present2 = "x27"
define fire5Future1 = "x272"
define fire5Future2 = "x27"

define fire6p1 = "x28"
define fire6p2 = "x282"
define fire6Past1 = "x28"
define fire6Past2 = "x282"
define fire6Present1 = "x28"
define fire6Present2 = "x282"
define fire6Future1 = "x28"
define fire6Future2 = "x282"

define fire7p1 = "x292"
define fire7p2 = "x29"
define fire7Past1 = "x292"
define fire7Past2 = "x29"
define fire7Present1 = "x292"
define fire7Present2 = "x29"
define fire7Future1 = "x292"
define fire7Future2 = "x29"

define fire8p1 = "x30"
define fire8p2 = "x302"
define fire8Past1 = "x30"
define fire8Past2 = "x302"
define fire8Present1 = "x30"
define fire8Present2 = "x302"
define fire8Future1 = "x30"
define fire8Future2 = "x302"

define fire9p1 = "x312"
define fire9p2 = "x31"
define fire9Past1 = "x312"
define fire9Past2 = "x31"
define fire9Present1 = "x312"
define fire9Present2 = "x31"
define fire9Future1 = "x312"
define fire9Future2 = "x31"

define fire10p1 = "x32"
define fire10p2 = "x322"
define fire10Past1 = "x32"
define fire10Past2 = "x322"
define fire10Present1 = "x32"
define fire10Present2 = "x322"
define fire10Future1 = "x32"
define fire10Future2 = "x322"

define fireap1 = "x332"
define fireap2 = "x33"
define fireaPast1 = "x332"
define fireaPast2 = "x33"
define fireaPresent1 = "x332"
define fireaPresent2 = "x33"
define fireaFuture1 = "x332"
define fireaFuture2 = "x33"

define firebp1 = "x34"
define firebp2 = "x342"
define firebPast1 = "x34"
define firebPast2 = "x342"
define firebPresent1 = "x34"
define firebPresent2 = "x342"
define firebFuture1 = "x34"
define firebFuture2 = "x342"

define firecp1 = "x352"
define firecp2 = "x35"
define firecPast1 = "x352"
define firecPast2 = "x35"
define firecPresent1 = "x352"
define firecPresent2 = "x35"
define firecFuture1 = "x352"
define firecFuture2 = "x35"

define firedp1 = "x36"
define firedp2 = "x362"
define firedPast1 = "x36"
define firedPast2 = "x362"
define firedPresent1 = "x36"
define firedPresent2 = "x362"
define firedFuture1 = "x36"
define firedFuture2 = "x362"

define water1p1 = "x372"
define water1p2 = "x37"
define water1Past1 = "x372"
define water1Past2 = "x37"
define water1Present1 = "x372"
define water1Present2 = "x37"
define water1Future1 = "x372"
define water1Future2 = "x37"

define water2p1 = "x38"
define water2p2 = "x382"
define water2Past1 = "x38"
define water2Past2 = "x382"
define water2Present1 = "x38"
define water2Present2 = "x382"
define water2Future1 = "x38"
define water2Future2 = "x382"

define water3p1 = "x392"
define water3p2 = "x39"
define water3Past1 = "x392"
define water3Past2 = "x39"
define water3Present1 = "x392"
define water3Present2 = "x39"
define water3Future1 = "x392"
define water3Future2 = "x39"

define water4p1 = "x40"
define water4p2 = "x402"
define water4Past1 = "x40"
define water4Past2 = "x402"
define water4Present1 = "x40"
define water4Present2 = "x402"
define water4Future1 = "x40"
define water4Future2 = "x402"

define water5p1 = "x412"
define water5p2 = "x41"
define water5Past1 = "x412"
define water5Past2 = "x41"
define water5Present1 = "x412"
define water5Present2 = "x41"
define water5Future1 = "x412"
define water5Future2 = "x41"

define water6p1 = "x42"
define water6p2 = "x422"
define water6Past1 = "x42"
define water6Past2 = "x422"
define water6Present1 = "x42"
define water6Present2 = "x422"
define water6Future1 = "x42"
define water6Future2 = "x422"

define water7p1 = "x432"
define water7p2 = "x43"
define water7Past1 = "x432"
define water7Past2 = "x43"
define water7Present1 = "x432"
define water7Present2 = "x43"
define water7Future1 = "x432"
define water7Future2 = "x43"

define water8p1 = "x44"
define water8p2 = "x442"
define water8Past1 = "x44"
define water8Past2 = "x442"
define water8Present1 = "x44"
define water8Present2 = "x442"
define water8Future1 = "x44"
define water8Future2 = "x442"

define water9p1 = "x452"
define water9p2 = "x45"
define water9Past1 = "x452"
define water9Past2 = "x45"
define water9Present1 = "x452"
define water9Present2 = "x45"
define water9Future1 = "x452"
define water9Future2 = "x45"

define water10p1 = "x46"
define water10p2 = "x462"
define water10Past1 = "x46"
define water10Past2 = "x462"
define water10Present1 = "x46"
define water10Present2 = "x462"
define water10Future1 = "x46"
define water10Future2 = "x462"

define waterap1 = "x472"
define waterap2 = "x47"
define wateraPast1 = "x472"
define wateraPast2 = "x47"
define wateraPresent1 = "x47"
define wateraPresent2 = "x472"
define wateraFuture1 = "x472"
define wateraFuture2 = "x47"

define waterbp1 = "x48"
define waterbp2 = "x482"
define waterbPast1 = "x48"
define waterbPast2 = "x482"
define waterbPresent1 = "x48"
define waterbPresent2 = "x482"
define waterbFuture1 = "x48"
define waterbFuture2 = "x482"

define watercp1 = "x492"
define watercp2 = "x49"
define watercPast1 = "x492"
define watercPast2 = "x49"
define watercPresent1 = "x492"
define watercPresent2 = "x49"
define watercFuture1 = "x492"
define watercFuture2 = "x49"

define waterdp1 = "x50"
define waterdp2 = "x502"
define waterdPast1 = "x50"
define waterdPast2 = "x502"
define waterdPresent1 = "x50"
define waterdPresent2 = "x502"
define waterdFuture1 = "x50"
define waterdFuture2 = "x502"

define air1p1 = "x512"
define air1p2 = "x51"
define air1Past1 = "x512"
define air1Past2 = "x51"
define air1Present1 = "x512"
define air1Present2 = "x51"
define air1Future1 = "x512"
define air1Future2 = "x51"

define air2p1 = "x52"
define air2p2 = "x522"
define air2Past1 = "x52"
define air2Past2 = "x522"
define air2Present1 = "x52"
define air2Present2 = "x522"
define air2Future1 = "x52"
define air2Future2 = "x522"

define air3p1 = "x532"
define air3p2 = "x53"
define air3Past1 = "x532"
define air3Past2 = "x53"
define air3Present1 = "x532"
define air3Present2 = "x53"
define air3Future1 = "x532"
define air3Future2 = "x53"

define air4p1 = "x54"
define air4p2 = "x542"
define air4Past1 = "x54"
define air4Past2 = "x542"
define air4Present1 = "x54"
define air4Present2 = "x542"
define air4Future1 = "x54"
define air4Future2 = "x542"

define air5p1 = "x552"
define air5p2 = "x55"
define air5Past1 = "x552"
define air5Past2 = "x55"
define air5Present1 = "x552"
define air5Present2 = "x55"
define air5Future1 = "x552"
define air5Future2 = "x55"

define air6p1 = "x56"
define air6p2 = "x562"
define air6Past1 = "x56"
define air6Past2 = "x562"
define air6Present1 = "x56"
define air6Present2 = "x562"
define air6Future1 = "x56"
define air6Future2 = "x562"

define air7p1 = "x572"
define air7p2 = "x57"
define air7Past1 = "x572"
define air7Past2 = "x57"
define air7Present1 = "x572"
define air7Present2 = "x57"
define air7Future1 = "x572"
define air7Future2 = "x57"

define air8p1 = "x58"
define air8p2 = "x582"
define air8Past1 = "x58"
define air8Past2 = "x582"
define air8Present1 = "x58"
define air8Present2 = "x582"
define air8Future1 = "x58"
define air8Future2 = "x582"

define air9p1 = "x592"
define air9p2 = "x59"
define air9Past1 = "x592"
define air9Past2 = "x59"
define air9Present1 = "x592"
define air9Present2 = "x59"
define air9Future1 = "x592"
define air9Future2 = "x59"

define air10p1 = "x60"
define air10p2 = "x602"
define air10Past1 = "x60"
define air10Past2 = "x602"
define air10Present1 = "x60"
define air10Present2 = "x602"
define air10Future1 = "x60"
define air10Future2 = "x602"

define airap1 = "x612"
define airap2 = "x61"
define airaPast1 = "x612"
define airaPast2 = "x61"
define airaPresent1 = "x612"
define airaPresent2 = "x61"
define airaFuture1 = "x612"
define airaFuture2 = "x61"

define airbp1 = "x62"
define airbp2 = "x622"
define airbPast1 = "x62"
define airbPast2 = "x622"
define airbPresent1 = "x62"
define airbPresent2 = "x622"
define airbFuture1 = "x62"
define airbFuture2 = "x622"

define aircp1 = "x632"
define aircp2 = "x63"
define aircPast1 = "x632"
define aircPast2 = "x63"
define aircPresent1 = "x632"
define aircPresent2 = "x63"
define aircFuture1 = "x632"
define aircFuture2 = "x63"

define airdp1 = "x64"
define airdp2 = "x642"
define airdPast1 = "x64"
define airdPast2 = "x642"
define airdPresent1 = "x64"
define airdPresent2 = "x642"
define airdFuture1 = "x64"
define airdFuture2 = "x642"

define earth1p1 = "x652"
define earth1p2 = "x65"
define earth1Past1 = "x652"
define earth1Past2 = "x65"
define earth1Present1 = "x652"
define earth1Present2 = "x65"
define earth1Future1 = "x652"
define earth1Future2 = "x65"

define earth2p1 = "x66"
define earth2p2 = "x662"
define earth2Past1 = "x66"
define earth2Past2 = "x662"
define earth2Present1 = "x66"
define earth2Present2 = "x662"
define earth2Future1 = "x66"
define earth2Future2 = "x662"

define earth3p1 = "x672"
define earth3p2 = "x67"
define earth3Past1 = "x672"
define earth3Past2 = "x67"
define earth3Present1 = "x672"
define earth3Present2 = "x67"
define earth3Future1 = "x672"
define earth3Future2 = "x67"

define earth4p1 = "x68"
define earth4p2 = "x682"
define earth4Past1 = "x682"
define earth4Past2 = "x68"
define earth4Present1 = "x682"
define earth4Present2 = "x68"
define earth4Future1 = "x682"
define earth4Future2 = "x68"

define earth5p1 = "x692"
define earth5p2 = "x692"
define earth5Past1 = "x69"
define earth5Past2 = "x692"
define earth5Present1 = "x69"
define earth5Present2 = "x692"
define earth5Future1 = "x69"
define earth5Future2 = "x692"

define earth6p1 = "x702"
define earth6p2 = "x70"
define earth6Past1 = "x702"
define earth6Past2 = "x70"
define earth6Present1 = "x702"
define earth6Present2 = "x70"
define earth6Future1 = "x702"
define earth6Future2 = "x70"

define earth7p1 = "x71"
define earth7p2 = "x712"
define earth7Past1 = "x71"
define earth7Past2 = "x712"
define earth7Present1 = "x71"
define earth7Present2 = "x712"
define earth7Future1 = "x71"
define earth7Future2 = "x712"

define earth8p1 = "x722"
define earth8p2 = "x72"
define earth8Past1 = "x722"
define earth8Past2 = "x72"
define earth8Present1 = "x722"
define earth8Present2 = "x72"
define earth8Future1 = "x722"
define earth8Future2 = "x72"

define earth9p1 = "x73"
define earth9p2 = "x732"
define earth9Past1 = "x73"
define earth9Past2 = "x732"
define earth9Present1 = "x73"
define earth9Present2 = "x732"
define earth9Future1 = "x73"
define earth9Future2 = "x732"

define earth10p1 = "x742"
define earth10p2 = "x74"
define earth10Past1 = "x742"
define earth10Past2 = "x74"
define earth10Present1 = "x742"
define earth10Present2 = "x74"
define earth10Future1 = "x742"
define earth10Future2 = "x74"

define earthap1 = "x75"
define earthap2 = "x752"
define earthaPast1 = "x75"
define earthaPast2 = "x752"
define earthaPresent1 = "x75"
define earthaPresent2 = "x752"
define earthaFuture1 = "x75"
define earthaFuture2 = "x752"

define earthbp1 = "x762"
define earthbp2 = "x76"
define earthbPast1 = "x762"
define earthbPast2 = "x76"
define earthbPresent1 = "x762"
define earthbPresent2 = "x76"
define earthbFuture1 = "x762"
define earthbFuture2 = "x76"

define earthcp1 = "x77"
define earthcp2 = "x772"
define earthcPast1 = "x77"
define earthcPast2 = "x772"
define earthcPresent1 = "x77"
define earthcPresent2 = "x772"
define earthcFuture1 = "x77"
define earthcFuture2 = "x772"

define earthdp1 = "x782"
define earthdp2 = "x78"
define earthdPast1 = "x782"
define earthdPast2 = "x78"
define earthdPresent1 = "x782"
define earthdPresent2 = "x78"
define earthdFuture1 = "x782"
define earthdFuture2 = "x78"
Last edited by EmberSH on Mon Jan 07, 2019 3:56 pm, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Skipping certain defined text on random selection

#2 Post by trooper6 »

The answer to your question is easy.
It is a spelling error.

In the first block of code you name the Air cards things like "Nine of Air" but in the second block you check for "Nine of air" -- you changed the spelling so they aren't the same things. So fixing your spelling so they are consistent will fix your problem.

All of that said. This code is massive...and I am 100% certain there is a better and more efficient way of doing what you want to do. The only thing is...I don't exactly know what your ultimate goal is with this code. Could you explain what you ultimately want to do and maybe I could suggest a much shorter and cleaner set of code?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
EmberSH
Newbie
Posts: 7
Joined: Sun Dec 16, 2018 1:23 am
Tumblr: EmberSHx
Deviantart: EmberShadowHawk
Contact:

Re: Skipping certain defined text on random selection

#3 Post by EmberSH »

Thank you! That was it! <3

You would be a lifesaver if you could.

It's for doing Tarot spreads. The engine is picking one of 78 cards for each of three locations then accessing the meaning of that card and then that card in the specific location. (For example, The Fool has two lines of text explaining it, then two each for Fool-in-past, Fool-in-present, and Fool-in-future)
With an eye to being able to expand into other spreads when I have time.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Skipping certain defined text on random selection [SOLVED]

#4 Post by trooper6 »

So, one thing you can do is create some classes. For example, you could create a card class that holds all the information you want the card to have and a deck class that allows you to draw out cards randomly.

Put this code in a fresh project and test it out. See what you get from it.

Code: Select all

# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

init python:
    class Card(object):
        def __init__ (self, name="", desc="", pastdesc="", presentdesc="", futuredesc=""):
            self.name = name
            self.desc = desc
            self.pastdesc = pastdesc
            self.presentdesc = presentdesc
            self.futuredesc = futuredesc
            self.location = Null

        @property
        def locdesc(self):
            if self.location == "past":
                return self.pastdesc
            elif self.location == "present":
                return self.presentdesc
            elif self.location == "future":
                return self.futuredesc
            else:
                return "Card has no location."

    class RandomDeck(object):
        def __init__(self, choices):
            self.choices = choices
            self.deck = [ ]

        def draw(self, location):
            if not self.deck:
                self.deck = list(self.choices)
                renpy.random.shuffle(self.deck)

            x = self.deck.pop(0)
            x.location = location
            return x
        def reset(self):
            self.deck = []


default fire1 = Card("Ace of Fire", "The Ace of Fire represents blah blah.",
"In the past location, the Ace of Fire represents blah blah.",
"In the present location, the Ace of Fire represents blah blah.",
"In the future location, the Ace of Fire represents blah blah.")
default fire2 = Card("Two of Fire", "The Two of Fire represents blah blah.",
"In the past location, the Two of Fire represents blah blah.",
"In the present location, the Two of Fire represents blah blah.",
"In the future location, the Two of Fire represents blah blah.")
default fire3 = Card("Three of Fire", "The Three of Fire represents blah blah.",
"In the past location, the Three of Fire represents blah blah.",
"In the present location, the Three of Fire represents blah blah.",
"In the future location, the Three of Fire represents blah blah.")
default fire4 = Card("Four of Fire", "The Four of Fire represents blah blah.",
"In the past location, the Four of Fire represents blah blah.",
"In the present location, the Four of Fire represents blah blah.",
"In the future location, the Four of Fire represents blah blah.")

default deck = RandomDeck([fire1, fire2, fire3, fire4])
default currentcard = Null
# The game starts here.

label start():
    scene black

    "Welcome. I assume you are here for a reading."
    menu reading:
        "Do you want a reading?"
        "Yes":
            jump tarot
        "No":
            pass

    "Thank you, your time here is done."

    return

label tarot():
    "I will draw three cards: one for your past, one for your present, one for your future."
    $currentcard = deck.draw("past")
    "For your past, I have drawn the [currentcard.name]."
    "[currentcard.desc]"
    "[currentcard.locdesc]"

    $currentcard = deck.draw("present")
    "For your present, I have drawn the [currentcard.name]."
    "[currentcard.desc]"
    "[currentcard.locdesc]"

    $currentcard = deck.draw("future")
    "For your future, I have drawn the [currentcard.name]."
    "[currentcard.desc]"
    "[currentcard.locdesc]"

    "That is the end of your reading."
    $deck.reset()
    jump reading

A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
EmberSH
Newbie
Posts: 7
Joined: Sun Dec 16, 2018 1:23 am
Tumblr: EmberSHx
Deviantart: EmberShadowHawk
Contact:

Re: Skipping certain defined text on random selection [SOLVED]

#5 Post by EmberSH »

Would you be able to explain how this works to me? I'd love to understand the mechanics behind it. You can probably tell my grasp of Python is pretty basic =^.^=

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Skipping certain defined text on random selection [SOLVED]

#6 Post by trooper6 »

I think the best thing you could do, would be to take the free basic Python course over at codeacademy.com because it would teach you the basics of Python, classes, functions, etc. It also gives you assignments where you can test your skills. It took me only a few days to do the course.

After doing it, then come back to this code. Some stuff you’ll understand without me having to explain, and the things you don’t understand, you’ll be able to ask better questions that I can answer.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Google [Bot]