CDS - Random

* Implemented random dialogue CDS supporting:
 - If statements
 - Renpy statements
 - Renpy blocks
 - Prediction
 - Expression editor (yay!)
 - Parsing errors handling
* Refactored randomized dialogues to use `random` CDS
* Removed obsolete code
This commit is contained in:
LoafyLemon 2023-03-10 23:09:32 +00:00
parent 0aef8f2e64
commit 22b6e66f53
32 changed files with 2910 additions and 3094 deletions

View File

@ -41,4 +41,41 @@ python early:
predict=predict_chibi, predict=predict_chibi,
) )
define config.debug_prediction = True def parse_random(lexer):
l = lexer.subblock_lexer()
choices = []
while l.advance():
loc = l.get_location()
condition = "True"
if l.keyword('block'):
l.require(':')
l.expect_eol()
l.expect_block('block')
block = l.subblock_lexer().renpy_block()
choices.append((block, condition))
elif l.keyword('if'):
l.expect_block("if block")
condition = l.require(l.python_expression)
l.require(':')
block = l.subblock_lexer().renpy_block()
choices.append((block, condition))
else:
stmt = l.renpy_statement()
choices.append((stmt, condition))
return choices
def next_random(choices):
choices = [block for block, cond in choices if eval(cond)]
return renpy.random.choice(choices)
renpy.register_statement(
name="random",
block=True,
parse=parse_random,
next=next_random,
)

File diff suppressed because it is too large Load Diff

View File

