Author Topic: away script?  (Read 2340 times)

josh260893

  • Newbie
  • *
  • Posts: 3
away script?
« on: July 11, 2012, 06:52:18 AM »
i want to make a script that sets me as away when i type certain words.

currently i am using this script
Code: [Select]
Function OUTTEXT(OutgoingText)
channel = getidentifier("$channel")
ServerNumber = GetIdentifier("$currentservernumber")
if (outgoingtext) = "shops" then
  SendCommand "/away gone shops"
  SendCommand "/nick Left[Shops]"
Else if (outgoingtext) = "brb" then
  SendCommand "/away be right back"
  SendCommand "/nick Left[brb]"
Else if (outgoingtext) = "cig time" then
  SendCommand "/away gone for a cig"
  SendCommand "/nick Left[cig]"
Else if (outgoingtext) = "playing xbox" then
  SendCommand "/away playing xbox"
  SendCommand "/nick Left[xbox]"
Else if (outgoingtext) = "food" then
  SendCommand "/away gone for food"
  SendCommand "/nick Left[food]"
Else if (outgoingtext) = "curt jelly?" then
  SendCommand "/away making curt jelly of my working script"
  SendCommand "/nick Left[making_curt_jelly]"
Else if (outgoingtext) = "back" then
  Sendcommand "/away"
  Sendcommand "/msg nickserv identify ********"
End if
End if
End if
End if
End if
End if
End if
OUTTEXT = outgoingtext
End Function

which works 100% fine and does what i want. the only problem is that it shows the outgoing text.

i made this script the make it so the outgoing text isnt shown to anyone else
Code: [Select]
Function OUTTEXT(OutgoingText)
channel = getidentifier("$channel")
ServerNumber = GetIdentifier("$currentservernumber")
OutGoingText = Replace(OutGoingText,"shops","/away gone shops")
OutGoingText = Replace(OutGoingText,"brb","/away be right back")
OutGoingText = Replace(OutGoingText,"cig time","/away cig")
OutGoingText = Replace(OutGoingText,"xbox","/away playing xbox")
OutGoingText = Replace(OutGoingText,"food","/away eating")
OutGoingText = Replace(OutGoingText,"back","/away")
if (outgoingtext) = "/away gone shops" then
  SendCommand "/nick Left[shops]"
Else if (outgoingtext) = "/away be right back" then
  SendCommand "/nick Left[brb]"
Else if (outgoingtext) = "/away cig" then
  SendCommand "/nick Left[cig]"
Else if (outgoingtext) = "/away playing xbox" then
  SendCommand "/nick Left[xbox]"
Else if (outgoingtext) = "/away eating" then
  SendCommand "/nick Left[food]"
Else if (outgoingtext) = "/away" then
  SendCommand "/nick Left"
  SendCommand "/msg nickserv identify *********"
End If
End If
End If
End If
End If
End If

OUTTEXT = outgoingtext
End Function

but i realised now that if i say any of those words normally it changes them. so how can i get it to only change the words if they are the only ones that are sent.

also when i do use any of the trigger words it sets me as away and changes my name but then it sets be as back straight after without me even using the back trigger word

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: away script?
« Reply #1 on: July 11, 2012, 07:12:38 AM »
Setting OUTTEXT = OutgoingText is the dilemna.

If you set OutGoingText = "" , you will not see what you typed, as the client will not do anything then.


Code: [Select]
if (outgoingtext) = "shops" then
  SendCommand "/away gone shops"
  SendCommand "/nick Left[Shops]"
  outgoingtext = ""
Else if (outgoingtext) = "brb" then
  SendCommand "/away be right back"
  SendCommand "/nick Left[brb]"
  outgoingtext = ""



etc etc, just blank it for each case.

So using the 1st code selection is the better of the 2.

Also, you only need 1 end if at the end of your else if statements, not one for each, as it is all 1 large if/else/end if statement.
The IceChat God

josh260893

  • Newbie
  • *
  • Posts: 3
Re: away script?
« Reply #2 on: July 11, 2012, 07:35:45 AM »
Setting OUTTEXT = OutgoingText is the dilemna.

If you set OutGoingText = "" , you will not see what you typed, as the client will not do anything then.


Code: [Select]
if (outgoingtext) = "shops" then
  SendCommand "/away gone shops"
  SendCommand "/nick Left[Shops]"
  outgoingtext = ""
Else if (outgoingtext) = "brb" then
  SendCommand "/away be right back"
  SendCommand "/nick Left[brb]"
  outgoingtext = ""



etc etc, just blank it for each case.

So using the 1st code selection is the better of the 2.

Also, you only need 1 end if at the end of your else if statements, not one for each, as it is all 1 large if/else/end if statement.

ahh ok then i see so its an easy fix.

Tried it and it works :)

also i tried it with one end if statement and it kees coming up on the console saying it expected the End if for every single one.
« Last Edit: July 11, 2012, 07:39:27 AM by josh260893 »