sockets are asyncornous. Meaning they stand outside the falling-rock programma you are most likely used to.
What your current code is doing is opening the socket, echoing %data(which hasn't been set yet), then immediately closing the socket before any events of the socket are fired.
Fixed:
on *:SOCKOPEN:inv:{
sockwrite -n $sockname GET /api/invasions HTTP/1.1
sockwrite -n $sockname Host toontownrewritten.com
sockwrite $sockname $crlf
}
on *:SOCKREAD:inv: {
if (!$sockerr) {
sockread -f %temp
if (%temp) {
echo -c notify %temp
; other processing
}
}
}
alias z {
sockopen inv www.toontownrewritten.com 80
}
---
Since the data you are retrieving is JSON style data, you may want to look at the link in my signature. I wrote a script that makes handling JSON data quite easy from within mIRC