IceChat Forums

IceChat 5 Scripting => Scripting => Topic started by: Jacob on March 30, 2008, 08:20:55 AM

Title: *s
Post by: Jacob on March 30, 2008, 08:20:55 AM
So in icechat 7, you can say

Code: [Select]
on *:TEXT:!test *:......
So that will make it so when someone says !test then anything it will trigger it. How do I do that in IceChat 5 with the ONTEXT command?
Title: Re: *s
Post by: Morio on March 30, 2008, 08:30:35 AM
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If Left(Message,5) = "!test" then
.
.
.
End Sub
Title: Re: *s
Post by: Jacob on March 30, 2008, 08:32:20 AM
So what is ,5?
Title: Re: *s
Post by: Jacob on March 30, 2008, 08:37:48 AM
It dosent work. !Test asdfghjkl; does not trigger it
Title: Re: *s
Post by: Morio on March 30, 2008, 10:15:48 AM
that's because you used a capital 'T' to make it not case sensitive change the line to this:

Code: [Select]
If Left(LCase(Message),5) = "!test" then
The ',5' means that the code checks for the first 5 characters
Title: Re: *s
Post by: Jacob on March 30, 2008, 11:52:06 AM
OK, heres all of the code:

Code: [Select]
Sub ONNOTICE(Message,Nickname,Host,ServerNumber)
Name = GetIniFile("Users.ini","Users",Nickname,"DeafultValue")
if Name = "Allowed" then
If Left(Message,8) = "!AddUser" then
SendCommand "//addop " & Nickname & " " & Message
else
SendCommand "//msg " & Nickname & "You are not authed or have entered an invalid command"
end if
end if
End Sub

Heres the INI file:

Code: [Select]
[Users]
Jacob=Allowed
Robert=Allowed

Doing: "/notice [ChannelHelper] !AddUser Test" Does nothing
Title: Re: *s
Post by: Morio on March 30, 2008, 12:14:22 PM
do you have an alias '/addop' ?
Title: Re: *s
Post by: Jacob on March 30, 2008, 12:32:21 PM
/addop {
/! Test $3-
//notice $1 Done.
}
Title: Re: *s
Post by: Morio on March 30, 2008, 01:00:42 PM
and what does your 'Test' sub look like?
Title: Re: *s
Post by: Jacob on March 30, 2008, 01:13:29 PM
Sub Test(hi)
WriteIniFile "Users.ini","Users",hi,"Allowed"
End Sub
Title: Re: *s
Post by: Snerf on March 30, 2008, 03:28:44 PM
Your addop alias looks wrong, because $3- is checking for the 3rd word, when you are only passing 2 (NickName and Message).
Should be $2-, for the message.
Title: Re: *s
Post by: Jacob on March 30, 2008, 04:34:33 PM
1) It dosent trigger it
2) The message is !AddUser <user>
Title: Re: *s
Post by: Jacob on March 30, 2008, 05:01:26 PM
So it has the nickname too