Author Topic: "Guest" Script  (Read 5637 times)

DESteve

  • Guest
"Guest" Script
« on: August 04, 2009, 08:14:07 AM »
I would like a script that when someone enters a room and has a nick starting with Guest ( in other words the first four leters = ) then it calls and executes a message to that user to change their nick.

Any help on this  Ive searched hvent been able to find one that would look at the first four characters of a nick..

Steve

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: "Guest" Script
« Reply #1 on: August 04, 2009, 08:23:54 AM »
I am pretty sure you meant first 5 letters, as "Guest" is 5 letters long, not four.

Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
if Len(Nickname) > 4 then
  if Left(Nickname,5) = "Guest"
    SendMessage "/msg " & Channel & " " & Nickname & " please change your nick name", ServerNumber
  end if
end if
End Sub
The IceChat God

DESteve

  • Guest
Re: "Guest" Script
« Reply #2 on: August 04, 2009, 01:07:46 PM »
Ya  What I meant is anytine a nick starts with Guest then I want it to send a message..

Being a newbie here  all I need to do is to put this in the sript editor save it as  guest.isc..

and then just load it when I want to use it.. ???

Thanks

DESteve

  • Guest
Re: "Guest" Script
« Reply #3 on: August 04, 2009, 01:53:53 PM »
If Im loading htis correctly doesnt seem to be working
I did get an error : [16:51]  ->> ERROR:modScriptFunctions:Guest.ice:Function: LoadScriptFile: Error Number:1017 : Expected 'Then'

So I added a then in the one line I thought was missing from after "Guest"  but still doesnt seem to run.

Steve

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: "Guest" Script
« Reply #4 on: August 04, 2009, 02:30:24 PM »
Save it as guest.ICE, not ICS.
This message brought to you by the Wonderful Wizard of Oz.

DESteve

  • Guest
Re: "Guest" Script
« Reply #5 on: August 04, 2009, 04:24:10 PM »
Sorry yes ice..  I knew that was the extension for ver 5 ..   but still no go..

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: "Guest" Script
« Reply #6 on: August 04, 2009, 07:24:26 PM »
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
if Len(Nickname) > 4 then
  if Left(Nickname,5) = "Guest" then
    SendMessage "/msg " & Channel & " " & Nickname & " please change your nick name", ServerNumber
  end if
end if
End Sub

As the error said, there was a missing "then" statement, my apologies.
The IceChat God

DESteve

  • Guest
Re: "Guest" Script
« Reply #7 on: August 05, 2009, 04:37:14 AM »
As I mentioned I did figure that much out..  and it still wont run..

got the following error : [07:33] -- Script Engine Error:13:Type mismatch: 'SendMessage': Line #4 --


Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: "Guest" Script
« Reply #8 on: August 05, 2009, 07:42:09 AM »
It shouldn't say "SendMessage" it should say "SendCommand"
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
if Len(Nickname) > 4 then
  if Left(Nickname,5) = "Guest" then
    SendCommand "/msg " & Channel & " " & Nickname & " please change your nick name", ServerNumber
  end if
end if
End Sub
"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

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: "Guest" Script
« Reply #9 on: August 05, 2009, 08:34:20 AM »
Lol, this is why I should not try scripting off of the top of my head.
The IceChat God

DESteve

  • Guest
Re: "Guest" Script
« Reply #10 on: August 05, 2009, 12:19:30 PM »
No worries I just appreciate the help.. okay I got it to work.. changes few things up.. added bit of color.. but..  now I noticed that I only want it to work in one channel  lets call it #Autochat how would be best to handle.. 

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: "Guest" Script
« Reply #11 on: August 05, 2009, 01:46:45 PM »
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
if Len(Nickname) > 4 and lcase(Channel) = "#autochat" then
  if Left(Nickname,5) = "Guest" then
    SendCommand "/msg " & Channel & " " & Nickname & " please change your nick name", ServerNumber
  end if
end if
End Sub

If you want to add colors, add in the control codes yourself, with the color numbers. (CTRL-C is the color code)
The IceChat God

ElementAlchemist

  • Newbie
  • *
  • Posts: 1
Re: "Guest" Script
« Reply #12 on: August 06, 2009, 08:54:12 AM »
If you want to add colors, add in the control codes yourself, with the color numbers. (CTRL-C is the color code)
Ctrl+C is copy.  Ctrl+K is the color code.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: "Guest" Script
« Reply #13 on: August 06, 2009, 02:33:39 PM »
ok, OK!!!

I have now given my official retirement to writing scripts. It is obvious I don't know my own program anymore.  :|

I am glad I got you guys covering my back, seems I have lost my mind.

Too much c# coding does that.
The IceChat God