;========================= ; Dialogs ;========================= dialog ircduel { title "IRC Duel" size -1 -1 141 104 option dbu box "IRC Duel by josh1billion", 1, 1 2 139 101 button "Game", 2, 12 20 37 12 button "Host", 3, 74 20 37 12 text "In order to play, there must be someone acting as the host. The host will keep track of scores. Only one fight may be going on at a time. If two people are already dueling, no others may duel on that host's 'server' until they finish or the host ends the game.", 4, 13 35 100 49 button "Close", 5, 47 87 37 12, ok } dialog ircduelgame { title "IRC Duel" size -1 -1 275 222 option dbu box "IRC Duel", 1, 1 0 271 216 text "Written by josh1billion", 2, 9 13 56 8 box "Duel Request", 3, 5 23 260 62 button "Send Challenge", 4, 221 40 39 12 text "Player2:", 5, 12 34 22 8 edit "", 6, 10 46 94 10 text "Your HP:", 7, 108 34 25 8 edit "", 8, 106 46 50 10 text "Player2's HP:", 9, 157 34 33 8 edit "", 10, 157 46 50 10 box "Game", 11, 5 88 260 42 button "Attack", 12, 109 106 37 12 box "Scores", 13, 5 140 260 50 edit "", 14, 170 11 94 10 text "Game Host:", 15, 137 12 30 8 button "Show my Score", 16, 29 161 71 12 button "Show Everyone my Score", 17, 150 162 92 12 button "Close", 18, 109 194 37 12, ok button Accept Challenge, 19, 218 56 45 12 edit "", 20, 10 70 50 10 edit "", 21, 64 70 50 10 text "Your minimum hit:", 22, 10 60 48 8 text "Your maximum hit:", 23, 64 60 44 8 edit "", 24, 118 70 50 10 text "P2 minimum hit:", 25, 118 60 44 8 edit "", 26, 173 70 50 10 text "P2 maximum hit:", 27, 172 60 44 8 } dialog ircduelhost { title "IRC Duel - Host Options" size -1 -1 141 104 option dbu text "Channel:", 1, 8 18 24 9 box "IRC Duel - Hosting Options", 2, 2 5 136 97 edit "", 3, 7 30 117 10 text "Set the channel to your channel (chatroom) where all the events will take place. You can also End Current Duel if needed.", 4, 9 48 114 24 button "OK", 5, 46 81 37 12, ok button "End Current Duel", 6, 80 17 45 12 } ;========================= ; Dialog Actions ;========================= ;-------------------------------------------- ; Editbox Replacements / Variable Settings ;-------------------------------------------- on *:dialog:ircduelhost:init:0: { /did -a ircduelhost 3 %fightingchannel } on *:dialog:ircduelgame:init:0: { /did -a ircduelgame 20 %p1minhit | /did -a ircduelgame 21 %p1maxhit | /did -a ircduelgame 24 %p2minhit | /did -a ircduelgame 26 %p2maxhit | /did -a ircduelgame 14 %ircduelhostname | /did -a ircduelgame 6 %ircduelchallengenick | /did -a ircduelgame 8 %ircduelchallengehp1 | /did -a ircduelgame 10 %ircduelchallengehp2 } on *:LOAD: { set %p1minhit 1 | set %p1maxhit 5 | set %p2minhit 1 | set %p2maxhit 5 | set %fightingchannel #channelname | set %ircduelhostname Nick | set %ircduelchallengenick Nick | set %ircduelchallengehp1 10 | set %ircduelchallengehp2 10 } ;---------------- ; Button Commands ;---------------- alias duelhostupdate { set %fightingchannel $did(ircduelhost,3) } alias duelgameupdate { set %p1minhit $did(ircduelgame,20) | set %p2minhit $did(ircduelgame,24) | set %p2maxhit $did(ircduelgame,26) | set %p1maxhit $did(ircduelgame,21) | set %ircduelhostname $did(ircduelgame,14) | set %ircduelchallengenick $did(ircduelgame,6) | set %ircduelchallengehp1 $did(ircduelgame,8) | set %ircduelchallengehp2 $did(ircduelgame,10) } on *:dialog:ircduelgame:sclick:4: { duelgameupdate | ctcp %ircduelhostname fightstart %ircduelchallengenick %ircduelchallengehp1 %ircduelchallengehp2 %p1minhit %p1maxhit %p2minhit %p2maxhit } on *:dialog:ircduelgame:sclick:19: { ctcp %ircduelhostname acceptchallenge } on *:dialog:ircduelgame:sclick:16: { ctcp %ircduelhostname score } on *:dialog:ircduelgame:sclick:18: { duelgameupdate } on *:dialog:ircduelgame:sclick:17: { ctcp %ircduelhostname scoreall } on *:dialog:ircduelgame:sclick:12: { ctcp %ircduelhostname attack } on *:dialog:ircduelhost:sclick:5: { duelhostupdate } on *:dialog:ircduel:sclick:2: { dialog -mr ircduelgame ircduelgame } on *:dialog:ircduel:sclick:3: { dialog -mr ircduelhost ircduelhost } on *:dialog:ircduelhost:sclick:6: { set %turn 0 | set %duelrequest 0 | msg %fightingchannel DUEL TERMINATED. } ;========================= ; Fighting ;========================= ctcp 1:fightstart:*: { if (%turn == 0) { set %player1 $nick set %player2 $$2 set %player1max $$3 set %player1hp $$3 set %player2max $$4 set %player2hp $$4 set %duelrequest 1 set %p1minhit $$5 set %p1maxhit $$6 set %p2minhit $$7 set %p2maxhit $$8 msg %fightingchannel %player1 challenges %player2 to a duel! Settings: %player1 VS %player2 $+ , %player1 with $$3 HP and %player2 with $$4 HP, %player1 doing %p1minhit $+ - $+ %p1maxhit $+, while %player2 does %p2minhit $+ - $+ %p2maxhit $+ . %player2 click Accept Challenge in the game to accept, or don't do anything to ignore. } if not (%turn == 0) { /timermsguser -o 1 5 msg $nick Sorry, a duel is already in progress. } } ctcp 1:acceptchallenge:*: { if (%duelrequest == 1) { if (%player2 == $nick) { set %duelrequest 0 set %turn 1 msg %fightingchannel DUEL STARTED! %player1 strikes first. Click the Attack button now, %player1 $+ . } } } ctcp 1:attack:*: { if (%player1 == $nick) { if (%turn == 1) { set %damage $rand(%p1minhit,%p1maxhit) msg %fightingchannel %player1 attacks %player2 for %damage damage. dec %player2hp %damage msg %fightingchannel %player2 $+ 's current HP: %player2hp $+ / $+ %player2max set %turn 2 if %player2hp < 1 { set %turn 0 msg %fightingchannel %player1 has defeated %player2 $+ ! inc % $+ %player1 $+ score 1 dec % $+ %player2 $+ score 1 set %turn 0 } } } if (%player2 == $nick) { if (%turn == 2) { set %damage $rand(%p2minhit,%p2maxhit) msg %fightingchannel %player2 attacks %player1 for %damage damage. dec %player1hp %damage msg %fightingchannel %player1 $+ 's current HP: %player1hp $+ / $+ %player1max set %turn 1 if %player1hp < 1 { set %turn 0 msg %fightingchannel %player2 has defeated %player1 $+ ! inc % $+ %player2 $+ score 1 dec % $+ %player1 $+ score 1 set %turn 0 } } } } ctcp 1:score:*: { /timermsg $+ $nick $+ score -o 1 5 msg $nick Your score: % $+ $nick $+ score } ctcp 1:scoreall:*: { /timermsg $+ $nick $+ score -o 1 5 msg %fightingchannel $nick $+ 's score: % $+ $nick $+ score } ;================= ; Menus ;================= menu query,nicklist,menubar,channel { Josh Software .IRC Duel v1.1: { dialog -mr ircduel ircduel } } alias ircduel { /dialog -mr ircduel ircduel }