Password Of The Day Auto-Update Script

Apr 25, 2006 05:44 Password Of The Day Auto-Update Script
################################################################################################
This script can snag passwords from the bots specific by their nick's as specified in the "updatebotnick" alias. Here's the code. Original structure by jhood and Jason#8 with additional functionality, comments, and variable naming conventions by yours truly.

[code:1:62124ac05b];; *** WINBOLO PASSWORD OF THE DAY AUTO-UPDATE SCRIPT FOR ANYBOT ***
;; *** Version 1.4 Standalone Version ***
;; *** Written By Jason#8, Jhood, and Sticks ***
;; *** For Help or Support, Contact Me in IRC or Send me an Email ***
;; *** at Racer7 *AT* gmail.com ***

;; To add a new bot all you have to do is add a similar line to the alias
;; of 'updatebotnick' and increment the number by one. For example, to
;; add another bot named 'East' you would write the following line at the
;; end of the 'updatebotnick' alias:
;;
;; set %potd.bot09 East
;;
;; Also, you need to modify one line of code, which is the first if() statement
;; in the on TEXT event that looks for * map*. Simply add the following inside
;; the last parenthesis (including a space before the double pipes -- the vertical
;; bars):
;;
;; || ($1 == %potd.bot09)
;;


;; This alias is used to update and assign the bot names to particular variables as
;; well as update the channel in which this bot should watch. Instead of having to
;; search through the whole script looking for each reference of a particular bot or
;; the channel, you can simply change their values here and they will reflect later
;; on in the script.
;; To run this alias simply type "/updatebotnick" in any window without quotes.
alias updatebotnick {
echo -a ::: Updating bot nickname's and other variables...
set %potd.channel #winbolo
set %potd.bot01 alexmbot
set %potd.bot02 acrobot
set %potd.bot03 boombot
set %potd.bot04 bottie
set %potd.bot05 bluebot
set %potd.bot06 nycbot
set %potd.bot07 renbot
set %potd.bot08 pawnybot
echo -a ::: Update done!
}

;; An explanation on the syntax used: what is happening here is that
;; the %potd.botNN variable (which hold the names of bots) is being
;; evaluated. The $+ identifier concatenates what is on the left
;; hand side with what is on the right hand side. The brackets simply
;; allow variables to be evaluated and everything to be parsed nicely.
;; Thus, after the set operation executes you have something that looks
;; like the following step by step..
;; [ % $+ [ alexmbot ] $+ pass ]
;; [ %alexmbotpass ]
;; %alexmbotpass
on *:TEXT:* - password*:%potd.channel: {
;; Player used a custom password and the bot they wished to map it is
;; currently reporting the game creation.
if ((%potd.customPassword == yes) && (%potd.botUsed == $nick)) {
echo %potd.channel ::: Halting password processing due to custom password
halt
}
echo %potd.channel ::: Processing password from $nick $+ ...
set %pass.string $1-
;; The $left() identifier will strip the trailing control code from the token
set %password $left($gettok(%pass.string, -1, 32), -1)
if ($nick == %potd.bot01) set [ % $+ [ %potd.bot01 ] $+ pass ] %password
elseif ($nick == %potd.bot02) set [ % $+ [ %potd.bot02 ] $+ pass ] %password
elseif ($nick == %potd.bot03) set [ % $+ [ %potd.bot03 ] $+ pass ] %password
elseif ($nick == %potd.bot04) set [ % $+ [ %potd.bot04 ] $+ pass ] %password
elseif ($nick == %potd.bot05) set [ % $+ [ %potd.bot05 ] $+ pass ] %password
elseif ($nick == %potd.bot06) set [ % $+ [ %potd.bot06 ] $+ pass ] %password
elseif ($nick == %potd.bot07) set [ % $+ [ %potd.bot07 ] $+ pass ] %password
elseif ($nick == %potd.bot08) set [ % $+ [ %potd.bot08 ] $+ pass ] %password
echo %potd.channel ::: Password added!
}

on *:TEXT:* map*:%potd.channel: {
echo %potd.channel ::: $nick is starting a game
;; First word user said is a bot's name, which means they are trying to spawn a map.
if (($1 == %potd.bot01) || ($1 == %potd.bot02) || ($1 == %potd.bot03) || ($1 == %potd.bot04) || ($1 == %potd.bot05) || ($1 == %potd.bot06) || ($1 == %potd.bot07) || ($1 == %potd.bot08)) {
if ($2 == mappw) {
set %potd.botUsed $1
set %potd.customPassword yes
}
elseif ($2 == map) {
set %potd.botUsed $1
set %potd.customPassword no
}
}
}

