2014-09-01 26 views
0

我目前正在研究一個twitch.tv殭屍程序。機器人設計的目的是當用戶在mIRC結束時加入聊天時自動給用戶分。一個計時器開始,他們每30分鐘收到1分。這個問題是我不希望人們在關閉流的聊天中提交afk,所以我想要輸入一個像「!pointstimer start」這樣的命令。當該命令運行時,我希望它顯示計時器已啓動的消息。我希望這個命令也只適用於其他人在他們認爲合適的時候不能運行命令。我有積分制度以及給予獎勵的抽獎制度。問題是,當我發出命令打開和關閉點系統時,什麼也沒有發生。我可以讓它顯示文本,如果該命令不是操作,但是當它是操作,然後沒有任何反應。這裏是我所有代碼的副本。mIRC Twitch.tv殭屍點系統開關命令

代碼:

on *:TEXT:!commands:#: { 
    if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return } 
    set -u10 %floodcommands On 
    set -u30 %floodcommands. $+ $nick On 
    msg $chan The commands for this channel are the following. !commands, !social, !help, !cop, !hypno, !medic, !vigi, !inno, !gunsmith, !rafflesystem, !donks, !buytickets [number of tickets]. Mod only commands are the following, !donks [add|remove] [user] [number], !raffle [open|close], !roll, !permit [user]. $+ 
} 

on *:TEXT:!social:#: { 
    if ((%floodsocial) || ($($+(%,floodsocial.,$nick),2))) { return } 
    set -u10 %floodsocial On 
    set -u30 %floodsocial. $+ $nick On 
    msg $chan The YouTube page is http://www.youtube.com/user/TheDailyMafia The Twitter page is http://twitter.com/DailyMafia Don't forget to follow and subscribe! $+ 
} 
on *:TEXT:!help:#: { 
    if ((%floodhelp) || ($($+(%,floodhelp.,$nick),2))) { return } 
    set -u10 %floodhelp On 
    set -u30 %floodhelp. $+ $nick On 
    msg $chan To learn the rules of mafia check out $+ 
} 
on *:TEXT:!cop:#: { 
    if ((%floodcop) || ($($+(%,floodcop.,$nick),2))) { return } 
    set -u10 %floodcop On 
    set -u30 %floodcop. $+ $nick On 
    msg $chan Every night the Cop picks a player who is currently alive to investigate or 「check」. The mod will then tell the Cop whether that player is town or mafia. Note: the Cop only finds out if the player is town or mafia and is not informed of any special role the player might have. $+ 
} 
on *:TEXT:!medic:#: { 
    if ((%floodmedic) || ($($+(%,floodmedic.,$nick),2))) { return } 
    set -u10 %floodmedic On 
    set -u30 %floodmedic. $+ $nick On 
    msg $chan Every night the Medic picks a player who is currently alive to protect or 「save」. This player is protected from 1 KP for that night phase (and that night phase only). If the player is hit with 2 KP the player will still die even if the Medic is protecting them. The Medic may not save himself, and unless otherwise state the Medic may save the same person on consecutive nights. $+ 
} 
on *:TEXT:!hypno:#: { 
    if ((%floodhypno) || ($($+(%,floodhypno.,$nick),2))) { return } 
    set -u10 %floodhypno On 
    set -u30 %floodhypno. $+ $nick On 
    msg $chan The Hypnotist has a one-time use power to use during the night. In order for the power to work both himself and the player the Hypnotist uses it on must be alive at the start of the following day. If the Hypnotists uses his power on you then you become hypnotized and must claim your role at the start of the next day. The first three words out of your mouth must be ‘I am *your role here*’. $+ 
} 
on *:TEXT:!vigi:#: { 
    if ((%floodvigi) || ($($+(%,floodvigi.,$nick),2))) { return } 
    set -u10 %floodvigi On 
    set -u30 %floodvigi. $+ $nick On 
    msg $chan The Vigilante is given a gun with one bullet for the entire game. The Vigilante may choose to shoot someone during the night phase (and only the night phase). If the Vigilante shoots a player who is medic protected that player will not die and the Vigilante will lose his bullet. If the Vigilante shoots a player who is also shot by the mafia the Vigilante will lose his bullet. $+ 
} 
on *:TEXT:!inno:#: { 
    if ((%floodinno) || ($($+(%,floodinno.,$nick),2))) { return } 
    set -u10 %floodinno On 
    set -u30 %floodinno. $+ $nick On 
    msg $chan The Innocent Child is a vanilla town confirmed at the very start of the game by mod. They have no power. $+ 
} 
on *:TEXT:!gunsmith:#: { 
    if ((%floodgunsmith) || ($($+(%,floodgunsmith.,$nick),2))) { return } 
    set -u10 %floodgunsmith On 
    set -u30 %floodgunsmith. $+ $nick On 
    msg $chan The gunsmith is a town sided role that is allowed to give out a gun during the night which the recipient can then shoot only during the day by saying a command such as, "I Shoot X". The guns have a 1 time use. $+ 
} 
on *:TEXT:!rafflesystem:#: { 
    if ((%floodgunsmith) || ($($+(%,floodgunsmith.,$nick),2))) { return } 
    set -u10 %floodgunsmith On 
    set -u30 %floodgunsmith. $+ $nick On 
    msg $chan We now have a point system for raffles. You earn Donks by being in chat and watching the games. To check how many Donks you have use !donks. When a raffle opens use !buytickets [number of tickets] to buy tickets for the raffle. $+ 
} 

