mIRC Home    About    Download    Register    News    Help

Print Thread
Problem with a script #229118 21/01/11 03:55 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
I found a script that allows users to tell a bot to send a offline message, so when they join a channel the bot is in, it pms them the message but I just tried it out and it doesn't seem to send the message.

It stores it in the tellsys.txt file and deletes when the user comes on but doesn't actually send the message confused

Code:
; Tell System 2.0 (2010-Oct-30)
;
;   /msg [botname] !tellban [nick] [reason] = ban's nick with reason
;   /msg [botname] !tellunban [nick] = unbans nick
;   /msg [botname] !tell [nick] [message] = sends offline message to nick
;   /telladd [nick] = Allows [nick] to use the !tellban and !tellunban functions.
;   /telldel [nick] = Deletes [nick] rights, they will no longer be able to use ban/unban.
 
on *:text:!tell*:#: { /tellsystem $1- | .notice $nick Note: You can also do this privately like so: "/msg $me $1-5 .." }
on *:text:!tell*:?: { /tellsystem $1- }
alias tellsystem {
  var %block 0
  if (bastard isin $1-) var %block bastard
  if (wanker isin $1-) var %block wanker
  if (cunt isin $1-) var %block cunt
  if (nigga isin $1-) var %block nigga
  if (nigger isin $1-) var %block nigger
  if (queer isin $1-) var %block queer
  if (%block != 0) {
    .notice $nick [Tell] Abusive/Racist messages cannot be sent via this Tell System!
    writeini TellSys.txt TellSysBans $address($nick,3) Attempting to send Racist/Abusive messages [Added $fulldate $+ ]
  }
  %tellchknickban = $readini(TellSys.txt,TellSysBans,$nick)
  %tellchkhostban = $readini(TellSys.txt,TellSysBans,$address($nick,3))
  if (%tellchknickban != $null) set %tellchkban %tellchknickban
  if (%tellchkhostban != $null) set %tellchkban %tellchkhostban
  if (%tellchkban != $null) {
    .notice $nick [Tell] YOU ARE BANNED!, Reason: " $+ %tellchkban $+ "
    unset %tell*
    halt
  }
  if ($2 = $me) {
    .notice $nick [Tell] I am a Bot, I do not accept messages!
    halt
  }
  if ($1 = !tellban) {
    %tellstaff = $readini(TellSys.txt,TellSysStaff,$address($nick,13))
    if (%tellstaff != $nick) {
      .notice $nick [Tell] Access Denied To Function $1
      unset %tell*
      halt
    }
    if ($address($2,2) = $null) {
      .notice $nick [Tell] Check nickname spelling and try again.
      halt
    }
    if ($3 = $null) {
      .notice $nick [Tell] Usage: !tellban [nick] [reason for ban]  (eg.  !tellban trouble abusing the system)
      halt
    }
    .notice $nick [Tell] Banning User $2 ( $+ $address($2,3) $+ ) with Reason: $3-
    writeini TellSys.txt TellSysBans $address($2,3) $2 $+ :-  $3- [Added $fulldate $+ ]
    halt
  }
  if ($1 = !tellunban) {
    %tellstaff = $readini(TellSys.txt,TellSysStaff,$address($nick,13))
    if (%tellstaff = $null) {
      .notice $nick [Tell] Access Denied To Function $1
      unset %tell*
      halt
    }
    if ($2 = $null) {
      .notice $nick [Tell] Usage: !tellunban [nick]
      halt
    }
    .notice $nick [Tell] Un-Banning User $2 ( $+ $address($2,3) $+ )
    remini TellSys.txt Bans $address($2,3)
    halt
  }
  if ($1 = !tell) {
    unset %tell*
    %tellchkhost = $address($2,2)
    if (%tellchkhost != $null) {
      .notice $nick [Tell] $2 is currently online, Use the PM System!
      halt
    }
    if (tellsys isin $2) {
      .notice $nick [Tell] You cannot send messages to 'TellSys...' as this is used internally by the Tell System.
      halt
    }
    if ($4 = $null) {
      .notice $nick [Tell] Usage: !tell [nick] [message]
      halt
    }
    %tellcount = $readini(TellSys.txt,$2,Count)
    %telluserc = $readini(TellSys.txt,$2,$nick)
    if (%tellcount > 4) || (%telluserc > 2) {
      .notice $nick $nick $+ : You cannot send any more messages to " $+ $2 $+ "
      unset %tell*
      halt
    }
    inc %tellcount 1
    var %tellmsg $strip($3-)
    .notice $nick $nick $+ : Got Your Message For " $+ $2 $+ " >> " $+ %tellmsg $+ "
    writeini TellSys.txt $2 LastUsed $fulldate
    writeini TellSys.txt $2 Count %tellcount
    writeini TellSys.txt $2 $nick %tellcount
    writeini TellSys.txt $2 %tellcount %tellmsg [from $nick on $fulldate $+ ]
    unset %tell*
  }
}
 
