; Alcar's Init Script, Version 2 ; This is a 3rd edition init script that lets you adds your Init mofidier ; to the d20 roll. It also allows you to add 1 NPC to the init (The bot) ; multiple ones as NPC1, NPC2 etc. and as actual nicks, such as Bob, Jeff. ; Send_Alcar_Money etc.. The ones to change the DM's nick (!npc nick and ; !nodm) work with the GM script. If you don't want to use it, add: ; on *:text:!initdm *:*:{ if %gm.1 == $null { set %gm.1 $$2 | msg $nick %gm.1 is GMing the game. } | else { msg $nick The %gm.1 has been removed from the init. | unset %gm.1 } } ; To the file instead. You'd also need to add it to the end of the ; !init help stuff as an additional command. ; Contact Alcar with any problems. Note that this script was made for mirc ; 5.8 but should work with any version that has the $sorttok command in it. ; Lastly, it must be loaded into the main MIRC directory, and creates an ; initmod.txt file there. If for some reason it won't create the file, ; make an initmod.txt file yourself in the MIRC directory and things should ; be fine. ; Good luck :) ;This tells people what the bot does. on *:text:!init help:#:{ msg $chan !npcs sets $me as all npcs. Typing !npcs again will turn that off. : !nodm takes the DM (If one is set) out of the init. Typing it again retores the dm. : !npcnick on replaces the DM's nick with an NPCs. !npcnick off cancels that. : !addnpc adds a number of NPCs to the init. !removenpc gets rid of them. : !addnpcnicks etc. adds NPCs as actual nicks, not numbers. !removenpcnicks cancels that. | msg $chan !mod +/- sets your init modifier, such as +5. : !initname checks the file for the modifier of a nick. : !remind posts the init again. } on *:text:!init help:?:{ msg $nick !npcs sets $me as all npcs. Typing !npcs again will turn that off. : !nodm takes the DM (If one is set) out of the init. Typing it again retores the dm. : !npcnick on replaces the DM's nick with an NPCs. !npcnick off cancels that. : !addnpc adds a number of NPCs to the init. !removenpc gets rid of them. : !addnpcnicks etc. adds NPCs as actual nicks, not numbers. !removenpcnicks cancels that. | msg $nick !mod +/- sets your init modifier, such as +5. : !initname checks the file for the modifier of a nick. : !remind posts the init again. } ;As the executer of this script (presumed a bot) is removed from init, ;this can add them in as 1 roll for all NPCs. on *:text:!npcs:*: { if (%npcs == $null) { set %npcs on | msg $nick NPCs are on. } | else { unset %npcs | /msg $nick NPCs are off } } ;This removes the DM's nick from init. on *:text:!nodm:*: { if (%nodm == $null) { set %nodm on | msg $nick the DM is in the init. } | else { unset %nodm | msg $nick The DM is out of the init } } ;This changes the DMs nick to that of an NPC in the init. on *:text:!npcnick on *:*: { set %dmnick $3- | /msg $nick The DM is now %dmnick } ;This changes the DMs nick back to the normal one. on *:text:!npcnick off:*: { msg $nick The DM is no longer %dmnick | unset %dmnick } ;Adds NPCs as NPC1, NPC2 etc. If people abuse it, set a max number of NPCs. on *:text:!addnpc *:*:{ set %npcnum $2 | msg $nick $2 NPCs have been added to the init. To remove them, type !removenpc. } ;Removes the added NPCs. on *:text:!removenpc:*:{ unset %npcnum | msg $nick NPCs are off now. } ;This adds NPCs as nicks. So !addnpcnicks Bob, Linda, John would produce: ;12: Bob(NPC1), 10: Linda(NPC2), 1: John(NPC3) for example. If !addnpc ;is in use, this command can not be as well. on *:text:!addnpcnicks *:*:{ if (%npcnum != $null) { msg $nick Sorry, there are currrently %npcnum npcs set. Type !removenpc to get rid of them, then this script will work. } | else { set %npcnicks $2- | msg $nick The NPCs in the init are now: $2- } } ;This removes the added NPC nicks. on *:text:!removenpcnicks:*:{ unset %npcnicks | msg $nick The NPCs have left the init. } ;The init script! This script works on anyone voices (+v) or opped (+o) ;in the channel. on *:text:!init:#:{ /write -l1 initmod.txt set %init.chan $nick(#,0,a,r) set %init.loop 0 while (%init.loop < %init.chan) { inc %init.loop 1 set %init.nick $nick(#,%init.loop,a,r) ;This stops the init from effecting the bot, anyone with dice in their ;nick. 2 other nicks, \\`arner and sin{away} are added so you can remove ;them or replace them with other nicks you don't want to end up in init. if ((%init.nick == $me) && (%npcs != on)) || (dice isin %init.nick) || (\\`arner isin %init.nick) || (Sin{away} isin %init.nick) { goto next } ;This sets the bot as the npcs is !npcs is functioning. if ((%npcs == on) && (%init.nick == $me)) { set %init.nick NPCs } ;This removes the GM from init if ((%init.nick == %gm.1) && (%nodm == $null)) { goto next } ;This changes the GM's nick in the init if ((%init.nick == %gm.1) && (%dmnick != $null)) { set %init.nick %dmnick } set %init.reading $read -s $+ %init.nick initmod.txt if (%init.reading != $null) { set %init.readtok $gettok(%init.reading,1,32) | set %init.calc $calc($r(1,20) %init.readtok) ;This checks the init modifier. set %init.nick %init.calc $+ ( $+ %init.readtok $+ ) $+ $+ $chr(58) $+ $chr(35) $+ %init.nick $+ $chr(44) $+ $chr(46) } else { set %init.calc $r(1,20) set %init.nick %init.calc $+ $+ $chr(58) $+ $chr(35) $+ %init.nick $+ $chr(44) $+ $chr(46) } /write -al1 initmod.txt %init.nick :next } ;This adds NPCs as numbers into the init. if (%npcnum != $null) { set %init.loop2 0 while (%init.loop2 < %npcnum) { inc %init.loop2 1 set %init.nick NPC $+ %init.loop2 set %init.calc $r(1,20) set %init.nick %init.calc $+ $+ $chr(58) $+ $chr(35) $+ %init.nick $+ $chr(44) $+ $chr(46) write -al1 initmod.txt %init.nick } } ;This adds the NPC's as nicks into the init. if ((%npcnicks != $null) && (%npcnum == $null)) { set %init.loop3 0 set %init.totalnpc $numtok(%npcnicks,32) while (%init.loop3 < %init.totalnpc) { inc %init.loop3 1 set %init.nick $gettok(%npcnicks,%init.loop3,32) $+ (NPC $+ %init.loop3 $+ ) set %init.calc $r(1,20) set %init.nick %init.calc $+ $+ $chr(58) $+ $chr(35) $+ %init.nick $+ $chr(44) $+ $chr(46) write -al1 initmod.txt %init.nick } } ;This stuff sorts the init and makes it look pretty. set %init.read $read -l1 -n initmod.txt set %init.change $replace(%init.read,$chr(46),$chr(32)) set %init.sort $sorttok(%init.change,32,nr) set %init.show $replace(%init.sort,$chr(35),$chr(32)) ;This removes the last comma from the init :) set %init.anal $gettok(%init.show,$numtok(%init.show,32),32) set %init.anal2 $remove(%init.anal,$chr(44)) set %init.end $reptok(%init.show,%init.anal,%init.anal2,32) msg # %init.end set %remind.init %init.end unset %init.* } ;This tells people the init if they have forgotten it. on *:text:!remind*:#:{ msg $chan %remind.init } on *:text:!remind*:?{ msg $nick %remind.init } ;This tells people how to add init modifiers. on *:text:!mod:*:{ msg $nick To add your init, type !mod +/-number, such as +5 or -3. To see a current one, type !initname nick } ;This allows people to add their mofifiers to the init. on *:text:!mod *:*:{ set -u10 %mod.check $read -s $+ $nick initmod.txt | set -u10 %mod.readn $readn | if %mod.check == $null { write initmod.txt $nick $2 | /msg $nick Your init mod is $2 } | else { /write -l $+ %mod.readn initmod.txt $nick $2 | /msg $nick Your new init mod is $2 } } ;Same this as !mod. on *:text:!initmod:*:{ msg $nick To add your init, type !initmod +/-number, such as +5 or -3. To see a current one, type !initname nick } on *:text:!initmod *:*:{ set -u10 %mod.check $read -s $+ $nick initmod.txt | set -u10 %mod.readn $readn | if ($2 == 0) { goto next } | set -u10 %mod.num $r(1,20) | set -u10 %mod.calc $calc(%mod.num $2) | if (%mod.calc != %mod.num) { goto next } | else { msg $nick Sorry, you don't pass go. Mods must be + or - | halt } | :next | if %mod.check == $null { write initmod.txt $nick $2 | msg $nick Your init mod is $2 } | else { write -l $+ %mod.readn initmod.txt $nick $2 | msg $nick Your new init mod is $2 } } ;This tells you the current init modifier for a nick. on *:text:!initname *:#:{ msg $chan $nick has a mod of $read -s $+ $2 initmod.txt } on *:text:!initname *:?:{ msg $nick $nick has a mod of $read -s $+ $2 initmod.txt }