mIRC Home    About    Download    Register    News    Help

Print Thread
#172407 09/03/07 06:52 PM
Joined: Feb 2007
Posts: 33
H
harl91 Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Feb 2007
Posts: 33
is there something that will wait 5 seconds before carrying out the next command in a script?

harl91 #172409 09/03/07 07:04 PM
Joined: Jul 2006
Posts: 19
B
Pikka bird
Offline
Pikka bird
B
Joined: Jul 2006
Posts: 19
/timer


For everything else, there's MasterCard.
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
You should be more specific. The /timer command alone won't help him solve the problem, and if you use /timer, things can get complicated, and really messy.

There are a few snippets that can do this:
/pause by FiberOPtics
/sleep by Online

Read the notes for them, since it can get buggy when you're using on *:text:, etc events (it queues other events of the same type).


Those who can, cannot. Those who cannot, can.
Kardafol #172417 09/03/07 07:49 PM
Joined: Feb 2007
Posts: 33
H
harl91 Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Feb 2007
Posts: 33
Well heres the problem i have, maybe you can help

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;!tracker Script

on *:text:!tracker*:*:{
  write -c tracker.txt
  set %nick $nick
  sockopen winbolo tracker.winbolo.us 50000
}

on *:sockopen:winbolo:{
  if ($sockerr) return
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname Host: tracker.winbolo.us:50000
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Todo List                     ;
;;;Bot                           ;
;;;Password listed               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:sockread:winbolo:{
  var %a
  sockread %a
  write tracker.txt %a
  sockclose winbolo
  pause s 3
  if ($read(tracker.txt, 9) == ngames=1) { | halt }
  if ($read(tracker.txt, 9) == ngames=2) { msg %nick this is working! | halt }
  if ($read(tracker.txt, 9) == ngames=3) { msg %nick this is working!! | halt }
  if ($lines(tracker.txt) == 1) { msg %nick Sorry, please try that command again | halt }

}

what i want this to do is read some lines from tracker.txt, but how many depends on how many games are going on. The problem is, is that when i write some script for it, i use the $read like this

msg %nick IP: $mid($read(tracker.txt, 10), 9)

it sends IP: to the person, and then it sends IP: (ip here) after.

harl91 #172418 09/03/07 07:52 PM
Joined: Feb 2007
Posts: 33
H
harl91 Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Feb 2007
Posts: 33
and another problem is that it only puts the first line of tracker.winbolo.us:50000 into the text, yet other times it puts it all. I want all in there. Its weird

harl91 #172419 09/03/07 08:52 PM
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
Edit: code:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;!tracker Script

on *:text:!tracker*:*:{
  if (%trk.nick) .notice $nick Busy, try again later.
  else {
    set %trk.nick $nick
    sockopen winbolo tracker.winbolo.us 50000
  }
}
on *:sockopen:winbolo:{
  if ($sockerr) return
  var %d = sockwrite -n $sockname
  %d GET / HTTP/1.1
  %d Host: tracker.winbolo.us
  %d Accept: */*
  %d Connection: Close
}

on *:sockread:winbolo:{
  if ($sockerr > 0) trke
  var %a
  while (1) {
    sockread %a
    if ($sockbr == 0) break
    tokenize 61 %a
    if (GAME* iswm $1) {
      ctrk
      trk server $2
    }
    else trk $1-
    if ($1 == STARTTIME) .notice %trk.nick $trk(server) - Map $trk(map) -  $+(V,$trk(version)) - Type $trk(type) - B/P $+($trk(bases),/,$trk(pills)) - Password $trk(password)
  }
  .timertrackh 1 2 trkd
}
alias ctrk {
  hfree tracker
}
alias trke {
  .notice %trk.nick Error, try again later.
  trkd
  halt
}
alias trkd {
  unset %trk.nick
  hfree tracker
}
alias trk {
  if ($isid) return $+(,$hget(tracker,$1),)
  hadd -m tracker $1-
}

Use $trk(item) to get a value, for example: limit, starttime, etc.

Last edited by Kardafol; 09/03/07 09:38 PM.

Those who can, cannot. Those who cannot, can.
harl91 #172422 09/03/07 10:43 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, you could just get and output the data without /writing anything. Or, you could use both methods, /write it, but still output it while reading it. Or, you can use a /timer and /play the text file after 3 seconds. There are many ways you can do it.

A couple of items to note, though:

Code:
  if ($read(tracker.txt, 9) == ngames=1) { | halt }
  if ($read(tracker.txt, 9) == ngames=2) { msg %nick this is working! | halt }
  if ($read(tracker.txt, 9) == ngames=3) { msg %nick this is working!! | halt }
  if ($lines(tracker.txt) == 1) { msg %nick Sorry, please try that command again | halt }


Why are you halting? Just use IF/ELSEIF. Avoid HALT whenever possible. Also, if you use HALT and nothing else (line 1), you don't put a | in there.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #172583 12/03/07 02:36 PM
Joined: Feb 2007
Posts: 33
H
harl91 Offline OP
Ameglian cow
OP Offline
Ameglian cow
H
Joined: Feb 2007
Posts: 33
thanks karafol for the script! maybe you guys could helpme make it into a window. This is what i got so far.

Code:
menu channel,status {
  Tracker:dialog -m tracker tracker
}

dialog Tracker {

  title "Tracker"
  size 300 200 255 200
  option dbu

  Text "Server", 3, 10 110 200 7
  Text "Map", 4, 10 117 100 7
  text "Players", 5, 10 124 100 7
  text "Type", 6, 10 131 100 7
  combo 2, 10 10 125 100, sort
  combo 10, 200 200 125 100
  box "Tracker", 50, 5 2 245 170

  button "Track",  1, 135  10  60  20
  button "Clear", 8, 135 30 60 20
  button "Select", 9, 135 50 60 20 
  button "Join", 7, 10 150 60 20
}

on *:dialog:Tracker:sclick:*:{
  if ($did == 1) { sockopen winbolo tracker.winbolo.net 50000 }
  if ($did == 7) { run winbolo:// $+ %server }
  if ($did == 9) { did -ra tracker 3 Server: $trk(server) | did -ra tracker 4 Map: $trk(map) | did -ra tracker 5 Players: $trk(players) | did -ra tracker 6 Type: $trk(type) }
  if ($did == 8) { did -r tracker 2 | sockclose winbolo }
}

on *:sockopen:winbolo:{
  if ($sockerr) return
  var %d = sockwrite -n $sockname
  %d GET / HTTP/1.1
  %d Host: tracker.winbolo.net
  %d Accept: */*
  %d Connection: Close
}

on *:sockread:winbolo:{
  if ($sockerr > 0) trke
  var %a
  while (1) {
    sockread %a
    if ($sockbr == 0) break
    tokenize 61 %a
    if (GAME* iswm $1) {
      ctrk
      trk server $2
    }
    else trk $1-
    if ($1 == STARTTIME) did -a tracker 2 Server: $trk(server)
  }
  .timertrackh 1 2 trkd
}

alias ctrk {
  hfree tracker
}
alias trke {
  .notice %trk.nick Error, try again later.
  trkd
  halt
}
alias trkd {
  unset %trk.nick
  hfree tracker
}
alias trk {
  if ($isid) return $+($hget(tracker,$1))
  hadd -m tracker $1-
}


so i just need it so that when you press select, the info from that game is then put into server: map: players: type: underneith the combo box.


Link Copied to Clipboard