mIRC Home    About    Download    Register    News    Help

Print Thread
#208365 19/01/09 06:46 AM
Joined: Dec 2005
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2005
Posts: 22
Hi all,

prob something simple so any help is appreciated.

Below is my code:

on *:topic:*: {
if (!join isin $1- && # == #trivia) {
/msg #trivia !join
}
}

Basically there is 2 trivia channels. #trivia and #trivia1

What im trying to do is if a game starts in #trivia or #trivia1 i want it to type !join in which ever starts first.

When it joins either 1, i want the script to turn itself off/disable and have a command like .on to turn it back on when im ready to use it.

I want the .on to be operational in a different channel so like if $nick = me and isin #mychannel "Trivia script enabled"

Also how can i make it so my original script just responds to a specific nick? i.e the nick of the trivia bot.

All help welcome.

spirit_cro #208366 19/01/09 07:41 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
1) You are not looking for the ON TOPIC event, as that triggers when the topic of a channel is changed.
2) For your bot to recognize that a trivia game has started in a channel, requires the bot to already be in the channel.
This, in turn, makes the !join command, as you specified, irrelevant... additionally, most scripts that have a !join command also require a channel name to be provided, so that the bot joins a channel that it's not already in.
3) Getting your script to respond to a specific nick requires a bit of re-coding, so that a comparison to see if $nick matches your bot's nick is done.

RusselB #208369 19/01/09 03:39 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
RusselB you're right, though I think the user doesn't want to autojoin a channel but a new game, if it's announced in the channels topic smile


1) The topic event to !join the first game, setting a variable that has to be reset manually (see the other code below)

Replace "BOTNICK1" with the nick of the triviabot of channel #trivia. Replace "BOTNICK2" with the nick of the triviabot of channel #trivia1.
Code:
on *:topic:*: {
  if ($istok($strip($1-),!join,32)) && (%trivia.running != on) {
    if (($chan == #trivia) && ($nick == BOTNICK1)) || (($chan == #trivia1) && ($nick == BOTNICK2)) { 
      set %trivia.running on
      msg $chan !join
      echo -ac info * You're auto-joining the trivia game on channel $chan
    }
  }
}



2) Of these two parts, I don't know which one you need.

A command YOU can use to reset the "I already joined a trivia game" status: /resettrivia
Code:
alias resettrivia {
  if (%trivia.running == on) { 
    unset %trivia.running
    echo -ac info * Trivia Status reset - Ready to auto-join the next trivia game.
  }
  else {
    echo -ac info * Trivia Status doesn't need a reset - Ready to auto-join the next trivia game.
  }
}

A trigger OTHERS can use to reset your trivia game status: !resettrivia
Replace "#YOURCHANNEL" with the name of your channel, or multiple channel names (separated by comma), or "#" for all channels.
Code:
on *:text:!resettrivia:#YOURCHANNEL: {
  if (%trivia.resetflood != on) {
    set -eu5 %trivia.resetflood on
    if (%trivia.running == on) { 
      unset %trivia.running
      notice $nick Trivia Status reset - Ready to auto-join the next trivia game.
    }
    else {
      notice $nick Trivia Status doesn't need a reset - Ready to auto-join the next trivia game.
    }
  }
}



Link Copied to Clipboard