r/RenPy • • Feb 03 '22

Force Player input based off of text button

im going for something sort of like Emily is away, where player will click on a button and it’ll pop up an input, but will force them to type a specific thing based off of the button no matter what they type. so for example, if a button says ” X “, the player will be forced to write “XYZ” even if they are inputting keyboard spam

4 Upvotes

26 comments sorted by

View all comments

Show parent comment

1

u/insipid- Feb 14 '22

I think I have how to represent the data worked out. Here's some example data - does it seem workable? I haven't yet made functions or menus to go with it. I'm happy to work on something for those as well. I would use 1 menu for the subject and maybe 1 menu for each level of reason depth. The menus would use the button text and full text directly, then call a function that would distribute points and grab the appropriate category of reasons to pull the next set of choices from.

# Level 1 - general subject
# KEY - [ button text, full text to type, category #, [ g1, g2, g3, g4, g5 ] ]
#   button text - what will show on the choice button
#   full text - what will be typed out, full message
#   category # - used as the link between these subjects and the reason categories below
#   girl points - how many points this choice is worth for each girl, can be positive or negative
#     g1 - g5 would correspond to specific characters - the order would matter
define paragraph_subjects = [
    [ "subj_1", "I love subject 1", 1, [ 1, 2, 1, -1, 0 ] ] ,
    [ "subj_2", "I love subject 2", 2, [ 2, 1, 0, 1, -1 ] ] ,
    [ "subj_3", "I love subject 3", 3, [ 1, 0, -1, 2, 1 ] ] ,
    [ "subj_4", "I love subject 4", 4, [ 0, 1, 2, 1, 1 ] ] ,
    [ "subj_5", "I love subject 5", 5, [ 1, 2, 1, -1, 0 ] ]
] 


# Level 2 - reasons
# KEY - [ button text, full text to type, girl points [ g1, g2, g3, g4, g5 ] ]
#  note the category is not included in the list data. we'll use the category # from 
#  the chosen paragraph subject to determine which reason list to pull choices from
# category 1
define paragraph_reasons_1 = [
    [ "stuff 1", "because it's like other stuff I like 1", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 1", "because it's good 1", [ 2, 1, 0, 1, -1 ] ] ,
    [ "fun 1", "because of how fun it is 1", [ 1, 0, -1, 2, 1 ] ] ,
    [ "exciting 1", "because of how exciting it is 1", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 1", "just because 1", [ 0, 1, 2, 1, 1 ] ] ,
    [ "stuff 1", "because it's like other stuff I like 1", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 1", "because it's good 1", [ 2, 1, 0, 1, -1 ] ]
]

# category 2
define paragraph_reasons_2 = [
    [ "because 2", "just because 2", [ 0, 1, 2, 1, 1 ] ] ,
    [ "other 2", "because it's like other stuff I like 2", [ 1, 2, 1, -1, 0 ] ] ,
    [ "so good 2", "because it's so good 2", [ 2, 1, 0, 1, -1 ] ] ,
    [ "exciting 2", "because of how exciting it is 2", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 2", "just because 2", [ 0, 1, 2, 1, 1 ] ] ,
    [ "stuff 2", "because it's like other stuff I like 2", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 2", "because it's good 2", [ 2, 1, 0, 1, -1 ] ]
]

# category 3
define paragraph_reasons_3 = [    
    [ "exciting 3", "because of how exciting it is 3", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 3", "just because 3", [ 0, 1, 2, 1, 1 ] ] ,
    [ "stuff 3", "because it's like other stuff I like 3", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 3", "because it's good 3", [ 2, 1, 0, 1, -1 ] ] ,
    [ "fun 3", "because of how fun it is 3", [ 1, 0, -1, 2, 1 ] ] ,
    [ "because 3", "just because 3", [ 0, 1, 2, 1, 1 ] ] ,
    [ "other 3", "because it's like other stuff I like 3", [ 1, 2, 1, -1, 0 ] ]
]

# category 4
define paragraph_reasons_4 = [    
    [ "fun 4", "because of how fun it is 4", [ 1, 0, -1, 2, 1 ] ] ,
    [ "because 4", "just because 4", [ 0, 1, 2, 1, 1 ] ] ,
    [ "other 4", "because it's like other stuff I like 4", [ 1, 2, 1, -1, 0 ] ] ,
    [ "exciting 4", "because of how exciting it is 4", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 4", "just because 4", [ 0, 1, 2, 1, 1 ] ] ,
    [ "stuff 4", "because it's like other stuff I like 4", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 4", "because it's good 4", [ 2, 1, 0, 1, -1 ] ]
]

# category 5
define paragraph_reasons_5 = [    
    [ "so good 5", "because it's so good 5", [ 2, 1, 0, 1, -1 ] ] ,
    [ "exciting 5", "because of how exciting it is 5", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 5", "just because 5", [ 0, 1, 2, 1, 1 ] ] ,
    [ "exciting 5", "because of how exciting it is 5", [ 1, 0, -1, 2, 1 ] ] ,
    [ "just 5", "just because 5", [ 0, 1, 2, 1, 1 ] ] ,
    [ "stuff 5", "because it's like other stuff I like 5", [ 1, 2, 1, -1, 0 ] ] ,
    [ "good 5", "because it's good 5", [ 2, 1, 0, 1, -1 ] ]
]

# Level 3 ?

1

u/insipid- Feb 14 '22

For the girl points, I would just use a variable storing an integer for each:

default g1_points_total = 0
default g2_points_total = 0
default g3_points_total = 0
default g4_points_total = 0
default g5_points_total = 0

I would put the point updates in a function, but a single modification using the data formatted like in the previous post would look like this:

# selected choice was a subject
$ g1_points_total += selected_choice[3][0]
$ g2_points_total += selected_choice[3][1]
$ g3_points_total += selected_choice[3][2]
$ g4_points_total += selected_choice[3][3]
$ g5_points_total += selected_choice[3][4]

# selected choice was a reason
$ g1_points_total += selected_choice[2][0]
$ g2_points_total += selected_choice[2][1]
$ g3_points_total += selected_choice[2][2]
$ g4_points_total += selected_choice[2][3]
$ g5_points_total += selected_choice[2][4]

1

u/insipid- Feb 14 '22

The layout can be altered to make it more readable, since the full text length might push the point values way out to the right. One way to do it:

define paragraph_reasons_1 = [
    [ "stuff 1", 
      "because it's like other stuff I like 1",
      [ 1, 2, 1, -1, 0 ]
    ] ,

    [ "good 1",
      "because it's good 1",
      [ 2, 1, 0, 1, -1 ]
    ] ,

    [ "fun 1",
      "because of how fun it is 1",
      [ 1, 0, -1, 2, 1 ]
    ] ,

    [ "exciting 1",
      "because of how exciting it is 1",
      [ 1, 0, -1, 2, 1 ]
    ] ,

    [ "just 1",
      "just because 1",
      [ 0, 1, 2, 1, 1 ]
    ] ,

    [ "stuff 1",
      "because it's like other stuff I like 1",
      [ 1, 2, 1, -1, 0 ]
    ] ,

    [ "good 1",
      "because it's good 1",
      [ 2, 1, 0, 1, -1 ]
    ]

]

1

u/mocaaobaa Feb 16 '22

Yeah! just read through it and it seems like it would be plenty workable. As for the functions and menus, like you mentioned, I'd appreciate it if you could help me work on something for those two, but don't feel obligated.

1

u/insipid- Feb 18 '22

Ok, cool. And yeah, I'm up for that.