Author Topic: very simple script  (Read 19103 times)

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
very simple script
« on: August 08, 2005, 07:05:13 AM »
I have exactly zero experience in scripting, and I'd appreciate if someone could give me a script that causes med to reply but I'd like the script to work only on one channel

for example:

<someone> hello
<me> hello someone

and/or

<someone> icecream
<me> i like icecream
« Last Edit: August 08, 2005, 07:07:54 AM by Morio »
"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

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: very simple script
« Reply #1 on: August 08, 2005, 12:55:51 PM »
No need to reply, I got it

EDIT: Too soon to say I guess, I can get the script to display messages when someone else writes something, but not when I do it


Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)               
if Message = "hello" then                 
SendCommand "/msg " +channel+  " hello"  + Nickname , ServerNumber     
end if             
End Sub             
« Last Edit: August 08, 2005, 01:04:30 PM by Morio »
"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: very simple script
« Reply #2 on: August 08, 2005, 04:08:12 PM »
Yes, ONTEXT does not fire when you enter a channel message, only when someone else does it. The OutGongText event is fired when you type messages.
You said you wanted to do it for only 1 channel as well, so you would check "if Channel = "#mychannel" then" as well.
« Last Edit: August 08, 2005, 04:18:03 PM by Snerf »
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: very simple script
« Reply #3 on: August 09, 2005, 06:02:38 AM »
Ok, thanks for the help

Next I would like it to read a specific line from a file

ex.

<someone> !line b
<me> "a specific line b in a file"
"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: very simple script
« Reply #4 on: August 09, 2005, 06:29:47 AM »
Use the identifier $read for this. $read(filename,linenumber)

So inside the script engine you use - Getidentifier("$read(filename,linenumber)")

The filename can just be the actual file name, if the file is in your IceChat5\Scripts folder, it does not need the path then.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: very simple script
« Reply #5 on: August 09, 2005, 07:42:45 AM »
Thank you once again.

Use the identifier $read for this. $read(filename,linenumber)

So inside the script engine you use - Getidentifier("$read(filename,linenumber)")
Sorry for asking these stupid questions, but how do I get the bot to display the text on the line


I shall bother you people once more  :-)
How could I make a script that my bot would take commands only from me?

ex

<me>!op someone
<mybot> /mode #channel +o someone

and It should only work if I give the command

Also, can I get a script to load when I connect to a server?
« Last Edit: August 09, 2005, 07:50:57 AM by Morio »
"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: very simple script
« Reply #6 on: August 09, 2005, 04:30:36 PM »
Hmm, this is a "very simple script" ?  I dont think so,  :-P .

How do you want the bot to display the text, by sending a message back to the channel?

SendCommand "/msg " & Channel & " $read(filename, linenumber)",ServerNumber

If you only want it to work from you, ONTEXT passes Nickname and Host, so you can use either to check.

If NickName = "SomeNick" then ...

or

If Host = "ident@world.com" then ...

Its your own choice, or you can use both, if you want it most secure.
The IceChat God

Lostsoul

  • Newbie
  • *
  • Posts: 5
Re: very simple script
« Reply #7 on: August 09, 2005, 06:22:19 PM »
On the same subject.  I'm really lazy, is there some where i can download a bot?  I tried to write one but.....i got confused to say the least..

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: very simple script
« Reply #8 on: August 09, 2005, 06:31:58 PM »
Nope, what you see in the Download Section for Scripts, is all that has been submitted.
The IceChat God

Lostsoul

  • Newbie
  • *
  • Posts: 5
Re: very simple script
« Reply #9 on: August 09, 2005, 08:15:10 PM »
Well, i also mean if you know of any other bots that are external from Icechat.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: very simple script
« Reply #10 on: August 09, 2005, 09:30:37 PM »
Just go on google and type "irc bot" .. tonnes of them are available.  But I do not know scripting for other programs, only IceChat.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: very simple script
« Reply #11 on: August 10, 2005, 01:24:59 AM »
Ok, thank you once again, but I still won't get the $read thing to work

this is the full code

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)                           
if Message = "H" then       
    Getidentifier("$read(test.txt,1)")                       
SendCommand "/msg " & channel & " $read(test.txt, 1)", ServerNumber                 
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: very simple script
« Reply #12 on: August 10, 2005, 06:59:50 AM »
Does "test.txt" exist in your IceChat5\Scripts folder?  Because that is where it needs to be, as I stated in an earlier message.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: very simple script
« Reply #13 on: August 10, 2005, 11:52:39 AM »
Yes it does, and all I get is

<Moriobot> $read(test.txt, 1)
"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: very simple script
« Reply #14 on: August 10, 2005, 03:17:17 PM »
Ok, thank you once again, but I still won't get the $read thing to work

this is the full code

Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)                           
if Message = "H" then       
    Getidentifier("$read(test.txt,1)")                       
SendCommand "/msg " & channel & " $read(test.txt, 1)", ServerNumber                 
end if                         
End Sub                           


You did it wrong, it should be like this.
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)                           
if Message = "H" then                 
  SendCommand "/msg " & channel & " $read(test.txt, 1)", ServerNumber                 
end if                         
End Sub                           
The IceChat God