python - Make a function sleep until another function is done -
so, i'm trying make blackjack game. simple one, if may add.
my code looks this:
def cmd_blackjack(message): playblackjack(message, player=true) def dealcard(): card = random.randrange(1, 11) return card def dealhand(message, player=false, dealer=false): card1 = dealcard() card2 = dealcard() if player: client.send_message(message.channel, 'blackjack: cards: %s , %s \n type !hitme more cards or !stay stay' % (card1, card2)) if dealer: client.send_message(message.channel, "blackjack: dealer's cards: %s %s" % (card1, card2)) return card, card2 def playblackjack(message, player=false, dealer=false): dealhand(player) and pretty i'm trying archieve:
def playblackjack(message, player=false, dealer=false): dealhand(player) // when player has input !hitme more cards if not playerhastypedhitme in 300 secs: return dealhand(player=false, dealer=true) // code continues so basically, need figure out (non-retarded, know can lists, example) way make function wait user input. make function send 'ok, continue' message function.
i know has been asked before probably, it's hard describing in search terms want accomplish
you don't need sleep. if understood correctly, want wait user input.
python's input() function you.
Comments
Post a Comment