|
Joined: Aug 2005
Posts: 30
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 30 |
Is it possible to have a timer that's network specific? It's troublesome trying to get things to work when it's server specific :\
|
|
|
|
Joined: Aug 2005
Posts: 525
Fjord artisan
|
Fjord artisan
Joined: Aug 2005
Posts: 525 |
alias specifictimer {
if ([color:red]server[/color] isin $server) { timer 1 1 do-something-here }
if ([color:red]server2[/color] isin $server) { timer 1 1 do-something-else-on-another-server }
} For example if you are connected to irc.quakenet.org you replace server with quakenet. You can also use $network in place of $server if you wish. It should work either way. Then do /specifictimer to start the timer Here's a version that's easier for on the fly timers..
alias stimer1 {
if ([color:red]server[/color] isin $server) { timer $1 $2 $3- }
}
alias stimer2 {
if ([color:red]server2[/color] isin $server) { timer $1 $2 $3- }
}
Useage for network 1: /stimer1 <#> <#> <commands-to-execute> Useage for network 2: /stimer2 <#> <#> <commands-to-execute> Basically the same as the regular /timer but with an s at the front, and a number to determine which server to do the timer on. If you need further help, just post here again.
Last edited by schaefer31; 12/10/05 11:44 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
That's not really what he wanted, and I think you're looking for $network instead of $server.
If you want to make timer that's network-specific to keep things sorted out, you could name it with the name in the timer name...
//timer $+ $network $+ .announcement 0 600 echo -a This is my 10 minute ad.
If you were on Undernet, the timer name would be Undernet.announcement
Then, if you were on Efnet, it would be Efnet.announcement
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
All timers are network specific by default, they are assigned to the network in which you started them (either by command of as a result of a called event or alias). If you are working with some sort of on connect thing to start different timers on different networks by all means an if ($network == ??) will work. If you wish to start multiple timers from one event/alias to run on different networks you can use the scon/scid etc commands. Example: net2cid is a snippet i use in order to get a cid from a network name (as returned by $network, not $server). scid $net2cid() will change the active cid to that of the specified network name, replace NETWORKX with the network names. scid -r returns the active scid back to that which called the event/alias/etc so the msg is sent to the correct location. Note: coded during post so untested but should work.
on *:text:!starttimers:*: {
scid $net2cid(NETWORK1)
.timer 10 1 echo -s One second timer on $!network
scid $net2cid(NETWORK2)
.timer 5 2 /myalias bla test
scid -r
msg $target Timers started.
}
alias myalias { echo -s Two second timer :: $1- }
alias net2cid {
var %x = $scon(0), %y = 0
while (%y <= %x) {
if ($scon(%y).network == $1) {
return $scon(%y)
}
inc %y
}
}
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
One small note regarding your net2cid alias: you're initiating the loop at %y = 0, which will cause there to be an extra iteration, since there's no network with "cid = 0". Putting it at %y = 1 will prevent that.
Aside from that, it's a shame that many people don't use it more often, it should be used in any kind of multiserver script where people need to find out the cid based on a server.
You could expand it to use $prop, so that you could specify $net2cid(<string>).network or $net2cid(<string>).server
To make it even more complete you could give support for looking if you're on a channel on a certain server/network, as many people use multiserver commands to relay text from one channel on one network, to another channel on another network. Something like $net2cid(<string>,[channel]).[network|server]
Anyway they're just suggestions...
Gone.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Not sure if you meant to reply to me, Om3n... If so, I was just showing how to name the timers so that you can tell the difference between each network's timers when being created through a script. From the wording, it seems to me that he wanted a way to have each timer set from a script to be based named whatever the network was. Maybe I'm wrong.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Aug 2005
Posts: 30
Ameglian cow
|
OP
Ameglian cow
Joined: Aug 2005
Posts: 30 |
Sorry for not replying earlier yesterday. I was a bit busy, so I couldn't tell you of my scid idea ^^ Mine uses the idea of a scid in the timer. For the curious, here:
on *:connect:{
set $+(%,$network,.connection) $cid
}
alias stimer scid $($+(%,$1,.connection),2) //.timer $+ $2 $3 $4 $5-
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
Indeed it should be 1 not 0, setting while loop variables to 0 by default is kind of a habbit for most people i think Good suggestions, that little alias was probably the first thing i wrote when the scid/scon stuff was introduced, will bookmark the thread and work on it when i have a little time and mirc handy. Raimus2, wasn't directed specifically at you, just can never be bothered scrolling back up to hit the correct reply button.
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
Hmm, just to clarify your suggestions, is this how you were suggestion the properties work...
$net2cid(irc.prison.net).network -> return EFnet if you are on irc.prison.net (which is an efnet server) else return null even if you are on efnet but not that particular server. $net2cid(efnet).server -> return irc.prison.net (or other server) if you are on efnet, else return null. If no prop is specified, it should work with both server and network strings, and return the cid. if something like $net2cid(efnet).network is used, should prop be ignored?
Edit :: on second though, i suppose it should work exactly as $scon().prop does, in which case all it needs is a simple "if ($prop)" with no restriction on the prop you can use
Last edited by Om3n; 16/10/05 06:19 AM.
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
|