mIRC Home    About    Download    Register    News    Help

Print Thread
#138976 09/01/06 02:24 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
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

#138977 09/01/06 02:57 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Is there an actual question in there?

-genius_at_work

#138978 09/01/06 02:59 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
the pager
the autoaway
the msg response
and possibly other things now no longer work
why?

Last edited by NeUtRoN_StaR; 09/01/06 03:14 AM.
#138979 09/01/06 11:19 PM
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
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.


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#138980 09/01/06 11:25 PM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
thanks for the suggestion
i dont suppose you would have an example handy of how that would work

Last edited by NeUtRoN_StaR; 09/01/06 11:28 PM.
#138981 09/01/06 11:50 PM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
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)

Last edited by NeUtRoN_StaR; 09/01/06 11:50 PM.
#138982 10/01/06 12:46 AM
Joined: Nov 2005
Posts: 42
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Nov 2005
Posts: 42
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?

#138983 10/01/06 01:10 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.


Gone.
#138984 10/01/06 01:16 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
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


Link Copied to Clipboard