Maybe this will do the job for you
on *:sockread:fetch:{
; check if the header has been recieved
; if so read the data to a binvar and bwrite it
if $sock($sockname).mark {
sockread -f &a
bwrite $+(c:/winbolo/maps/,%map.name) -1 -1 &a
}
; Otherwise, read the header data and do nothing with it
else {
var %a | sockread %a
; The header will be followed by a blank line
; If the var is empty the header has been recieved
if !%a { sockmark $sockname 1 }
}
}
P.S. In the on text event, you should check if you are already downloading a map before trying to get another. You can do that by setting a var and unset it again in a sockclose event or by checking if $sock(fetch) is $null (or you could use multiple sockets).