代碼2:

on *:TEXT:!buytickets &:#:{ 
    if (!%raffle) { msg $chan Raffle is currently closed! } 
    else { 
    if ($int($2) < 1) { msg $chan Do you really want to buy no Tickets, $nick $+ ..? } 
    elseif ($int($2) > 1000) { msg $chan Sorry $nick but you can only buy up to 1000 raffle tickets at a time. } 
    else { 
     var %i = 0, %ticket = $int($2) 
     var %topic = $+(#,.,$nick), %user = $readini(Points.ini,%topic,Points), %end = 1 * %ticket, %delete = %user - %end 
     if (%delete > 0) { 
     writeini -n $qt(Points.ini) %topic Points %delete 
     while (%i < %ticket) { 
      write $qt(Raffle.txt) $nick 
      inc %i 
     } 
     msg $chan $nick you have bought %ticket tickets with %end Donks. 
     } 
    } 
    } 
} 
on *:TEXT:!raffle &:#:{ 
    if ($nick isop #) { 
    if (($2 == open) && (!%raffle)) || (($2 == close) && (%raffle)) { 
     msg $chan RAFFLE IS NOW $replace($upper($2!!),CLOSE,CLOSED) 
     if ($2 == open) { set %raffle 1 } 
     else unset %raffle 
     write -c $qt(Raffle.txt) 
    } 
    } 
} 
on *:TEXT:!roll:#:{ 
    if ($nick isop #) && (%raffle) { 
    msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK!! 
    .timerCD 1 3 msg $chan /me $!calc($!timer(CD).reps + 1) $!+ ! 
    .timer 1 4 msg $chan AND THE WINNER IS: 
    .timer 1 5 msg $chan $read(Raffle.txt, n) 
    unset %raffle 
    write -c $qt(Raffle.txt) 
    } 
} 

代碼3

alias -l addPoints { 
    if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt } 
    var %topic $+($chan,.,$nick) 
    var %points $calc($readini(Points.ini,%topic,Points) + $1) 
    writeini -n Points.ini %topic Points %points 
    return %points 
} 

