Re: issue with multiple variables in if statement
here is my redo of the msg, now called dialog. Also I decided not to put this function into the main script, just call msg.dialog()
default_duration=3000
auto_disappear=True
disable_auto_for_message=False
extend_time=3000
request_extra=False
def dialog(message):
duration_timer = timer.Timer()
total_duration=default_duration
if request_extra==True:
total_duration+=extend_time
if disable_auto_for_message==True:
auto_disappear=False
p.play_stationary("sounds/event/action.ogg")
lucia.output.speak(message)
duration_timer.restart()
while 1:
lucia.process_events()
vertual_enter_key=False
if duration_timer.elapsed>=total_duration and auto_disappear==True:
vertual_enter_key=True
if lucia.key_pressed(pygame.K_RETURN) or lucia.key_pressed(pygame.K_SPACE) or vertual_enter_key==True:
request_extra=False
if disable_auto_for_message==True
settings.get("auto_disappear")
disable_auto_for_message=False
break
if lucia.key_pressed(pygame.K_UP) or lucia.key_pressed(pygame.K_DOWN) or lucia.key_pressed(pygame.K_LEFT) or lucia.key_pressed(pygame.K_RIGHT):
lucia.output.speak(message)
time.sleep(0.05)
This time, I decided to take out the ability to force a message to auto disappear. I found that wasn't a very good option for the user to have no control over. However I still left in the ability to force a dialog not to auto disappear, for important messages and suspense points.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector