Author Topic: A little help needed again  (Read 4614 times)

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
A little help needed again
« on: August 26, 2005, 05:42:42 AM »
how can I make a script so that my bot joins a channel when I tell it to?

for example
<me> Mybot join #channel
Then Mybot should join #channel.

Also I would like this to work whether I send the bot a private message or say it on a channel where it is.

Thank you in advance

(hope that made any sense)
« Last Edit: August 26, 2005, 05:44:37 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: A little help needed again
« Reply #1 on: August 26, 2005, 03:30:36 PM »
You would make it check for "MyBot join" and then join the channel that is after that word.
You would use the ONTEXT Script event for this, and/or ONQUERY if you want it to work in private.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: A little help needed again
« Reply #2 on: August 27, 2005, 02:17:05 AM »
what command do I need to make it pick up the word after "Mybot join"?

Sorry again for being a bit stupid
"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: A little help needed again
« Reply #3 on: August 27, 2005, 09:42:13 AM »
Well, the easiest thing to do is split the Message into words.
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
words = split(Message," ")
If left(Message,10) = "Mybot join" and ubound(words) = 2 then
   SendCommand "/join " & words(2), ServerNumber
End if
End Sub

The split command seperates the Message into an array that contains all the words.
So, if the Message was "Mybot join #channel" then:
words(0) = "Mybot
words(1) = "join"
words(2) = "#channel"

The Ubound command checks the upper bound of the array, and we want it to be 2, becaue we only need 3 words.

On a side note, have you read the FAQ on Basic VB Scripting, it will help you a lot.
« Last Edit: August 27, 2005, 09:48:43 AM by Snerf »
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: A little help needed again
« Reply #4 on: August 27, 2005, 09:56:58 AM »
Ok, thank you for your help once again.

Hadn't noticed the FAQ, I'll look into it right away
"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