alias telladd {
  if ($address($1,13) = $null) {
    echo -a [Tell] You cannot add " $+ $1 $+ " - they are offline, or do not exist.
    halt
  }
  if ($2 = $null) {
    echo -a [Tell] Usage: /telladd [nick] yes - Adds [nick] and allows them to use !tellban/!tellunban functions. (yes = confirm action)
    halt
  }
  echo -a [Tell] Adding & Notifying User $1 ( $+ $address($1,13) $+ )
  writeini TellSys.txt TellSysStaff $address($1,13) $1
  .msg $1 [Tell] You have been added to the Tell Staff List, This enables you to use the following commands:
  .msg $1 * /msg $me !tellban [nick] [reason] - Adds nick to the Ban System with the Reason specified
  .msg $1 * /msg $me !tellunban [nick] - Reverses the above command.
  halt
}
 
alias telldel {
  if ($2 = $null) {
    echo -a [Tell] Usage: /telldel [nick] yes - Removes [nick] and prevents them from using !tellban/!tellunban functions. (yes = confirm action)
    halt
  }
  echo -a [Tell] Removing Staff Member $1 ( $+ $address($1,13) $+ )
  remini TellSys.txt TellSysStaff $address($1,13)
  halt
}
 
on *:join:#: {
  unset %tell*
  %tellcount = $readini(TellSys.txt,$nick,Count)
  if (%tellcount != $null) {
    .msg $nick [Tell] You have %tellcount new messages..
    :read
    inc %tellcnt 1
    %tellmsg = $readini(TellSys.txt,$nick,%tellcnt)
    .msg $nick Message %tellcnt of %tellcount = %tellmsg
    if (%tellcnt < %tellcount) goto read
    remini TellSys.txt $nick
    unset %tell*
    .msg $nick ** To send a reply: /msg $me !tell [Nick] [Message]
    remini TellSys.txt $nick Count
    remini TellSys.txt $nick
    unset %tell*
  }
  unset %tell*
}


Is it also possible it can be made so the offline message can be done in the channel aswell as sending the /msg to the bot?

Re: Problem with a script [Re: razor32] #229125 21/01/11 08:24 PM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline
Babel fish
Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
The problem is that in your "tellsystem" alias, you're using $nick smile

You need another way.

Re: Problem with a script [Re: MegaZeroX] #229127 21/01/11 09:43 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: MegaZeroX
The problem is that in your "tellsystem" alias, you're using $nick smile

You need another way.


Aliases inherit certain identifiers from events. $nick is one such identifier. It's perfectly acceptable to use $nick in an alias.

Re: Problem with a script [Re: hixxy] #229163 22/01/11 06:15 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
Any idea what the problem could be?

Edit: It just randomly started working smirk But is it still possible it can be made so the offline message can be done in the channel aswell as sending the /msg to the bot?

Also when it sends the message it says this:
Message 1 of 1 = is this working? [from blah on Sat Jan 22 18:19:50 2011]

Can I replace the = to a -? I tried doing it but it still showed = but no message smirk (although this isn't any problem, is fine as it is)

Last edited by razor32; 22/01/11 06:26 PM.