Below is some code I have written for my ever growing bird-related chat bot.
If I use the mIRC consolse, I can execute the alias blocks (eg. //fchirp [user] ), but for some reason, the bot doesn't acknowledge somebody typing "!chirp" from the main chat window. It doesn't even execute the first //echo statement in the on-text-event.
The weirdest part is: this code worked before and I've been using it regularly. I haven't changed any part of what is shown here aside from the //echo statements which I use for debugging.
addWorms and giveWorms are both aliases I wrote and function correctly on their own. The main issue I'm running into is get the bot to do anything at all when someone types"!chirp". (It should be noted that other unrelated on-text-events earlier in the code work just fine with identical syntax.)
alias fchirp {
/writeini chirp.ini $1 First $adate
/writeini chirp.ini $1 Last $adate
/writeini chirp.ini $1 Count 1
msg $chan /w $1 Welcome to the Nest! Thanks for checking in! :D
addWorms $1
msg $chan /w $1 Type !worms to see how many you have!
//echo -a first chirp
}
alias chirp {
var %a $readini(chirp.ini, $1, Count)
var %count $calc( %a + 1 )
if ( $readini(worms.ini, $1, Breed) == $null ) {
addWorms $1
//echo -a addWorms done
}
if ( $readini(chirp.ini, $1, Last) === $adate ) { msg $chan /w $nick You've already checked in today! BabyRage | halt }
/writeini chirp.ini $1 Last $adate
/writeini chirp.ini $1 Count %count
//echo -a last/count updated
if ( $calc( $readini(chirp.ini, $1, Count) % 5 ) == 0 ) {
giveWorms $1 10
msg $chan /w $1 Welcome back! Lucky day!
}
else {
giveWorms $1 5
msg $chan /w $1 Welcome back! Here's your worms! Don't forget to !hunt ! ^_^
}
//echo -a giveWorms
}
on *:TEXT:!chirp:#: {
//echo -a acknowledged
if ( $readini(chirp.ini, $nick, First) != $null ) {
//echo -a true
chirp $nick
}
else {
//echo -a false
fchirp $nick
}
msg $chan /w $nick Don't forget to !hunt for worms! :D
}
The Event catching can be interfere by two main reasons.
Error
You have an error above your code on the same remote file. e.g. missing bracket or syntax error.
Other event already been captured
mIRC will not process event that already been matched by another pattern on the same file.
example.ini
You can merge your TEXT events to handle both actions, although if they aren't logic related, i would separated them for another remote file.
Remark:
/
is useless on alias/popup/remote code, and it is just for identifying text vs commands for console mIRC window.