Returning results from called script via alias - 24/07/07 10:16 AM
Yeah, that actually was the best subject I could think of.
Anywho, I've written myself a nice little tvrage-alias that works like a charm. So a few other guys wanted to use it too, so I made a remote script that calls the alias, no problem there. However, I can't figure out a way to return the results from the alias to the remote script since the alias calls several events in a chain.
Here's the code so you guys will understand what I'm saying.
So when calling this alias from a remote, I get the results echoed. Is it possible to somehow return the data to the remote script instead? Like "return %show.name %show.country %show.next" in another way? It's then easy for me to decide in my remote script whether to echo or announce.
Cheers!
Anywho, I've written myself a nice little tvrage-alias that works like a charm. So a few other guys wanted to use it too, so I made a remote script that calls the alias, no problem there. However, I can't figure out a way to return the results from the alias to the remote script since the alias calls several events in a chain.
Here's the code so you guys will understand what I'm saying.
Code:
alias tvrage { unset %tvrage* if (!$1) { /msg $chan You actually need to search for a TV-show you know! | return } %tvshow = $replace($1-,$chr(32),% $+ 20) } sockopen tvrage http://www.tvrage.com 80 } on *:sockopen:tvrage: { sockwrite tvrage GET http://www.tvrage.com/quickinfo.php?show= $+ %tvshow $+ $crlf } on *:sockread:tvrage: { if ($sockerr) { return } var %tvdata sockread %tvdata set %show_name $gettok(%tvdata,2,64) while ((!$sockerr) && ($sockbr)) { %tvrage.data = %tvrage.data $+ %tvdata sockread %tvdata if (country isin %tvdata) { set %show_country $gettok(%data,2,64) } if (next isin %tvdata) { set %show_next $gettok(%data,2,64) } } } on *:sockclose:tvrage:{ echo -a $time %show_name %show_country %show_next unset %tvrage.* unset %show_* }
So when calling this alias from a remote, I get the results echoed. Is it possible to somehow return the data to the remote script instead? Like "return %show.name %show.country %show.next" in another way? It's then easy for me to decide in my remote script whether to echo or announce.
Cheers!