I wanted to try learning something a bit more complicated, so I started looking at token identifiers..$istok looked easiest to me, so..
Just load this into your remotes and whenever someone says whatever you set it to...it, well..replies.
It's very useless, unless you wanna view it as some kind of guise for istok, I don't know.. Is ready for flamer wars
on *:load: {
set %text.1 $$?="What do you want the script to reply to?"
set %text.2 $$?="Another text?"
set %reply.1 $$?="Reply to the text?"
set %reply.2 $$?="The second reply?"
set %reply.3 $$?="The third reply?"
set %reply.4 $$?="The fourth reply.."
}
on *:text:*:*: {
set %randomreply $r(1,4)
if ($istok(%text.1 %text.2,$1,32)) {
if (%randomreply == 1) { msg $chan %reply.1 | halt }
if (%randomreply == 2) { msg $chan %reply.2 | halt }
if (%randomreply == 3) { msg $chan %reply.3 | halt }
if (%randomreply == 4) { msg $chan %reply.4 | halt }
unset %randomreply
}
}
$r(1,4) = $rand(1,4), second using slackers code would not work if your reply vars are more than 1 word long. Third you don't use set for the random reply variable use /var as its local and you don't have to worry about a global variable. Lastly,
on *:text:*:*: {
if ($istok(%text.1 %text.2,$1,32)) { msg $chan $eval($+(%,reply.,$r(1,4)),2) }
}
on *:text:*:*: {
if ($istok(%text.1 %text.2,$1,32)) { msg $chan $gettok(%reply.1 %reply.2 %reply.3 %reply.4,$r(1,4),32) }
}
I don't see where that'd look for my variable %randomreply.
on *:text:*:*: {
set %randomreply $r(1,4)
I am trying to use that to reply depending on what the $r(1,4) sets, not just randomly reply with one of my four %reply.N's.