mIRC Homepage
Posted By: NeUtRoN_StaR multiserver away help - 09/01/06 02:24 AM
ive been charged with making a away system i wrote multiserver friendly
so i've tried to introduce dynamic variables that incorporate the cid for the connection on which they are set

this has managed to also make several features not work
heres the code if anyone would like to take a look
i didnt include anything pertaining to the dialogs or load unload exit

Code:
#away.aliases on
alias away.off {
  if ($+(%,as6,$cid,away) != off) {
    scid $cid nick $mnick    
    set $+(%,as6,$cid,away) off
    echo 5 -a Away is off.
    set %as6chan 1
    set %as6cnum $chan(0)      
    while (%as6chan <= %as6cnum) {
      scid $cid notice $chan(%as6chan) $mnick is %as6backmessage     
      inc %as6chan      
    }    
  }      
  else {
    echo 5 -a Away is already off.
  }
}  
alias away.on {
  if ($+(%,as6,$cid,away) != on) {
    scid $cid tnick $me $+ - $+ %as6awaysuffix    
    set $+(%,as6,$cid,away) on
    echo 5 -a Away is on.
    set %as6chan 1
    set %as6cnum $chan(0)      
    while (%as6chan <= %as6cnum) {
      .timer 1 1 scid $cid notice $chan(%as6chan) $mnick is %as6awaymessage $+ ; to page me type !page $!me     
      inc %as6chan      
    }      
  }      
  else {
    echo 5 -a Away is already on.   
  }
}    
alias autoback.on {
  if ($group(#autoback) != on) {
    .enable #autoback
    echo 5 -a Auto back is on
  }      
  else {
    echo 5 -a Auto back is already on    
  }
}
alias autoback.off {
  if ($group(#autoback) != off) {
    .disable #autoback
    echo 5 -a Auto back is off
  }
  else {
    echo 5 -a Auto back is already off  
  }
}  
alias autoaway.on {
  if ($timer(away) == $null) {
    .timeraway 0 10 away.idle
    echo 5 -a Auto away is now on.    
  }
  else {
    echo 5 -a Auto away is already on.
  }  
}
alias autoaway.off {
  if ($timer(away) != $null) {
    set %as6timeraway off      
    .timeraway off
    echo 5 -a Auto away is now off    
  }
  else {
    echo 5 -a Auto away is already off.
  }
}
alias away.idle {
  if (($idle >= 600) && ($+(%,as6,$cid,away) != on)) {
    away.on
  }
}
alias pager.on {
  if (%as6pagetimer == on) {
    unset %as6pagetimer
    echo 5 -a Pager has been turned on.
  }
  else {
    echo 5 -a Pager is already on
  }
}
alias pager.off {
  if (%as6pagetimer != on) {
    set %as6pagetimer on
    echo 5 -a Pager has been turned off
  }
  else {
    echo 5 -a Pager is already off.
  }
}
#away.aliases end
#away on
on *:Connect: { 
  if (%as6timeraway != off) {  
    .timeraway 0 10 away.idle 
  }
}
on *:text:*:?:{
  if (($+(%,as6,$cid,away) == on) && (%as6awaymsgtimer != on)) {
    scid $cid msg $nick 4,1 Sorry $nick $+ ; I am %as6awaymessage $+ ; to page me type !page $me 
    set -u10 %as6awaymsgtimer on  
  }
}
on *:text:!page &:#:{
  if ((($+(%,as6,$cid,away) == on) && (%as6pagetimer != on) && ($$2 == $me))) {
    .timer 5 1 beep
    set $+(-u,$(%as6cooldown)) %as6pagetimer on
    echo 5 -a $nick paged you!
    scid $cid msg $chan 11,1 $nick has paged me, the pager wont be available for $calc($(%as6cooldown)/60) minutes.
  }
}
#away end

#autoback off
on *:input:*:{
  if ($+(%,as6,$cid,away) == on) { 
    away.off
  }
}
#autoback end
Posted By: genius_at_work Re: multiserver away help - 09/01/06 02:57 AM
Is there an actual question in there?

-genius_at_work
Posted By: NeUtRoN_StaR Re: multiserver away help - 09/01/06 02:59 AM
the pager
the autoaway
the msg response
and possibly other things now no longer work
why?
Posted By: HAMM3R Re: multiserver away help - 09/01/06 11:19 PM
I wouldnt use CIDs if I were you. What if you disconnected from a server without setting back? Then all your CIDs would be out of order. You should probably use the network name instead.
Posted By: NeUtRoN_StaR Re: multiserver away help - 09/01/06 11:25 PM
thanks for the suggestion
i dont suppose you would have an example handy of how that would work
Posted By: NeUtRoN_StaR Re: multiserver away help - 09/01/06 11:50 PM
well you see neutron star
almost all of your checks return the variable name rather than the value it contains
this in turn causes virtually all aspects of your script to go haywire

you can fix this by surround each dynamic variable with $( ,2)
Posted By: Aenei Re: multiserver away help - 10/01/06 12:46 AM
As we established in this thread the cid isn't recycled by mirc (though obivously $scon will chnage if he gets disconnected) so he should be ok to use $cids, shouldn't he?
Posted By: FiberOPtics Re: multiserver away help - 10/01/06 01:10 AM
What you are doing makes absolutely no sense.

//scid $cid <command>

is the same as doing

//command

You are setting the connection to the id of the current connection, and then performing a command. Think about how that sounds for a while.

To illustrate try in any server window: //scid $cid echo -s hello

Guess in which server window's status window it will echo that...(-a is different, because of it's special feature of echoing things to your active window, whichever server that migth be)


Also note that you are setting a bad example with executing commands directly in a /scid command. Preferable is to use:

scid <N>
command

This isn't gonna go anywhere without taking the time to try to understand how multi-server works, all you need to do is type /help /scid, read it a couple of times, think, read some more, test, think and that should be it.

Additionally, take a look at $findcid() and the code examples that are included in the top of the file. They will help you understand the multi-server feature in mIRC a little more.
Posted By: NeUtRoN_StaR Re: multiserver away help - 10/01/06 01:16 AM
yep your absolutly right
all that crap has been cut long before you posted this
but it was nice of you to take the time
© mIRC Discussion Forums