mIRC Home    About    Download    Register    News    Help

Print Thread
#256066 15/12/15 04:23 PM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
Hello
I'm trying to make a blackjack bot.
I want that when I will write !stand the bot will calculate the numbers of the hits and write it.

http://prntscr.com/9ehzcs - the hits

http://prntscr.com/9ei09h - the scripts

Thank you smile

Last edited by shaf12; 15/12/15 04:47 PM.
shaf12 #256068 15/12/15 06:19 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Use a pastebin (or just paste here) code instead of taking a screenshot.

Code:
on *:text:!hit:#:{
  var %draw = $rand(1,11)

  hinc -m blackjack $nick %draw
}

on *:text:!stand:#:{
  var %total = $hget(blackjack,$nick)

  msg # Your total is %total
}


And a draw would only be completely random with an infinitely large deck (otherwise you need to create and 'shuffle' a deck yourself).

Loki12583 #256069 15/12/15 07:31 PM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
Originally Posted By: Loki12583
Use a pastebin (or just paste here) code instead of taking a screenshot.

Code:
on *:text:!hit:#:{
  var %draw = $rand(1,11)

  hinc -m blackjack $nick %draw
}

on *:text:!stand:#:{
  var %total = $hget(blackjack,$nick)

  msg # Your total is %total
}


And a draw would only be completely random with an infinitely large deck (otherwise you need to create and 'shuffle' a deck yourself).

I'm need a reset command.
Like if I'll write !New , the total will reset

Thank you smile smile smile

Last edited by shaf12; 15/12/15 08:56 PM.
shaf12 #256071 15/12/15 08:59 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
/hfree blackjack

/help hash tables

Loki12583 #256077 16/12/15 06:40 PM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
Originally Posted By: Loki12583
/hfree blackjack

/help hash tables


Yes but how can I reset the %total ?

shaf12 #256085 17/12/15 05:28 AM
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
In the !stand text event %total is set to whatever is stored in the hash table item $nick, so if you free the hash table, it's going to be $null.

Dazuz #256094 17/12/15 02:08 PM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
Originally Posted By: Dazuz
In the !stand text event %total is set to whatever is stored in the hash table item $nick, so if you free the hash table, it's going to be $null.

I didn't undetstand what to do frown

shaf12 #256099 18/12/15 06:27 PM
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Use the command you were given. It frees the hashtable and that way $hget doesnt return anything. So %total doesn't return anything either.

OrFeAsGr #256102 18/12/15 08:27 PM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
Originally Posted By: OrFeAsGr
Use the command you were given. It frees the hashtable and that way $hget doesnt return anything. So %total doesn't return anything either.

But where to use it? in the new command?

shaf12 #256103 19/12/15 08:12 AM
Joined: Dec 2015
Posts: 14
S
shaf12 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Dec 2015
Posts: 14
I did it!!! smile


Link Copied to Clipboard