IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: DESteve on August 04, 2009, 08:14:07 AM

Title: "Guest" Script
Post by: DESteve 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
Title: Re: "Guest" Script
Post by: Snerf 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
Title: Re: "Guest" Script
Post by: DESteve 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
Title: Re: "Guest" Script
Post by: DESteve 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
Title: Re: "Guest" Script
Post by: DarkStar on August 04, 2009, 02:30:24 PM
Save it as guest.ICE, not ICS.
Title: Re: "Guest" Script
Post by: DESteve on August 04, 2009, 04:24:10 PM
Sorry yes ice..  I knew that was the extension for ver 5 ..   but still no go..
Title: Re: "Guest" Script
Post by: Snerf 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.
Title: Re: "Guest" Script
Post by: DESteve 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 --

Title: Re: "Guest" Script
Post by: Morio 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
Title: Re: "Guest" Script
Post by: Snerf on August 05, 2009, 08:34:20 AM
Lol, this is why I should not try scripting off of the top of my head.
Title: Re: "Guest" Script
Post by: DESteve 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.. 
Title: Re: "Guest" Script
Post by: Snerf 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)
Title: Re: "Guest" Script
Post by: ElementAlchemist 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.
Title: Re: "Guest" Script
Post by: Snerf 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.