mIRC Blackjack超时脚本

时间:2015-11-15 23:57:01

标签: mirc

我在mIRC上有一堆二十一点游戏脚本的代码。 一切都运行良好,但是当用户开始玩二十一点游戏时,在游戏结束之前没有其他人可以玩。

我想知道是否有人可以帮我编码,以便我可以在每个动作之间给用户一个45秒的计时器;如果超时,脚本将重置,打开脚本供另一个用户播放。这将使正在使用的游戏无效。

游戏代码如下。

;BLACKJACK
on *:TEXT:!blackjack*:#vegas:{
  if (%bj == on) {
/msg $chan 10Blackjack is already in progress. Please wait your turn.
halt
  }
if ( %hs [ $+ [ $nick ] ] != $null ) /notice $nick 10 $+ $nick $+ , you have a game in progress!!!
if ( %hs [ $+ [ $nick ] ] == $null ) {
if ( $2 == $null ) /notice $nick 10Please enter amount you want to bet. ex. !blackjack 20
if ($readini( casino.ini, $nick, Money ) == $null ) /notice $nick 10 $+ $nick is not yet registered.  Type !atm
if ( $readini( casino.ini, $nick, Money ) < $2 ) /notice $nick 10You don't have that much money...try something lower!
if ( $readini( casino.ini, $nick, Money ) >= $2 ) {
  if ( $2 < 1 ) {
    /notice $nick 10Please bet more than 1 dollar.
    halt
  }
  if ( $2 > 0 ) {

    /set %bj on

    /set %bet [ $+ [ $nick ] ] $2

    /bjdeal

    /msg $chan 10 $+ $nick bet $2 dollars on a hand of blackjack

    /var %cch = $rand(1,4)

    if ( %cch == 1) /msg $chan 10 $+ $nick $+ 's hand: 4,0 %hcard1 [ $+ [ $nick ] ]  4,0 %hcard2 [ $+ [ $nick ] ] 

    if ( %cch == 2) /msg $chan 10 $+ $nick $+ 's hand: 4,0 %hcard1 [ $+ [ $nick ] ]  1,0 %hcard2 [ $+ [ $nick ] ] 

    if ( %cch == 3) /msg $chan 10 $+ $nick $+ 's hand: 1,0 %hcard1 [ $+ [ $nick ] ]  4,0 %hcard2 [ $+ [ $nick ] ] 

        if ( %cch == 4) /msg $chan 10 $+ $nick $+ 's hand: 1,0 %hcard1 [ $+ [ $nick ] ]  1,0 %hcard2 [ $+ [ $nick ] ] 

    if (( %hcard1 [ $+ [ $nick ] ] == A ) && ( %hcard2 [ $+ [ $nick ] ] == A )) {
      /set %addh [ $+ [ $nick ] ] 12
      /set %aceh [ $+ [ $nick ] ] 0
    }
    if (( %hcard1 [ $+ [ $nick ] ] == A ) || ( %hcard2 [ $+ [ $nick ] ] == A )) { /set %aceh [ $+ [ $nick ] ] 0 }
    /set %ccc [ $+ [ $nick ] ] $rand(1,2)
    if ( %ccc [ $+ [ $nick ] ] == 1) /msg $chan 10Dealer's hand: 4,0 %ccard1 [ $+ [ $nick ] ]  12,0 ? 
    if ( %ccc [ $+ [ $nick ] ] == 2) /msg $chan 10Dealer's hand: 1,0 %ccard1 [ $+ [ $nick ] ]  12,0 ? 
    if ( %addh [ $+ [ $nick ] ] == 21 ) {
      /set %bj [ $+ [ $nick ] ] $calc( $2 / 2 )
      /set %bj [ $+ [ $nick ] ] $calc( %bj [ $+ [ $nick ] ] + $2 )
      /msg $chan 4Blackjack!! $nick has won %bj [ $+ [ $nick ] ] dollars!!
      /set %bj.temp $calc( $readini( casino.ini, $nick, Money ) + %bj [ $+ [ $nick ] ] )
      /writeini casino.ini $nick Money %bj.temp
      /unset %bj.temp
      /unset %hs [ $+ [ $nick ] ]
      /unset %bet [ $+ [ $nick ] ]
      /unset %addh [ $+ [ $nick ] ]
      /unset %addc [ $+ [ $nick ] ]
      /unset %hcard1 [ $+ [ $nick ] ]
      /unset %hcard2 [ $+ [ $nick ] ]
      /unset %ccard1 [ $+ [ $nick ] ]
      /unset %ccard2 [ $+ [ $nick ] ]
      /unset %hcard3 [ $+ [ $nick ] ]
      /unset %ccard3 [ $+ [ $nick ] ]
      /unset %bj [ $+ [ $nick ] ]
      /unset %aceh [ $+ [ $nick ] ] 
      /unset %double [ $+ [ $nick ] ]
      /unset %bj
      /halt
    }
    if ( %addh [ $+ [ $nick ] ] != 21 ) {
      set %double [ $+ [ $nick ] ] $calc( %bet [ $+ [ $nick ] ] * 2)
      if ( $readini( casino.ini, $nick, Money ) >= %double [ $+ [ $nick ] ] ) {
        /msg $chan 10 Hit Stand or Double?
        /set %d [ $+ [ $nick ] ] 0
        /set %hs [ $+ [ $nick ] ] 0
        /halt
      }
      if ( $readini( casino.ini, $nick, Money ) < %double [ $+ [ $nick       ]     ] ) 
{
            /msg $chan 10 Hit or Stand?
        /set %hs [ $+ [ $nick ] ] 0
        /halt
      }
    }
  }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

执行此操作的一种方法是启动timer,这会在X时间过去后取消设置变量。例如:

startblackjack

对于他们可以执行的每个命令,您必须通过再次触发starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-training-namenode-localhost.localdomain.out localhost: /home/training/.bashrc: line 10: /jdk1.7.0_10/bin: No such file or directory localhost: Warning: $HADOOP_HOME is deprecated. localhost: localhost: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-training-datanode-localhost.localdomain.out localhost: /home/training/.bashrc: line 10: /jdk1.7.0_10/bin: No such file or directory localhost: Warning: $HADOOP_HOME is deprecated. localhost: localhost: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-training-secondarynamenode-localhost.localdomain.out starting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-training-jobtracker-localhost.localdomain.out localhost: /home/training/.bashrc: line 10: /jdk1.7.0_10/bin: No such file or directory localhost: Warning: $HADOOP_HOME is deprecated. localhost: localhost: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-training-tasktracker-localhost.localdomain.out 别名来重新启动计时器。

如果您还有其他问题,请随时向他们提问。