@ -42,12 +42,8 @@ define ast_face = {
label update_astoria: label update_astoria:
$ random_number = renpy.random.randint(0, 5)
if random_number in [1,5]:
$ name_susan_astoria = renpy.random.choice(["Suzy","Cow","Cow Tits","Milk Bag","Slut","Whore","Piggy","Pig","Bessie","Moo Moo"]) $ name_susan_astoria = renpy.random.choice(["Suzy","Cow","Cow Tits","Milk Bag","Slut","Whore","Piggy","Pig","Bessie","Moo Moo"])
if random_number in [2,5]:
$ name_tonks_astoria = renpy.random.choice(["Hag","Old Hag","Punk","Dyke","Lesbo"]) $ name_tonks_astoria = renpy.random.choice(["Hag","Old Hag","Punk","Dyke","Lesbo"])
if random_number in [3,5]:
$ name_astoria_tonks = renpy.random.choice(["Cutie","Kitty","Princess","Cupcake","Honey"]) $ name_astoria_tonks = renpy.random.choice(["Cutie","Kitty","Princess","Cupcake","Honey"])
# Chibi Update # Chibi Update

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -310,18 +310,17 @@ label .strip_cho:
ton "" ("base", "narrow", "base", "mid", hair="horny", xpos=345, ypos="base", flip=False) # Tonks moves to her original position. ton "" ("base", "narrow", "base", "mid", hair="horny", xpos=345, ypos="base", flip=False) # Tonks moves to her original position.
with d5 with d5
$ random_number = renpy.random.randint(1, 3) random:
block:
if random_number == 1:
ton "Look at all these muscles!" ("horny", "narrow", "raised", "down", hair="horny") ton "Look at all these muscles!" ("horny", "narrow", "raised", "down", hair="horny")
ton "I mean... I could easily get some muscles as well, but not without cheating..." ("open", "closed", "base", "mid", hair="horny") ton "I mean... I could easily get some muscles as well, but not without cheating..." ("open", "closed", "base", "mid", hair="horny")
ton "I'm quite impressed, Miss Chang." ("base", "narrow", "base", "L", hair="horny") ton "I'm quite impressed, Miss Chang." ("base", "narrow", "base", "L", hair="horny")
cho "Thank you." ("soft", "narrow", "base", "L", cheeks="blush") cho "Thank you." ("soft", "narrow", "base", "L", cheeks="blush")
elif random_number == 2: block:
ton "You look quite tasty, Miss Chang." ("horny", "narrow", "raised", "down", hair="horny") ton "You look quite tasty, Miss Chang." ("horny", "narrow", "raised", "down", hair="horny")
cho "*Ehm*..." ("clench", "narrow", "worried", "down", cheeks="heavy_blush") cho "*Ehm*..." ("clench", "narrow", "worried", "down", cheeks="heavy_blush")
cho "Thanks?" ("soft", "narrow", "worried", "L", cheeks="heavy_blush") cho "Thanks?" ("soft", "narrow", "worried", "L", cheeks="heavy_blush")
else: block:
ton "Looks like we're done here, Professor." ("horny", "narrow", "raised", "mid", hair="horny") ton "Looks like we're done here, Professor." ("horny", "narrow", "raised", "mid", hair="horny")
gen "Excellent!" ("base", xpos="far_left", ypos="head") gen "Excellent!" ("base", xpos="far_left", ypos="head")
gen "I do love watching you two." ("grin", xpos="far_left", ypos="head") gen "I do love watching you two." ("grin", xpos="far_left", ypos="head")
@ -607,18 +606,17 @@ label .strip_tonks:
cho "" ("base", "narrow", "base", "mid", cheeks="blush", xpos=315, ypos="base", flip=False) # Cho moves to her original position. cho "" ("base", "narrow", "base", "mid", cheeks="blush", xpos=315, ypos="base", flip=False) # Cho moves to her original position.
with d5 with d5
$ random_number = renpy.random.randint(1, 3) random:
block:
if random_number == 1:
ton "How immoral for a teacher to do this sort of thing in front of a student..." ("open", "closed", "annoyed", "mid", hair="horny") ton "How immoral for a teacher to do this sort of thing in front of a student..." ("open", "closed", "annoyed", "mid", hair="horny")
ton "You aren't going to report me for my wanton behaviour, are you, Miss Chang?" ("soft", "narrow", "annoyed", "L", hair="horny") ton "You aren't going to report me for my wanton behaviour, are you, Miss Chang?" ("soft", "narrow", "annoyed", "L", hair="horny")
cho "No. Of course not, Professor." ("base", "narrow", "base", "L", cheeks="heavy_blush") cho "No. Of course not, Professor." ("base", "narrow", "base", "L", cheeks="heavy_blush")
ton "Good girl." ("horny", "narrow", "base", "L", hair="horny") ton "Good girl." ("horny", "narrow", "base", "L", hair="horny")
cho "..." ("angry", "narrow", "base", "down", cheeks="blush") cho "..." ("angry", "narrow", "base", "down", cheeks="blush")
elif random_number == 2: block:
ton "Are you enjoying yourself, Professor?" ("open", "narrow", "raised", "mid", hair="horny") ton "Are you enjoying yourself, Professor?" ("open", "narrow", "raised", "mid", hair="horny")
gen "With those tits in front of me? Always!" ("grin", xpos="far_left", ypos="head") gen "With those tits in front of me? Always!" ("grin", xpos="far_left", ypos="head")
else: block:
ton "Did you like that, Professor?" ("horny", "narrow", "raised", "mid", hair="horny") ton "Did you like that, Professor?" ("horny", "narrow", "raised", "mid", hair="horny")
gen "I bloody love it!" ("grin", xpos="far_left", ypos="head") gen "I bloody love it!" ("grin", xpos="far_left", ypos="head")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -272,7 +272,7 @@ label hg_wager_bj:
pause.2 pause.2
gen "Well, that was something..." ("base", xpos="far_left", ypos="head") gen "Well, that was something..." ("base", xpos="far_left", ypos="head")
$ uni_sperm = False
if her_whoring < 22: #if she has lower whoring than 22 if her_whoring < 22: #if she has lower whoring than 22
her "That was mortifying!" ("angry", "closed", "angry", "mid") her "That was mortifying!" ("angry", "closed", "angry", "mid")
her "How could you make me keep going?!?" ("angry", "base", "angry", "mid") her "How could you make me keep going?!?" ("angry", "base", "angry", "mid")
@ -406,7 +406,7 @@ label hg_wager_bj:
else: else:
her "Good night." ("open", "base", "base", "mid") her "Good night." ("open", "base", "base", "mid")
gen "Good night, [name_hermione_genie]." ("base", xpos="far_left", ypos="head") gen "Good night, [name_hermione_genie]." ("base", xpos="far_left", ypos="head")
$ uni_sperm = False
"-Try something crazy- {image=interface/icons/small/cards.webp}": "-Try something crazy- {image=interface/icons/small/cards.webp}":
gen "Oh yes, I'm...{w=0.3} ugh...{w=0.3} fine." ("base", xpos="far_left", ypos="head") gen "Oh yes, I'm...{w=0.3} ugh...{w=0.3} fine." ("base", xpos="far_left", ypos="head")
gen "But for some reason I feel like playing some cards." ("base", xpos="far_left", ypos="head") gen "But for some reason I feel like playing some cards." ("base", xpos="far_left", ypos="head")

View File

@ -1,5 +1,4 @@
label hermione_summon_setup: label hermione_summon_setup:
$ random_number = renpy.random.randint(1, 10)
# Reset doll state # Reset doll state
$ hermione.wear("all") $ hermione.wear("all")

View File

@ -827,7 +827,7 @@ label hg_pf_handjob_2_continue:
# The phrase in the brackets is the text that the game will display to prompt # The phrase in the brackets is the text that the game will display to prompt
# the player to enter the name they've chosen. # the player to enter the name they've chosen.
$ random_number = renpy.random.randint(1, 3)
$ tmp_name = renpy.input("(Use keyboard to enter the phrase.)") $ tmp_name = renpy.input("(Use keyboard to enter the phrase.)")
$ tmp_name = tmp_name.strip() $ tmp_name = tmp_name.strip()
@ -843,19 +843,21 @@ label hg_pf_handjob_2_continue:
her "[tmp_name]." ("base", "base", "base", "mid") her "[tmp_name]." ("base", "base", "base", "mid")
gen "A bit louder..." ("base", xpos="far_left", ypos="head") gen "A bit louder..." ("base", xpos="far_left", ypos="head")
her "[tmp_name]!!!" ("scream", "closed", "angry", "mid") her "[tmp_name]!!!" ("scream", "closed", "angry", "mid")
elif random_number == 1: else:
random:
block:
her "I don't want to say that..." ("annoyed", "base", "worried", "R") her "I don't want to say that..." ("annoyed", "base", "worried", "R")
gen "Oh, just do it, [name_hermione_genie]." ("base", xpos="far_left", ypos="head") gen "Oh, just do it, [name_hermione_genie]." ("base", xpos="far_left", ypos="head")
her "..........." ("annoyed", "base", "worried", "R") her "..........." ("annoyed", "base", "worried", "R")
her "[tmp_name]." ("scream", "closed", "angry", "mid") her "[tmp_name]." ("scream", "closed", "angry", "mid")
elif random_number == 2: block:
her "*huh*?" ("annoyed", "base", "worried", "R") her "*huh*?" ("annoyed", "base", "worried", "R")
her "What does That have to do with anything?" her "What does That have to do with anything?"
gen "Just say it." ("base", xpos="far_left", ypos="head") gen "Just say it." ("base", xpos="far_left", ypos="head")
her "......" ("annoyed", "base", "worried", "R") her "......" ("annoyed", "base", "worried", "R")
gen "Come on, humour me." ("base", xpos="far_left", ypos="head") gen "Come on, humour me." ("base", xpos="far_left", ypos="head")
her "[tmp_name]." ("scream", "closed", "angry", "mid") her "[tmp_name]." ("scream", "closed", "angry", "mid")
elif random_number == 3: block:
her "..........." ("annoyed", "base", "worried", "R") her "..........." ("annoyed", "base", "worried", "R")
her "Do I really have to?" her "Do I really have to?"
gen "Just say it." ("base", xpos="far_left", ypos="head") gen "Just say it." ("base", xpos="far_left", ypos="head")
@ -863,21 +865,21 @@ label hg_pf_handjob_2_continue:
gen "*He-he*..." ("grin", xpos="far_left", ypos="head") gen "*He-he*..." ("grin", xpos="far_left", ypos="head")
"{size=-4}\"-Manual user input-\"{/size}" if renpy.android: "{size=-4}\"-Manual user input-\"{/size}" if renpy.android:
$ random_number = renpy.random.randint(1, 3)
if random_number == 1: random:
block:
her "I don't want to say that..." ("annoyed", "base", "worried", "R") her "I don't want to say that..." ("annoyed", "base", "worried", "R")
gen "Oh, just do it, [name_hermione_genie]." ("base", xpos="far_left", ypos="head") gen "Oh, just do it, [name_hermione_genie]." ("base", xpos="far_left", ypos="head")
her "..........." ("annoyed", "base", "worried", "R") her "..........." ("annoyed", "base", "worried", "R")
her "Manual user input..." ("scream", "closed", "angry", "mid") her "Manual user input..." ("scream", "closed", "angry", "mid")
elif random_number == 2: block:
her "*huh*?" ("annoyed", "base", "worried", "R") her "*huh*?" ("annoyed", "base", "worried", "R")
her "What does That have to do with anything?" her "What does That have to do with anything?"
gen "Just say it." ("base", xpos="far_left", ypos="head") gen "Just say it." ("base", xpos="far_left", ypos="head")
her "......" ("annoyed", "base", "worried", "R") her "......" ("annoyed", "base", "worried", "R")
gen "Come on, humour me." ("base", xpos="far_left", ypos="head") gen "Come on, humour me." ("base", xpos="far_left", ypos="head")
her "... Manual user input." ("scream", "closed", "angry", "mid") her "... Manual user input." ("scream", "closed", "angry", "mid")
elif random_number == 3: block:
her "..........." ("annoyed", "base", "worried", "R") her "..........." ("annoyed", "base", "worried", "R")
her "Do I really have to?" her "Do I really have to?"
gen "Just say it." ("base", xpos="far_left", ypos="head") gen "Just say it." ("base", xpos="far_left", ypos="head")

View File

@ -381,13 +381,10 @@ label hg_pf_grope_T4_E2:
her "Or my bum?...." ("soft", "narrow", "base", "mid_soft") her "Or my bum?...." ("soft", "narrow", "base", "mid_soft")
gen "*Hmm*... What would you like?" ("base", xpos="far_left", ypos="head") gen "*Hmm*... What would you like?" ("base", xpos="far_left", ypos="head")
$ random_number = renpy.random.randint(1, 3)
if random_number == 1: random:
her "I wouldn't mind it if you massaged my breasts a little..." ("soft", "narrow", "base", "R_soft") her "I wouldn't mind it if you massaged my breasts a little..." ("soft", "narrow", "base", "R_soft")
elif random_number == 2:
her "I wouldn't mind it if you caressed my bum a bit, [name_genie_hermione]..." ("soft", "narrow", "worried", "down") her "I wouldn't mind it if you caressed my bum a bit, [name_genie_hermione]..." ("soft", "narrow", "worried", "down")
else:
her "I wouldn't mind either today, [name_genie_hermione]." ("soft", "narrow", "base", "R_soft") her "I wouldn't mind either today, [name_genie_hermione]." ("soft", "narrow", "base", "R_soft")
gen "Very well then..." ("base", xpos="far_left", ypos="head") gen "Very well then..." ("base", xpos="far_left", ypos="head")

View File

@ -1489,9 +1489,8 @@ label hg_sex_3:
her "*Ah*...{w=0.3} Another--" her "*Ah*...{w=0.3} Another--"
"-Scold her-": "-Scold her-":
$ random_number = renpy.random.randint(1, 2) random:
block:
if random_number == 1:
gen "Maybe for a slut." gen "Maybe for a slut."
show her_sex_personal mouth_disgust eyebrows_worried eyes_narrow_mid cheeks_blush as cg show her_sex_personal mouth_disgust eyebrows_worried eyes_narrow_mid cheeks_blush as cg
her "*Ah*...{w=0.3} Don't--{w=0.2} *Ah*...{w=0.3} Don't call me that [name_genie_hermione]..." her "*Ah*...{w=0.3} Don't--{w=0.2} *Ah*...{w=0.3} Don't call me that [name_genie_hermione]..."
@ -1547,7 +1546,7 @@ label hg_sex_3:
show her_sex_personal mouth_angry eyebrows_base eyes_narrow_r cheeks_blush as cg show her_sex_personal mouth_angry eyebrows_base eyes_narrow_r cheeks_blush as cg
her "My--" her "My--"
elif random_number == 2: block:
gen "Do you even care about the points anymore?" gen "Do you even care about the points anymore?"
show her_sex_personal mouth_angry eyebrows_base eyes_happy_down cheeks_blush as cg show her_sex_personal mouth_angry eyebrows_base eyes_happy_down cheeks_blush as cg
her "*Ah*...{w=0.3} Of course I--{w=0.2} *Ah*...{w=0.3} Why else would I be doing this..." her "*Ah*...{w=0.3} Of course I--{w=0.2} *Ah*...{w=0.3} Why else would I be doing this..."

View File

@ -1243,15 +1243,14 @@ label hg_anal_sex_3:
gen "Are you sure? I mean it's not like the door is locked or anything..." gen "Are you sure? I mean it's not like the door is locked or anything..."
gen "Anyone could walk in here!" gen "Anyone could walk in here!"
if game.daytime: if game.daytime:
$ random_number = renpy.random.randint(1, 3) random:
block:
if random_number == 1:
show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg
her "*Ah*...{w=0.4} I'm sure they're still having lunch right now..." her "*Ah*...{w=0.4} I'm sure they're still having lunch right now..."
elif random_number == 2: block:
show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg
her "*Ah*...{w=0.4} They should be in the library studying at the moment..." her "*Ah*...{w=0.4} They should be in the library studying at the moment..."
elif random_number == 3: block:
show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg show her_sex_personal mouth_soft eyes_narrow_down eyebrows_base cheeks_blush as cg
her "*Ah*...{w=0.4} They're probably still busy playing Gobstones..." her "*Ah*...{w=0.4} They're probably still busy playing Gobstones..."
else: else:

View File

@ -1318,11 +1318,11 @@ label hg_hidden_blowjob_cumming:
"\"What would you like?\"": "\"What would you like?\"":
her "If it is all the same to you, [name_genie_hermione]..." ("soft", "narrow", "annoyed", "up") her "If it is all the same to you, [name_genie_hermione]..." ("soft", "narrow", "annoyed", "up")
$ random_number = renpy.random.randint(1, 2) random:
if random_number == 1: block:
her "I would like you to cum on my face, [name_genie_hermione]." ("grin", "narrow", "base", "dead") her "I would like you to cum on my face, [name_genie_hermione]." ("grin", "narrow", "base", "dead")
her "I read that it's good for the skin." her "I read that it's good for the skin."
else: block:
her "I would like you to cum in my mouth." ("grin", "narrow", "base", "dead") her "I would like you to cum in my mouth." ("grin", "narrow", "base", "dead")
her "You usually cum so much so I think I will be able to just skip my next meal..." her "You usually cum so much so I think I will be able to just skip my next meal..."
if game.daytime: if game.daytime:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -684,19 +684,16 @@ label ll_pf_masturbate_T3_E3_intro:
gen "You're very pretty, [name_luna_genie]." gen "You're very pretty, [name_luna_genie]."
lun "*Mmm*..." ("base", "narrow", "base", "up", cheeks="blush") lun "*Mmm*..." ("base", "narrow", "base", "up", cheeks="blush")
"-Don't-": "-Don't-":
$ random_number = renpy.random.randint(1, 3)
if random_number == 1: random:
lun "Hurry...{w=0.3} I'm...{w=0.3} I'm almost there..." ("grin", "happyCl", "base", "up", cheeks="blush")
block:
gen "You're going to need to learn how to do this without my help [name_luna_genie]..." gen "You're going to need to learn how to do this without my help [name_luna_genie]..."
lun "Please, [name_genie_luna]..." ("angry", "happyCl", "base", "mid", cheeks="blush") lun "Please, [name_genie_luna]..." ("angry", "happyCl", "base", "mid", cheeks="blush")
block:
elif random_number == 2:
gen "Tell you..." gen "Tell you..."
lun "Tell me I'm pretty, [name_genie_luna]..." ("grin", "narrow", "base", "up", cheeks="blush") lun "Tell me I'm pretty, [name_genie_luna]..." ("grin", "narrow", "base", "up", cheeks="blush")
elif random_number == 3:
lun "Hurry...{w=0.3} I'm...{w=0.3} I'm almost there..." ("grin", "happyCl", "base", "up", cheeks="blush")
# Menu opens again until you've told her she's pretty # Menu opens again until you've told her she's pretty
jump ll_pf_masturbate_T3_E3_intro.choice jump ll_pf_masturbate_T3_E3_intro.choice

Some files were not shown because too many files have changed in this diff Show More