|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
This is alot like the last problem I had where it is echoing "WEATHER Unknown command" in my status window when I run this. I switched to using comcall for this to make it faster, and I'm not sure what to change this time to halt that echo in my status window. Here's what I have:
on 1:text:!weather*:#:{
if ($network == BlakeNET) {
if ($com(weather)) {
var %zip = $2
!.echo -q $comcall(weather,$weathercom(%zip,$nick),GetWeather,3,bstr,%zip)
}
else {
comopen weather weather.GWeather
var %zip = $2
!.echo -q $comcall(weather,$weathercom(%zip,$nick),GetWeather,3,bstr,%zip)
}
}
}
alias weathercom {
msg botserv say $chan Weather for $1 requested by $2 -- $com(weather).result
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I managed to break this script, after I decided to make it use notices instead of saying it in the channel. I had noticed a problem before where it was giving someone the weather for the previously called location when they requested weather. Now it's just saying "Your Weather --". I changed it so that the COM connection would be called weather $+ $nick, because I thought that might make it less confusing, but it isn't working right. Here's what I have:
on 1:NOTICE:!weather*:*:{
if ($com(weather $+ $nick)) {
var %zip = $2
$comcall(weather $+ $nick,$weathercom(%zip,$nick),GetWeather,3,bstr,%zip)
comclose weather $+ $nick
}
else {
comopen weather $+ $nick weather.GWeather
var %zip = $2
$comcall(weather $+ $nick,$weathercom(%zip,$nick),GetWeather,3,bstr,%zip)
comclose weather $+ $nick
}
}
alias weathercom {
if ($network == BlakeNET) {
notice $2 2Your Weather -- $com(weather $+ $2).result
comclose weather $+ $2
}
else {
notice $2 2Your Weather -- $com(weather $+ $2).result
comclose weather $+ $2
}
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I've been testing this, and I think I fixed it, at least in this test alias. The only thing now is getting rid of "! UNKNOWN COMMAND" which "!.echo -q" handled before. Here are the two aliases that I have that work at the moment.
/weatherecho {
$comcall(weather,weatherechotwo,GetWeather,3,bstr,30117).result
}
/weatherechotwo {
echo -a $com(weather).result
}
EDIT: This is still giving the weather for the first location when you give it a second zip code. Is there any way to reset the result of the comcall after the weather is returned or to make it a separate COM for each person requesting weather? How can I handle this? Thanks.
Last edited by bwr30060; 19/04/06 01:38 PM.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
/weatherecho {
!.echo -q $comcall(weather,weatherechotwo,GetWeather,3,bstr,30117).result
}
/weatherechotwo {
echo -a $com(weather).result
} If you're using 6.17 using /noop instead of /!.echo -q would be a better option.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
Thanks. And I forgot to add the code on that last edit. Here it is
on 1:text:!weather*:#:{
if ($network == BlakeNET) {
if ($com(weather)) {
var %zip = $2
!.echo -q !.echo -q $comcall(weather,$weatherechotwo(%zip,$nick),GetWeather,3,bstr,%zip).result
}
else {
comopen weather weather.GWeather
var %zip = $2
!.echo -q $comcall(weather,$weatherechotwo(%zip,$nick),GetWeather,3,bstr,%zip).result
}
}
}
alias weatherechotwo {
msg botserv say $chan Weather for $1 requested by $2 -- $com(weather).result
}
Is there a way to reset the $com(weather).result or to make it a separate COM connection for each person. I'd rather not make it a separate one because that would really slow it down, but I'm open to any suggestions.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I may have resolved this by putting the weather report into a variable and echoing that, but I'm still getting "WEATHER Unknown command". I'm not sure how to halt that.
on 1:text:!weather*:#:{
if ($network == BlakeNET) {
if ($com(weather)) {
var %zip = $2
noop $comcall(weather,$weatherechotwo(%zip,$nick),GetWeather,3,bstr,%zip)
}
else {
comopen weather weather.GWeather
var %zip = $2
noop $comcall(weather,$weatherechotwo(%zip,$nick),GetWeather,3,bstr,%zip)
}
}
}
alias weatherechotwo {
var %weather = $com(weather).result
msg botserv say $chan Weather for $1 requested by $2 -- %weather
}
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
This is still returning the weather data from the previous call. Is this maybe not a mIRC issue and possibly a problem with the DLL not getting rid of the old data? Any other suggestions on what to try from this side of it? Thanks.
|
|
|
|
Joined: May 2005
Posts: 449
Fjord artisan
|
OP
Fjord artisan
Joined: May 2005
Posts: 449 |
I fixed this problem (I think). I haven't gotten the repeat weather the few times I've tested this so far. I'm not sure why this was a problem, but it got fixed when I switched back to using $com instead of $comcall. Is this a bug of some kind? It's a little slower this way, and I think I had manually opened the COM, so I'll still need to see if it opens if it isn't already, but it works for now. Here's what I have.
on 1:NOTICE:!weather*:*:{
if ($com(weather)) {
var %zip = $2
noop $com(weather,GetWeather,3,bstr,%zip)
var %weather = $com(weather).result
notice $nick Your weather for %zip -- %weather
}
else {
comopen weather weather.GWeather
var %zip = $2
noop $com(weather,GetWeather,3,bstr,%zip)
var %weather = $com(weather).result
notice $nick Your weather for %zip -- %weather
}
}
|
|
|
|
|