<s> """<STR_LIT>""" <EOL> from evennia import DefaultScript <EOL> from evennia . contrib . tutorial_examples import cmdset_red_button as cmdsetexamples <EOL> class ClosedLidState ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . persistent = True <EOL> def at_start ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . cmdset . add ( cmdsetexamples . LidClosedCmdSet ) <EOL> def is_valid ( self ) : <EOL> """<STR_LIT>""" <EOL> return not self . obj . db . lid_open <EOL> def at_stop ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . cmdset . delete ( cmdsetexamples . LidClosedCmdSet ) <EOL> class OpenLidState ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . persistent = True <EOL> def at_start ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . cmdset . add ( cmdsetexamples . LidOpenCmdSet ) <EOL> def is_valid ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . obj . db . lid_open <EOL> def at_stop ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . cmdset . delete ( cmdsetexamples . LidOpenCmdSet ) <EOL> class BlindedState ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . key = "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . interval = <NUM_LIT:20> <EOL> self . start_delay = True <EOL> self . repeats = <NUM_LIT:1> <EOL> self . persistent = False <EOL> def at_start ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . cmdset . add ( cmdsetexamples . BlindCmdSet ) <EOL> def at_stop ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . msg ( "<STR_LIT>" ) <EOL> self . obj . location . msg_contents ( "<STR_LIT>" <EOL> % self . obj . name , <EOL> exclude = self . obj ) <EOL> self . obj . cmdset . delete ( ) <EOL> class CloseLidEvent ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . key = "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . interval = <NUM_LIT:20> <EOL> self . start_delay = True <EOL> self . repeats = <NUM_LIT:1> <EOL> self . persistent = True <EOL> def is_valid ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . obj . db . lid_open <EOL> def at_repeat ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . close_lid ( ) <EOL> class BlinkButtonEvent ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . key = "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . interval = <NUM_LIT> <EOL> self . start_delay = False <EOL> self . persistent = True <EOL> def is_valid ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . obj . db . lamp_works <EOL> def at_repeat ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . blink ( ) <EOL> class DeactivateButtonEvent ( DefaultScript ) : <EOL> """<STR_LIT>""" <EOL> def at_script_creation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . key = "<STR_LIT>" <EOL> self . desc = "<STR_LIT>" <EOL> self . interval = <NUM_LIT> <EOL> self . start_delay = True <EOL> self . persistent = True <EOL> self . repeats = <NUM_LIT:1> <EOL> def at_start ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . close_lid ( ) <EOL> self . obj . db . lid_locked = True <EOL> self . obj . break_lamp ( feedback = False ) <EOL> def at_repeat ( self ) : <EOL> """<STR_LIT>""" <EOL> self . obj . db . lamp_works = True <EOL> desc = "<STR_LIT>" <EOL> desc += "<STR_LIT>" <EOL> self . db . desc = desc <EOL> self . obj . scripts . add ( BlinkButtonEvent ) <EOL> self . obj . db . lid_locked = False <EOL> self . obj . scripts . validate ( ) </s>
