#NewScriptBegin AwayList
 
Dim MyFrameID
Dim CurFrameIndex
Dim Interval
Dim FirstRun
 
Sub Load()
  'Alle wieviel Sekunden aktualisiert werden soll:
  Interval=200
 
  FirstRun=1
  CurFrameIndex=0
  SetNextRef
End Sub
 
Sub SetNextRef()
  'Zählen der offenen Channel:
  MaxFrCount=0
  i=1
  do until i > FrameCount
    FrID=GetFrameByIndex(i)
    if GetFrameType(FrID)=0 and len(GetCaption(FrID)) > 0 Then MaxFrCount=MaxFrCount+1
    i=i+1
  loop
  'Nach dem start erstmal schnell alle Channel durchgehen
  if FirstRun=1 Then
    StartTimer 3000, 0, "TimerEvent", 1
  else
    StartTimer Interval/MaxFrCount*1000, 0, "TimerEvent", 1
  end if
End Sub
 
Sub TimerEvent(TimerID)
  i=0
  do
    if CurFrameIndex > FrameCount Then
      CurFrameIndex=0
      FirstRun=0
      i=i+1
    End if
    CurFrameIndex=CurFrameIndex+1
    FrID=GetFrameByIndex(CurFrameIndex)
  loop until (GetFrameType(FrID)=0 and len(GetCaption(FrID)) > 0) or i > 1
  CheckAwayState FrID
  SetNextRef
End Sub
 
Function CheckAwayState(FrameID)
  RegEvent 315, GetConn(FrameID)
  RegEvent 352, GetConn(FrameID)
  MyFrameID = FrameID
  ClearList FrameID
  send "/who " + getcaption(FrameID), FrameID
End Function
 
Sub Serv_RegedEvent(EventID, Sender, ConnID, Text, RawData)
  if EventID = 315 Then
    UnRegEvent 315, FrontConnID
    UnRegEvent 352, FrontConnID
    skipevent
  end if
  if EventID = 352 Then
    i=instr(1, split(RawData, 9), "G")
    if i > 0 Then
      SetListColor MyFrameID, GetListIndex(MyFrameID, split(RawData, 8)), rgb(100,100,200)
    end if
    skipevent
  end if
End Sub
 
Function ClearList(FrameID)
  i=0
  do
     SetListColor FrameID, i, -1, 1
    i=i+1
  loop until i >= getlistcount(FrameID)-1
  SetListColor FrameID, i, -1
End Function

Eigene Werkzeuge