Author Topic: help on vb script  (Read 4204 times)

dabigbadshow

  • Guest
help on vb script
« on: November 09, 2009, 06:12:33 AM »
Sub ONQUERY(Message,Nickname,Host,ServerNumber)
on ^*:open:?:{
/msg $nick *Auto Reply* Don't Pm me ask in the room!!!!
* dabigbadshow Hey $nick Ask before you pm me
End Sub

it works fine for me but wont work on anyone elses

i do get this error code

->> SUB :Unknown command

thanks and i guess this is the right place for this lol

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: help on vb script
« Reply #1 on: November 09, 2009, 06:54:29 AM »
you are mixing two scripting languages. Subs are used in the vbscripting style only.

This should do what you want
Code: [Select]
Sub ONQUERY(Message,Nickname,Host,ServerNumber)
    SendCommand "/msg " & Nickname & " *Auto Reply* Don't pm me, ask me in the room!",ServerNumber
End Sub

But now it will trigger every time you get a private message

This is a slightly modifier version of the query blocking script I use, and it blocks queries only from persons on a specific channel:
Code: [Select]
DIM Added

Sub ONQUERY(Message,NickName,Host,ServerNumber)
If Not (IsOp(NickName,"#your_channel_here",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#your_channel_here",ServerNumber)
  If Instr(AllNicks,NickName) > 0 then
    SendCommand "/msg " &  NickName & " Do not send private messages to me, if you have something to ask, ask it in the channel", Servernumber

  End If
End If

End Sub

Sub Add(Allowed)
  Added = Allowed
   If Added <> "$1" then
      SendCommand "/echo -a " & Added & " is now allowed to send messages"
    Else
      SendCommand "/echo -a only operators are now allowed to send messages from #your_channel_here"
    End If
End Sub


change the "your_channel_here" (3 places) to the channelname you want it to trigger for.

This script also allows you to temporarily allow a nick to send you messages, for this you should add an alias like this:
Code: [Select]
/add:/! add $1
To allow messages from the nick, simply type /add nickname, and when you don't want to recieve any more messages from that nick type /add

Also this script doesn't block messages from channel operators.
« Last Edit: November 09, 2009, 06:56:11 AM by Morio »
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

dabigbadshow

  • Guest
Re: help on vb script
« Reply #2 on: November 09, 2009, 10:42:16 AM »
Thanks mane that did the trick
appreciate the help

dabigbadshow

  • Guest
Re: help on vb script
« Reply #3 on: November 10, 2009, 07:31:19 PM »
anyway to do it on multiple channels at once?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: help on vb script
« Reply #4 on: November 10, 2009, 09:39:31 PM »
Use multiple if statements then
The IceChat God

dabigbadshow

  • Guest
Re: help on vb script
« Reply #5 on: November 11, 2009, 04:42:24 AM »
could i use a Else


DIM Added

Sub ONQUERY(Message,NickName,Host,ServerNumber)
If Not (IsOp(NickName,"#DaBigBadShow",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#DaBigBadShow",ServerNumber)
  If Instr(AllNicks,NickName) > 0 then
    SendCommand "/msg " &  NickName & " Do not send private messages to me, if you have something to ask, ask it in the channel", Servernumber

    Else

If Not (IsOp(NickName,"#adult_zone",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#adult_zone",ServerNumber)
  If Instr(AllNicks,NickName) > 0 then
    SendCommand "/msg " &  NickName & " Do not send private messages to me, if you have something to ask, ask it in the channel", Servernumber

  End If
End If

End Sub

Sub Add(Allowed)
  Added = Allowed
   If Added <> "$1" then
      SendCommand "/echo -a " & Added & " is now allowed to send messages"
    Else
      SendCommand "/echo -a only operators are now allowed to send messages from #channel"
    End If
End Sub

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: help on vb script
« Reply #6 on: November 13, 2009, 11:44:56 AM »
My guess is, your getting an error about a missing End If statement.
The IceChat God

dabigbadshow

  • Guest
Re: help on vb script
« Reply #7 on: November 13, 2009, 11:56:44 AM »
Code: [Select]
DIM Added

Sub ONQUERY(Message,NickName,Host,ServerNumber)
If Not (IsOp(NickName,"#DaBigBadShow",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#DaBigBadShow",ServerNumber)
If Not (IsOp(NickName,"#adult_zone",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#adult_zone",ServerNumber)
  If Instr(AllNicks,NickName) > 0 then
    SendCommand "/msg " &  NickName & " Do not send private messages to me, if you have something to ask, ask it in the channel", Servernumber


  End If
End If

End Sub

Sub Add(Allowed)
  Added = Allowed
   If Added <> "$1" then
      SendCommand "/echo -a " & Added & " is now allowed to send messages"
    Else
      SendCommand "/echo -a only operators are now allowed to send messages from #channel"
    End If
End Sub


dabigbadshow

  • Guest
Re: help on vb script
« Reply #8 on: November 13, 2009, 12:11:38 PM »
Well that didnt work either

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: help on vb script
« Reply #9 on: November 13, 2009, 01:24:19 PM »
Have you read any tutorials on vbscript, or are you just guessing?

let's have a look at your script

Code: [Select]
Sub ONQUERY(Message,NickName,Host,ServerNumber)
If Not (IsOp(NickName,"#DaBigBadShow",ServerNumber) or LCase(Nickname) = LCase(Added)) then
  AllNicks = Nicks("#DaBigBadShow",ServerNumber)

  'ok, we check if he is an op on channel #DaBigBadShow. If not, we get all nicks on that channel. So far it looks ok

  If Not (IsOp(NickName,"#adult_zone",ServerNumber) or LCase(Nickname) = LCase(Added)) then

  'ok, so now we are checking if he is an op on another channel (#adult_zone). Should work so far, although there are better ways to do this.

    AllNicks = Nicks("#adult_zone",ServerNumber)

    'so, now we know he is not an op on either of those channels, but suddenly we are not interested if he is on the first channel at all.

    If Instr(AllNicks,NickName) > 0 then

    'ok, so he is on the second channel and is not allowed to send you messages, so he message telling him not to do so.

      SendCommand "/msg " &  NickName & " Do not send private messages to me, if you have something to ask, ask it in the channel", Servernumber

    'and here we are missing an End If
  End If
End If

So, you never check if he is on the first channel at all, and if he's not there, the IsOp will return False.
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein