So, I'm trying to make a blackjack game. A very simple one, if I may add.
My code currently looks like 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: Your cards: %s and %s \n Type !hitme for more cards or !stay to 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 this is pretty much what I'm trying to archieve:
def playblackjack(message, player=False, dealer=False):
dealhand(player)
// This is when the player has to input !hitme to get more cards
if not playerhastypedhitme in 300 secs:
return
dealhand(player=False, dealer=True)
// code continues
So basically, I need to figure out a (non-retarded, I know I can do it with lists, for example) way to make the function wait for user input. Like make an another function send an 'OK, continue' message to this function.
I know this has been asked before probably, It's just very hard describing in search terms what I want to accomplish