Author Topic: !status  (Read 15452 times)

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
!status
« on: March 27, 2008, 10:59:45 PM »
Is there any way to make a status script to split up the topic? For example...

"The Topic Is: IRC Clients || ... || Visit Our Web Site (Topic || Status || Message)"

Is There Any Way To Have A Status Script That Only Would Change Part Of The Topic, Like... "!Status Is Sleeping" ?

"Ares Sets Topic To: IRC Clients || TheCellist42 Is Sleeping || Visit Our Web Site"

Any Way To Do Something Like This, Or Modify My Topic Script?   :-)

Topic Script:
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If Left(Message,7) = "!topic " and Len(Message) > 7 then
If ISOP(Nickname,Channel,ServerNumber)=True then
  NewTopic = Mid(Message,8)
  SendCommand "/topic Our topic is: " & NewTopic, ServerNumber
End If
End If
End Sub
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #1 on: March 27, 2008, 11:47:44 PM »
to get the current topic use: CurrentTopic = GetIndentifier("$chan(" & Channel & ").topic)

If the topic always has the same layout you can us something like this to parse it:

Code: [Select]
TopicLeft = Left(CurrentTopic,InStr(CurrentTopic,"||") - 2
CurrentTopic = Mid(CurrentTopic,InStr(CurrentTopic,"||") +3
TopicMiddle = Left(CurrentTopic,InStr(CurrentTopic,"||") - 2
TopicRight = Mid(CurrentTopic,InStr(CurrentTopic,"||") +3

"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

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #2 on: March 28, 2008, 09:01:18 AM »
I keep getting errors like "Unterminated string constant" and "Syntax Error"

I probably placed the line wrong
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #3 on: March 28, 2008, 11:47:25 AM »
Sorry, I seem to have missed a "

CurrentTopic = GetIndentifier("$chan(" & Channel & ").topic)"

Oh, and also the 4 other lines need an ) at the end
« Last Edit: March 28, 2008, 11:49:04 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: !status
« Reply #4 on: March 28, 2008, 12:07:35 PM »
Still got it wrong Morio, the ending quote had to be inside the closing bracket, and also wise to add ServerNumber in there.

CurrentTopic = GetIndentifier("$chan(" & Channel & ").topic", ServerNumber)
The IceChat God

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #5 on: March 29, 2008, 11:38:44 AM »
Where Would I Put The Line?...(Replacing !topic with !status)  :?

I Can't Get It To Work
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #6 on: March 29, 2008, 11:45:31 AM »
You can't use the ONTEXT sub for this because it won't trigger for yourself. You could use something like this

Code: [Select]
Sub NewStatus(StatusChange)
Your code here
End Sub

then make an alias like this:
Code: [Select]
/status:/! NewStatus $1-

then you can just use /status newstatus_goes_here to change the status part
"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

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #7 on: March 29, 2008, 11:54:23 AM »
I wouldn't be using the script myself, my bot would, so I could trigger it
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #8 on: March 29, 2008, 01:03:31 PM »
Then you would use the !status command just like you use the !topic command
"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

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #9 on: March 29, 2008, 01:31:03 PM »
The Problem, Is That I Can't Get It To Work

How Would I Put The Line Into The Script?
I Tried, Didn't Get Any Errors, But It Didn't Work Either
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #10 on: March 29, 2008, 02:15:27 PM »
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If Left(Message,8) = "!status " and Len(Message) > 8 then
.
.
.
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

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #11 on: March 29, 2008, 02:42:42 PM »
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
If Left(Message,8) = "!status " and Len(Message) > 8 then
If ISOP(Nickname,Channel,ServerNumber)=True then
NewTopic = Mid(Message,9)
CurrentTopic = GetIdentifier("$chan(" & channel & ").topic)"
SendCommand "/topic " Sam Is " & NewStatus, ServerNumber
End If
End If
End Sub

??
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #12 on: March 29, 2008, 02:51:13 PM »
So you decided to completely skip the other 4 lines I posted earlier? The code that actually parses the topic.

Code: [Select]
TopicLeft = Left(CurrentTopic,InStr(CurrentTopic,"||") - 2)
CurrentTopic = Mid(CurrentTopic,InStr(CurrentTopic,"||") +3)
TopicMiddle = Left(CurrentTopic,InStr(CurrentTopic,"||") - 2)
TopicRight = Mid(CurrentTopic,InStr(CurrentTopic,"||") +3)

TopicLeft is the stuff before the first '||', TopicMiddle is the stuff between the '||' and TopicRight is the part after the last '||'
This way you can pretty easily change any part of the topic. and to set the new topic do this:

Code: [Select]
SendCommand "/topic " & Channel & " " & TopicLeft & " || " & TopicMiddle & " || " & TopicRight,ServerNumber
« Last Edit: March 29, 2008, 02:53:22 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

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: !status
« Reply #13 on: March 29, 2008, 02:58:45 PM »
Im Still Getting Expected End Of Statement Errors

And I Tried To Fix It, But It Still Wouldn't Work!
~ Sam
~ Visit my website at http://www.TheCellist42.com

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: !status
« Reply #14 on: March 29, 2008, 03:56:05 PM »
Check the console and see which line gives the error.

None of the lines in my last post gave any sort of error.
"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