To add/edit scripts in IceChat 7, click on the Star on the ToolBar to go to the IceChat Editor. You can also use the Options Menu, or simply press CTRL-S. Once the IceChat Editor is open, click on the Scripts Tab. Under the Script File menu are all the Scripts that are loaded.
Here are the Events that get triggered by the IRC Client that can be used in Scripts. These are also listed in the Script Editor, under the ADD SCRIPT EVENT menu item for IceChat 5, and have a brief description also as to what they do. This is very useful when learning the Scripts for IceChat. For IceChat 7 they simply show under the Script Events Menu, and then choose IceChat 5 Style.
NOTE: If you add more then one (1) of these events, only one (1) will actually get used. So do not add more then one (1). You do not need to add all these events, only the ones you wish to use. If you wish to use multiple”s of the same kind, save them in different files. This way you can have as many as you wish.
ONJOIN – This will be triggered any time a user enters a channel, including yourself
The Nickname is the user who joined the Channel, with the specified Host for the user. This will also fire for yourself.
ONPART -This will be triggered any time a user leaves a channel, including yourself.
The Nickname is the user who parted the Channel, with the specified Reason (if a reason was used) The user”s Host is also sent.
ONCTCP – This will be triggered any time a user CTCP”s you.
Sub ONCTCP(Nickname,Data,ServerNumber) When a CTCP Notice is sent to you, and you do not have CTCP Replies Disabled in Options (Under Flood Settings), this event is triggered, allowing you to make your own custom CTCP commands, or reply to standard ones (VERSION, FINGER,PING, etc). Data can contain just one word, like PING, or a series of words, all depending what the Nickname sent you.
ONTEXT – This will be triggered any time there is a channel message.
ONACTION – This will be triggered any time there is a channel action.
Sub ONACTION(Message,Channel,Nickname, Host,ServerNumber)
ONQUERY – This will be triggered any time there is a query/private messsage.
ONQUERYACTION – This will be triggered any time there is a action performed in a query.
ONNICK – This will be triggered any time there is a nick name change.
ONKICK – This will be triggered any time a user, including yourself, is kicked from a channel.
Sub ONKICK(Nickname,Host,Channel,WhoKicked,Reason,ServerNumber) The Nickname was the person who was kicked, and WhoKicked is the user who performed the kick (Who would have thought people would do such things) ‘Host’ is the one of the ‘Nickname’ (who was kicked)
ONBAN – This will be triggered any time a user, including yourself, is banned rom a channel.
Sub ONBAN(NickName,Host,ModeSetter,ModeSetterHost,Channel,ServerNumber) The Nickname was the person who was banned, and then the Nickname”s Host. The ModeSetter and ModeSetterHost is who set the ban, and then the Channel it was performed in.
ONMODE – This will be triggered any time a mode change happens inside a channel.
Sub ONMODE(Channel,ModeSetter,Mode,ServerNumber) The ModeSetter is the user or perhaps the Bot who set the Mode. Mode can contain just one mode, or a multitude of them, they will all need to be parsed if you wish to get extended data.
ONINVITE – This will be triggered any time a user invites you to a channel.
ONOP – This will be triggered any time that a nick is op”ed or deop”ed in a channel.
ONHALFOP – This will be triggered any time that a nick is halfop”ed or dehalfop”ed in a channel.
ONVOICE- This will be triggered any time that a nick is voice”ed or devoice”ed in a channel
ONNOTICE – This is triggered any time a notice is sent to you by another user.
ONQUIT – This is triggered any time a usr quits from a server. It will be triggered for each channel the user is on that you are also on, so it can trigger multiple times.
ONWHOISREPLY – This event is trigger for all data for a /whois command.
ONCTCPREPLY – This event is triggered when you get a CTCP Reply from another user , IE: when you /version someone.
ONAWAY – This event is run when you set yourself as away, or return. Away is TRUE when you set yourself as away, and FALSE when you return. Reason will be blank on your return, and Time is in ticks.
ONCONNECT – This event fires after server has received end of MOTD message (Or the NO MOTD Message) when connecting to a server, and has done all autochannels joins and autoperforms.
ONCHATTEXT – This eventis fired with a regular DCC Chat Message. Sub ONCHATTEXT(Nickname, Message,ServerNumber)
ONCHATACTION – This event is fired with a DCC Chat Action Message.
Sub ONDCCACTION(Nickname, Message,ServerNumber)
ONCHATCONNECT – This event fires when you establist a DCC Chat Connection. ChatType is either INBOUND or OUTBOUND.
ONCHATCLOSE – This event fires when a DCC Chat Connection has ended. ChatType is either INBOUND or OUTBOUND.
ONFILECONNECT – This event fires when you establist a DCC File Session. FileType is either INBOUND or OUTBOUND.
ONFILECLOSE – This event fires when a DCC File Session has ended. FileType is either INBOUND or OUTBOUND. Completed is either True or False, whether the transfer was successful or not.
BUDDYLIST – This event is triggered when a user goes OFFLINE or ONLINE in your buddylist. Status will either equal ONLINE or OFFLINE.
ONBNCCONNECT – This event is fired when BNC Connections are established. The data is the Data being sent by the server.
ONBNCCONNECT = ServerNumber when finished sending commands. Function ONBNCCONNECT(Data,ServerNumber) . BNC has extra identifiers for issuing SendCommand lines to pass parameters from this function, obtained for the data in the BNC Tab in the Server Editor. $bncserver is the BNC Server name. $bncport is the BNC Server Port Number. $bncpass is the password required, and $bncuser is a username, if required. A quick example to send the password when connecting to a BNC Server would be.
|SendCommand “//quote PASS $bncpass”,ServerNumber|
|ONBNCCONNECT = ServerNumber|
These Events are a bit different then the above ones, as they are not triggered by events that happen while on IRC, and they return values to the Client.
OUTTEXT – You can change the format of your outgoing text with this Function. This was a normal place before where the “lol” words got changed to “[laughing out loud]“. The OUTTEXT Function gets sent the text that you have entered into the Text Box. Function OUTTEXT(OutgoingText). OutGoingText holds the value of your text. You can edit the value of OutGoingText and then assign OutText to it when you are done. It needs OutText = .. something in order for it to work. If you dont meak OutText equal to anything, it will not send out any data to the IRC Server. (The data gets edited BEFORE it is actually sent out to the server).
All the normal VB Script functions work of course, plus some additions ones that are built into the Client to make handling of some events much easier. These commands are also added to a menu in the Script Editor called “ADD SCRIPT COMMAND”. It provides a brief explanation of what each command does when you add it, and the syntax. Also when you are typing a Command, like SENDCOMMAND, the syntax for the command shows up at the bottom of the Script Editor, after you press the space.Mostl commands needs to know what ServerNumber you are using it with, so it is important to include it, because of IceChat”s multiple server capabilities. You normally run these Commands inside the events listed above, and the Commands will pass the ServerNumber value (IE: Sub ONJOIN(Nickname,Host,Channel,ServerNumber))
NOTE: If you add wish to see a command here that could pose to very very usefull, please dont hesitate to email us or add it to the IceChat Forums.
SendCommand – The most basic Script Command there is. This actually sends a command, back to IceChat, as if you entered the /command yourself. For instance, if you wish to join a channel SendCommand “/join #channel”, ServerNumber. The command is entered in quotes, and you need to send ServerNumber as the 2nd parameter. You can use aliases in the command itself.
Echo - This is almost the same as doing a /echo command. Echo “data to send “,”#channel”, ServerNumber. If you specify “-s” for the channel, it will echo it to the console.
RunShell – This allows you to run an external program. RunShell “c:\\myprogram.exe”
GetIdentifier – Since $identifiers dont work in Scripts directly, you can get identifier values with using the GetIdentifier Function. You need to specify the identifier you want, and for what ServerNumber you need it for. MyNickName = GetIdentifier(“$me”,ServerNumber)
MesBox – While regular VB Scripting does have the MSGBOX Command, there is one down fall to it. IceChat is completely frozen until the OK button or whichever is pressed (The forms are Modal). This is not good if you want IceChat to keep running in the background while a Message Box is displayed. So a custom Message Box was made specially for Scripting to prevent this problem. MesBox”Prompt”,”Caption”,Buttons The “Prompt” is what the user is asked, and the “Caption” is the Title of the Message Box. Buttons is a special value which holds what kind of buttons are shown on the Message Box. You can leave the “Caption” and the Buttons blank, and it will just default to “IceChat” for the Title and use the OK button for the Buttons Value (0). MesBox “Hello World”
InpBox – As with the standard MSGBOX function, the regular InputBox function makes IceChat freeze until either the OK or Cancel button is clicked, so a custom Input Box was made to also prevent this. MyValue = InpBox(“Prompt”,Title”)
GetIniFile – If you wish to get values straight from certain INI files for IceChat, or any other program for that fact, you can use this Function in Scripting. If a path is not specified for the INI file, it is read from the Scripts Folder. MyValue = GetIniFile(“FileName.ini”,”Section”,”Key”,”DefaultValue”)
WriteINIFile – You can also write a value to any INI file. If a path is not specified for the INI file, it is read from the Scripts Folder. WriteIniFile “Filename.ini”,”Section”,”Key”,”SomeValue” If you do make changes to the IceChat INI Files, be warned that doesnt always change the internal settings of these INI Settings while IceChat is running, you may need to restart.
There were also a few extra functions added for quickly performing some simple things, or returning some highly used variables for scripting.
RemoveCodes – This will remove all IRC color/bold/underline types codes from the data sent, and return the plain text. SimpleData = RemoveCodes(Data) .
MyNickName – This returns the nickname of the specified server number. Would return the same as GetIdentifier(“$me”,ServerNumber) . MyNickName(ServerNumber)
ServerName – This returns the server name of the specified server number. ServerName(ServerNumber) .
Network – This returns the Network name (if any) of the specified server number. If no Network name is present, returns the server name. Network(ServerNumber) .
Nicks – This returns a string which contains all nicknames, seperated by a space between each, for a specified channel for a specified server number. Nicks(“#channel”,ServerNumber)
AwayStatus – Returns true or false for your away status for specified server number. AwayStatus(ServerNumber)
CurrentServerNumber – Returns the value of the currently active server in IceChat.
GetDuration – returns a value specifying how long something took in seconds, minutes, hours, days, weeks and years, by passing it a number of seconds. GetDuration(315) would return “5 minutes and 15 seconds”.
Gettok – Returns the Nth token in specified text ,using the character as a splitter. Gettok(“this is a test”,2,32) would return “is a test” as 32 is the character for a space, and 2 is the word number (Nth token) to start at.
There were also a few extra functions added for quickly checking if someone, or yourself, are an Operator, Voiced or Half-Operator in a specific channel on a Server. They all return Booleans (True or False)
ISOP(Nickname,Channel,ServerNumber) – If ISOP(“SomeNick”,”#channel”,ServerNumber) = True then …..
There are extra commands, called API calls which are added to IceChat. Only use these if you know exactly what you are doing, or IceChat is almost guarenteed to crash. More API commands could be added to later versions of IceChat, or a Generic Command could be made to make it able to use all API Commands.
API_FindWindow – MyValue = API_FindWindow(ClassName, WindowName)
API_FindWindowEx – MyValue = API_FindWindowEx(ParentHwnd, HwndAfter, ClassName, WindowName)
API_GetWindowText – MyValue = API_GetWindowText(hWnd, sValue, Length)
API_SendMessage, API_SendMessageByString, API_SendMessageLong – MyValue = API_SendMessage(hWnd, iMsg, wParam, lParam)
These commands below are for creating Dialogs (Custom Windows) inside IceChat itself. These are best left for Advanced IRC users/Scripters who know what they are doing. You can play around with these, learning them, but be warned that you can cause IceChat to crash if you use these special commands incorrectly. It makes IceChat very unstable if improper values are assigned. But you can make some very advanced Scripting additions with these Dialogs. Some basic ones will be added to the Scripting Section on the Web Site so its a bit easier to follow what is being done. Each Dialog Created has its own unique Window Handle, and each Control added needs its own Unique ControlID. Upto 32000 Controls can be used for all your Dialogs, which should be more then sufficient. You can of course have more then 1 dialog in Scripting as well, just assign each its own unique Variable and make it Public to all Scripting (Dim the Variable outside of a Function)
CreateDialog – MyDialog = CreateDialog(“Caption”,X,Y,Width,Height) This will create a Dialog Wndow. The “Caption” is the Title Bar of the Window. X and Y are the positions on the Screen where the Dialog is shown, using the specified Width and Height. It is best to Dim MyDialog outside of a subroutine to remember the value for all functions/sub, unless you only need it for a specified sub. MyDialog holds a special value which is needed for adding controls to the Dialog (like buttons), etc. You can use any variable name to hold the value, we just used MyDialog as an example.
ShowDialog - ShowDialog MyDialog – This will show the specified window to the user.
CloseDialog – CloseDialog MyDialog – This will automatically close a specified dialog window, the user can click the X button as well.
Here we begin adding controls to the Dialog Windows you have created above. Each control needs its own Unique ControlID Number, which is always the last value in the Command. Generally, you can start at the Number 1 , and work your way up, to a max value of 32000.
AddButton – This will add a button to a specified Dialog Window, with the specified Position and Size, and Caption (Button Text). AddButton MyDialog,”Caption”,X,Y,Width,Height,1. here we add a Button to the MyDialog Window at the position of X and Y with the specified Width and Height. 1 is the ControlID Number. The “Caption” is the Button Text placed on the Button. If you wish to get the Click event for a button, you will need to give the AddButton command 2 additional parameters, a 0, and a button name. IE: AddButton MyDialog,”Save”,X,Y,Width,Height,1,0,”SaveButton” . The name of the button is now SaveButton, and to capture the click event , the event Sub SaveButton_Clicked() will be fired.
AddCheckBox – Same as AddButton, just creates a checkbox instead. AddCheckBox MyDialog, “Caption”, X, Y, Width,Height, ControlID. To set if it is checked, use CheckItem, and to get if it is checked or not, use ItemState.
AddRadioButton – Same as AddButton, just creates a Radio Button instead. AddRadioButton MyDialog, “Caption”, X, Y, Width,Height, ControlID. To set if it is checked, use CheckItem, and to get if it is checked or not, use ItemState.
AddEditBox – This will add an edit box, or a text box. AddEditBox MyDialog,”text”,X,Y,Width,Height, 2 - You could make “text” just “” and leave it blank.
AddLabel – This will add a Label, or a Static Control. AddLabel MyDialog,”Caption”,X,Y,Width,Height, 3
AddListBox – This will add a listbox to the Dialog . A Listbox has no Caption, so one is not sent or used. AddListBox MyDialog,X,Y,Width,Height,4 . If you wish to fire an event when an item in a listbox is selected, you will need to add 2 additional parameters to the AddListBox command, 0 and the ListBox name. AddListBox MyDialog,X,Y,Width,Height,4,0,”MyListBox” . When a user selects an item in the MyListBox listbox, Sub MyListBox_Selected() is fired. You can then use the GetListItem command to retreive which item was selected.
AddComboBox – This will add a combo box, slighty different from a listbox, and again, no caption. AddComboBox MyDialog,X,Y,Width,Height,5 . If you wish to fire an event when an item in a combobox is selected, you will need to add 2 additional parameters to the AddComboBox command, 0 and the ComboBox name. AddComboBox MyDialog,X,Y,Width,Height,4,0,”MyComboBox” . When a user selects an item in the MyComboBox combobox, Sub MyComboBox_Selected() is fired. You can then use the GetListItem command to retreive which item was selected.
AddItem – You can add items to a listbox, comobox with this Command. You can also change the Text in an EditBox or a Label with this command. It does not add the text though, it replaces it. It only adds items to listbox/comboxes. AddItem ControlID, Type,”text” The Type can be 2=EditBox:3=Label:4=ListBox:5=ComboBox.AddItem 2,4,”Hello” will add an item to a listbox with the ControlID of 2, and add the word “Hello” to it. AddItem 15, 2 , “” will blank out an EditBox with the ControlID of 15.
GetText – If you wish to get the text from an editbox, after you have entered a value for instance, you can use this function. MyValue = GetText(ControlID) The ControlID is of course the ControlID you have specified when you created the EditBox with AddEditBox command. 2 in the above example would be MyValue = GetText(2)
GetListItem – If you want to get the current selected item in a listbox or combobox. MyValue = GetListItem(ControlID,Type) The ControlID has to be from either a listbox or a combobox. If you wish to get the index of the selected item, you would need to pass 1 additional parameters. MyIndex = GetListItem(ControlID,Type,1) . This will then return the current selected index of the ListBox,ComboBox, not the actual item text.
SetListItem – You can set a default value in a listbox or combobox. SetListItem(ControlID, Index,Type) The Index is the item number, starting at 0, and the Type is 4 for Listbox and 5 for Combobox.
ClearItems – This will clear all items in a ListBox or ComboBox (Type 4 or 5). ClearItems ControlID, Type
RemoveItem – This will remove an item from a ListBox or ComboBox. You will need to use the Items Index to remove it, and indexes start with 0. Removeitem ControlID, Type, Index
TotalItems – This will return the total number of items in a ListBox or ComboBox. Total=TotalItems(ControlID, Type)
CheckItem – This will check or uncheck a CheckBox or RadioButton. Set the Value to 1 for checked, and to 0 for unchecked. CheckItem ControlID, Type , Value
ItemState – This will return if a CheckBox or RadioButton is checked. Value = ItemState(ControlID, Type). Value will be 1 if it is checked, and 0 if it is not checkled,
Script Control ID Types
|4 - ListBox|
|5 - ComboBox|
|6 - CheckBox|
|7 – Radio Button|