My code currently works, but I want to make it better. Also, I haven't yet put sprites in the game...and I think what I currently have might be irritating when it is time to code the sprites in. So, I'm here asking to ask a question.
Here is the set up.
I have a Barber character. This barber character is a slow talker. Sometimes, when he is slow talking, the player can interrupt the barber, sometimes he can't. (There is one other variation, but that isn't important for the moment).
So I've created a callback function, the point of it is to turn off the CTC button while the barber is talking, and for variation 0 turn on my interrupt button, for variation 1 you don't, and then check to see if the user interrupted the barber..this is more or less what it looks like:
Code: Select all
def arrow(event, inter=False, **kwargs):
global can_interrupt
global can_cont
global interrupts
global icheck
global base_int
if inter == 0:
if event == "show" or event == "begin":
base_int = interrupts
can_interrupt = True
can_cont = False
if event == "slow_done" or event == "end":
can_interrupt = False
can_cont = True
if interrupts > base_int:
icheck = True
else:
icheck = False
renpy.restart_interaction()
if inter == 1:
if event == "show" or event == "begin":
can_cont = False
if event == "slow_done" or event == "end":
can_cont = True
renpy.restart_interaction()
Code: Select all
define b = Character('[barb_name]', color="#994411", what_color="#FFFFCC",
what_slow_cps=20, what_slow_abortable=False, callback=arrow, cb_inter=1)
define bI = Character('[barb_name]', color="#994411", what_color="#FFFFCC",
what_slow_cps=20, what_slow_abortable=False, callback=arrow, cb_inter=0)
Code: Select all
b "I thought so. I'm from the country myself." #Barber Friendly
c "Really? What part?" #Customer C4 Curious
bI "{=narr}(He mixes the lather in a small mug--){/=narr}{fast} Oh, that would
be difficult to say. You see, I've moved around so much that I'm neither
a Southerner nor a Northerner. I'm just an American....Though I lived
in a little town near Savannah for a year." #Barber Friendly, transitioning to Barber Observing
Now the question. Is it possible to have only 1 barber character, let's say with the cb_inter variable defaulted to 1 (which is the no interrupt version), but for some say statements change the cb_inter variable to 0?
I know there are conditionswitches used for graphics...but can something like that be used for by cb_inter variable...or just variables in general?
I mean can I do something like:
Code: Select all
b "Here I am talking slowly and you can't interrupt me."
b "{cb_inter=1}Here I am talking slowly and you can interrupt me.{/cb_inter}"