All aliases should always be single blocks only. This is useful for separating code functions that can be accessed at the right time.
To determine the name of the channel, it is correct to use the identifier
$chan, instead of using the
# sign:
alias -l battle {
if (%startbattle) {
if (%easyboss == An Angry Cow (HP: 30)) { var %bosshealth 30 }
if (%easyboss == A Spider (HP: 40)) { var %bosshealth 40 }
if (%easyboss == A Goblin (HP: 50)) { var %bosshealth 50 }
.msg $chan The Damage from chat is %chatattack $+ . The boss has %bosshealth HP
if (%damage >= %bosshealth) { .msg $chan You killed the boss! | return }
if (%damage < %bosshealth) { .msg $chan The boss wiped out the chat! | return }
}
else { return }
}
You can also, if necessary, pass any parameters to the alias you need:
on *:TEXT:!battle*:#:{
...
.timerBattle 1 120 battle $chan
...
}
alias -l battle {
if (%startbattle) {
if (%easyboss == An Angry Cow (HP: 30)) { var %bosshealth 30 }
if (%easyboss == A Spider (HP: 40)) { var %bosshealth 40 }
if (%easyboss == A Goblin (HP: 50)) { var %bosshealth 50 }
.msg $1 The Damage from chat is %chatattack $+ . The boss has %bosshealth HP
if (%damage >= %bosshealth) { .msg $1 You killed the boss! | return }
if (%damage < %bosshealth) { .msg $1 The boss wiped out the chat! | return }
}
else { return }
}
In this case, the first parameter
$1 will be the name of the channel that was passed through the "
battle $chan" alias command.