alias -l lookUpPoints { 
    var %topic $+($chan,.,$nick) 
    var %points $readini(Points.ini,%topic,Points) 
    return %points 
} 
alias doaddpoints { 
    if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt } 
    var %topic $+($1,.,$2) 
    var %points $calc($readini(Points.ini,%topic,Points) + $3) 
    writeini -n Points.ini %topic Points %points 
    echo -a Added points for %topic 
} 

alias dorempoints { 
    var %topic $+($1,.,$2) 
    remini -n Points.ini %topic Points 
    echo -a Removed points for %topic 
} 

on *:text:!donks:#:{ 
    if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return } 
    set -u10 %floodpoints On 
    set -u30 %floodpoints. $+ $nick On 
    msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total donks. 
} 

on $*:text:/!donks (add|remove)/Si:#:{ 
    if ($nick isop #) { 
    if ($0 < 3) { msg # Insufficient parameters: Use !donks [add|remove] [user] [number] | return } 
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1)) 
    { msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total donks. } 
    } 
    else { msg $chan This command is only available to moderators. } 
} 

on *:TEXT:!donktime &:#:{ 
    if ($nick isop #) { 
    if (($2 == start) && (!%donktime)) || (($2 == stop) && (%donktime)) { 
     msg $chan DONKTIME IS NOW $replace($upper($2ED!!),CLOSE,CLOSED) 
     if ($2 == start) { set %donktime 1 } 
     else unset %donktown 
    } 
    } 
} 

