Author Topic: Request: Greet script  (Read 4099 times)

James Revan

  • Newbie
  • *
  • Posts: 32
Request: Greet script
« on: January 31, 2008, 04:35:24 AM »
I don't know if that can be done, but probably it can, so..

If somebody could make a script that would gather all the nicks on channel and send a "welcome" message when i join channel without my nick.

ex:

James_Revan joins #channel
<James_Revan> Hello nick1 nick2 nick3 nick4 nick5

Smth like that

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Request: Greet script
« Reply #1 on: January 31, 2008, 09:06:42 AM »
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)

'if you only want it to trigger for a specific channel, that can be done on the next line (if not then just remove that line and the last End If)
If Channel = "#somespecificchannel" then

  'check that it's you who joined the channel
  If Nickname = GetIdentifier("$me") then
    SendCommand "/msg " & Channel & " Hello " & Nicks(Channel,ServerNumber),ServerNumber
  End If
End If

End Sub

This script will do what you said. When you join a channel it will make you say <yournick> Hello nick1 nick2 nick3
It will also add yourself to that list of nicknames. If that bothers you tell me and I'll write the code that removes your nickname
"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

Gord

  • Newbie
  • *
  • Posts: 4
Re: Request: Greet script
« Reply #2 on: February 01, 2008, 12:20:50 AM »
Actually, if you don't mind, Morio, it would help me to be able to separate out my own Nick (and that of any Bots), not so much for a Greet script but more for storing data on "members in Chat" when certain events trigger.

(Sorry if that sounds a bit Big Brother, but I run a kids' chat room and have to watch out for the "nasties"......)

Any help there greatly appreciated.   :-)

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Request: Greet script
« Reply #3 on: February 01, 2008, 03:17:45 AM »
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)

'if you only want it to trigger for a specific channel, that can be done on the next line (if not then just remove that line and the last End If)
If Channel = "#somespecificchannel" then

  'check that it's you who joined the channel
  If Nickname = GetIdentifier("$me") then
 
  'get all the nicks
  AllNicks = Nicks(Channel,ServerNumber)

  'remove your own nick
  AllNicks = Replace(AllNicks,GetIdentifier("$me"),"")

  'remove eventual empty spaces
  AllNicks = (Replace(AllNicks,"  "," ")
  AllNicks = Trim(AllNicks)

    SendCommand "/msg " & Channel & " Hello " & AllNicks,ServerNumber
  End If
End If

End Sub

Now it removes your nick from the list, if you want it to remove other nicks as well add this line:
Code: [Select]
AllNicks = Replace(AllNicks,"nickname_to_remove","")right under the line: AllNicks = Replace(AllNicks,GetIdentifier("$me"),"")

I think the replace command is case-sensitive, so you've got to keep that in mind.
"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

James Revan

  • Newbie
  • *
  • Posts: 32
Re: Request: Greet script
« Reply #4 on: February 01, 2008, 04:38:29 AM »
 ->> ERROR:modScriptFunctions:lol.ice:Function:LoadScriptFile:End Sub Error Number:1006 : Expected ')'

Guess this means there is no ")" somewere where it should be, if you could tell me where..

Gord

  • Newbie
  • *
  • Posts: 4
Re: Request: Greet script
« Reply #5 on: February 01, 2008, 07:11:33 AM »
James:

It's just a little typo in this "block":-

  'remove eventual empty spaces
  AllNicks = (Replace(AllNicks,"  "," ")
  AllNicks = Trim(AllNicks)


There shouldn't be a "(" in front of "Replace".

--------------------------------------------------------

Morio:

Brilliant!  Thanks ever so much.  Just what I needed.


Gord  :-) :-) :-)