;; Please see the mIRC help file to explain how $eval() works.
on *:TEXT:potd:%potd.channel: {
msg %potd.channel Passwords are as follows:
if (%potd.bot01 ison %potd.channel) msg %potd.channel %potd.bot01 => $eval(% $+ %potd.bot01 $+ pass, 2)
if (%potd.bot02 ison %potd.channel) msg %potd.channel %potd.bot02 => $eval(% $+ %potd.bot02 $+ pass, 2)
if (%potd.bot03 ison %potd.channel) msg %potd.channel %potd.bot03 => $eval(% $+ %potd.bot03 $+ pass, 2)
if (%potd.bot04 ison %potd.channel) msg %potd.channel %potd.bot04 => $eval(% $+ %potd.bot04 $+ pass, 2)
if (%potd.bot05 ison %potd.channel) msg %potd.channel %potd.bot05 => $eval(% $+ %potd.bot05 $+ pass, 2)
if (%potd.bot06 ison %potd.channel) msg %potd.channel %potd.bot06 => $eval(% $+ %potd.bot06 $+ pass, 2)
if (%potd.bot07 ison %potd.channel) msg %potd.channel %potd.bot07 => $eval(% $+ %potd.bot07 $+ pass, 2)
if (%potd.bot08 ison %potd.channel) msg %potd.channel %potd.bot08 => $eval(% $+ %potd.bot08 $+ pass, 2)
}[/code:1:62124ac05b]
Apr 25, 2006 17:55
One problem is that the script checks to see if the bot is in the channel. If it is, it reports what the password should be from a specified variable.

The problem comes when a game has not been started by a specified bot since this script has been initialized yet it's still in the channel. The script will still spit out the bot's name, however, it will not spit out any password for it. I will correct this by Wednesday morning.
May 12, 2007 21:31
cool stuff.

WBB 4.0 interacts with WBr, making this script possible

[code:1:8736650d3f]
;===========================================================================================
;;Reconizing New bots

on *:text:New bot 57894:?:{
var %numberbots = $numtok(%winbolo.bots, 44)
var %0 = 1
:checkifbot2
if (%0 > %numberbots) goto endofjoincheckpass2
if ($nick == $gettok(%winbolo.bots , %0 , 44)) { }
else {
inc %0 1
goto checkifbot2
}
:endofjoincheckpass2
set %winbolo.bots %winbolo.bots $+ , $+ $nick
}

;===========================================================================================
;;POTD

on *:join:#winbolo:{
var %numberbots = $numtok(%winbolo.bots, 44)
var %0 = 1
:checkifbot
if (%0 > %numberbots) goto endofjoincheckpass
if ($nick == $gettok(%winbolo.bots , %0 , 44)) msg $nick Whats your pass?
else {
inc %0 1
goto checkifbot
}
:endofjoincheckpass
}

on *:quit:{
var %numberbots = $numtok(%winbolo.bots, 44)
var %0 = 1
:checkifbot
if (%0 > %numberbots) goto endofjoincheckpass
if ($nick == $gettok(%winbolo.bots , %0 , 44)) {
var %bot = $nick
if (%bot isin %passwords) {
var %tok = $findtok(%passwords, $wildtok(%passwords, %bot $+ *, 1, 44), 1, 44)
set %passwords $deltok(%passwords, %tok, 44)
}
}
else {
inc %0 1
goto checkifbot
}
:endofjoincheckpass
}

on *:part:#winbolo:{
var %numberbots = $numtok(%winbolo.bots, 44)
var %0 = 1
:checkifbot
if (%0 > %numberbots) goto endofjoincheckpass
if ($nick == $gettok(%winbolo.bots , %0 , 44)) {
var %bot = $nick
if (%bot isin %passwords) {
var %tok = $findtok(%passwords, $wildtok(%passwords, %bot $+ *, 1, 44), 1, 44)
set %passwords $deltok(%passwords, %tok, 44)
}
}
else {
inc %0 1
goto checkifbot
}
:endofjoincheckpass
}

on *:text:Pass is*:?:{
var %numberbots = $numtok(%winbolo.bots, 44)
var %0 = 1
:checkifbot1
if (%0 > %numberbots) goto endofjoincheckpass1
if ($nick == $gettok(%winbolo.bots , %0 , 44)) {
var %bot = $nick
var %pass = $3
if (%bot isin %passwords) {
var %tok = $findtok(%passwords, $wildtok(%passwords, %bot $+ *, 1, 44), 1, 44)
set %passwords $deltok(%passwords, %tok, 44)
set %passwords %passwords $+ , $+ %bot $+ . $+ %pass
}
else set %passwords %passwords $+ , $+ %bot $+ . $+ %pass
}
else {
inc %0 1
goto checkifbot1
}
:endofjoincheckpass1
}

on *:text:potd:#winbolo:{
var %0 = 1
var %totalpass = $numtok(%passwords, 44)
:setanotherpass
if (%0 > %totalpass) { goto endofpotd }
var %botnpass = $gettok(%passwords, %0, 44)
var %potd.bot = $gettok(%botnpass, 1, 46)
var %potd.pass = $gettok(%botnpass, 2, 46)
if (%0 == 1) { var %potd = The Passwords are as follows: %potd.bot $+ 's is %potd.pass }
else { var %potd = %potd $+ $chr(124) %potd.bot $+ 's is %potd.pass }
inc %0 1
goto setanotherpass
:endofpotd
msg $chan %potd
}
[/code:1:8736650d3f]