on !*:join:#:{ 
    if (!%donktown) {halt} 
    else{ 
    $+(.timerpoints.,#,.,$nick) 0 1800 add.pts $+(#,.,$nick) 
    add.pts $+(#,.,$nick)} 
} 
on !*:part:#:$+(.timerpoints.,#,.,$nick) off 
alias -l add.pts { 
    writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) 
} 

預先感謝您的任何和所有幫助。

回答

0

這種問題不提供任何我們可以幫助你的代碼。基本上,我們要求我們提供代碼,而不會向我們展示您迄今爲止嘗試實現的目標,正如您目前所擁有的與您的請求並不完全相關的內容。爲此,沒有人會回答或幫助你。

我也是,即將搬到下一個問題,但既然我想看看我的mSL技能如何,我決定放棄它。

警告:

  • 我在殺死該系統,以增強我的MSL的技能,我以前說過。
  • 代碼沒有完全測試。
  • 我不會指導您如何調試問題,也不會將其集成到您的系統中,因爲我已經將它構建成幾乎儘可能通用和動態,以便於調試和集成,因此對於mSL經驗不多的人應該有如何使用這個代碼來達到他的目標。

代碼:

;### 
;### PointsTimer v1 
;### - Granting channel user points by fixed interval 
;### Programmer: Orel Eraki 
;### Contact: [email protected] 
;### 
;### Commands: !PointsTimer START|END|STATUS 

#PointsTimer on 
alias -l PointsTimer.Name return PointsTimer 
alias -l PointsTimer.Description return Granting channel user points by fixed interval. 
alias -l PointsTimer.Author return Orel Eraki ([email protected]) 
alias -l PointsTimer.Version return 1 

;### Settings 
alias -l PointsTimer.Channel return #TestTest 
alias -l PointsTimer.Idle return 20 
alias -l PointsTimer.PointsFile return Points.ini 
alias -l PointsTimer.Status return $iif(%PointsTimer, $true, $false) 

;### Messages 
alias -l PointsTimer.MsgStarted return System has been Started. 
alias -l PointsTimer.MsgEnded return System has been Ended. 
alias -l PointsTimer.MsgAlreadyStarted return System already been started. 
alias -l PointsTimer.MsgNotStarted return System didn't started yet. 

;### Events 
on *:QUIT: .PointsTimer END-FOR-NICK $nick 
on me:*:PART:$($PointsTimer.Channel): .PointsTimer END 
on me:*:JOIN:$($PointsTimer.Channel): .PointsTimer END 
on !*:PART:$($PointsTimer.Channel): .PointsTimer.SetNickTimer $nick OFF 
on !*:JOIN:$($PointsTimer.Channel): { 
    if (!$PointsTimer.Status) { 
    return 
    } 
    PointsTimer START-FOR-NICK $nick 
} 
on *:NICK: { 
    if (!$PointsTimer.Status) { 
    return 
    } 
    PointsTimer RENAME $nick $newnick 
} 

on *:TEXT:!PointsTimer INFO:$($PointsTimer.Channel): { 
    PointsTimer.Msg # $PointsTimer.Name v $+ $PointsTimer.Version By $PointsTimer.Author 
    PointsTimer.Msg # $PointsTimer.Description 
} 

on @*:TEXT:!PointsTimer *:$($PointsTimer.Channel): { 
    if ($2 == START) { 
    if ($PointsTimer.Status) { 
     PointsTimer.Msg # $PointsTimer.MsgAlreadyStarted 
     return 
    } 

    PointsTimer START # 
    if ($PointsTimer.Status) { 
     PointsTimer.Msg # $PointsTimer.MsgStarted 
    } 
    } 
    else if ($2 == END) { 
    if (!$PointsTimer.Status) { 
     PointsTimer.Msg # $PointsTimer.MsgNotStarted 
     return 
    } 
    PointsTimer END # 
    if (!$PointsTimer.Status) { 
     PointsTimer.Msg # $PointsTimer.MsgEnded 
    } 
    } 
    elseif ($2 == STATUS) { 
    PointsTimer.Msg # System is currently $iif($PointsTimer.Status, ON, OFF) 
    } 
} 

;### Commands 
alias PointsTimer { 
    if ($1 == START) { 
    if ($PointsTimer.Status || $2 !ischan) { 
     return 
    } 

    inc %PointsTimer 
    PointsTimer.SetNicksTimer $PointsTimer.GetChannelNicks($2) 
    } 
    elseif ($1 == END) { 
    if (!$PointsTimer.Status) { 
     return 
    } 

    unset %PointsTimer 
    .timerPointsTimer.* off 
    } 
    elseif ($1 == START-FOR-NICK) { 
    if (!$PointsTimer.Status || !$ial($+($2,!*@*))) { 
     return 
    } 

    PointsTimer.SetNickTimer $2 
    } 
    elseif ($1 == END-FOR-NICK) { 
    if (!$PointsTimer.Status) { 
     return 
    } 

    PointsTimer.SetNickTimer $2 OFF 
    } 
    elseif ($1 == RENAME) { 
    .timer 1 0 PointsTimer END-FOR-NICK $2 
    .timer 1 1 PointsTimer START-FOR-NICK $3 
    } 
    else { 
    PointsTimer.Echo Unknown command $1 
    } 
} 

alias -l PointsTimer.Msg msg $1 * PointsTimer: $2- 
alias -l PointsTimer.Echo echo $color(info) -agt * PointsTimer: $1- 

alias -l PointsTimer.GetChannelNicks { 
    if ($1 !ischan) { 
    return 
    } 

    var %i = 1, %n = $nick($1, 0) 
    var %results 
    while (%i <= %n) { 
    %results = $addtok(%results, $nick($1, %i), 44) 
    inc %i 
    } 
    return %results 
} 

alias -l PointsTimer.SetNickTimer $+(.timerPointsTimer.,$1) $iif($2 == OFF, OFF,0 $PointsTimer.Idle Add.PTS $1) 

alias -l PointsTimer.SetNicksTimer { 
    var %results 
    var %i = 1, %n = $numtok($1, 44) 
    while (%i <= %n) { 
    PointsTimer.SetNickTimer $gettok($1, %i, 44) 
    inc %i 
    } 
} 

alias -l Add.PTS writeini -n $PointsTimer.PointsFile $1 Points $calc($readini($PointsTimer.PointsFile, $1, Points) + 1) 
#PointsTimer End