First While Loop :D

By Kentaro Kurosaki on Dec 10, 2011

Just tells me his connections without me having to eval his $scon's.
It works, tested it multiple times

In action

[12/10/11 -=- 9:42 27] !allserv
[12/10/11 -=- 9:42 31] I'm on 4 networks, though I may not be connected to them.
[12/10/11 -=- 9:42 31] Connection 1 - Network: Rizon Server: irc.cyberdynesystems.net Port: 1337 Status: connected
[12/10/11 -=- 9:42 31] Connection 2 - Network: Infinity-IRC Server: Netgear.infinityirc.com Port: 1337 Status: connected
[12/10/11 -=- 9:42 31] Connection 3 - Network: Abjects Server: kaliber.de.eu.abjects.net Port: 6667 Status: connected
[12/10/11 -=- 9:42 31] Connection 4 - Network: SwiftIRC Server: helix.fl.us.SwiftIRC.net Port: 6667 Status: connected

on *:TEXT:!allserv:*: {
  set %servers 0
  set %connections 0
  msg $chan I'm on $scon(%servers) networks, though I may not be connected to them.
  inc %servers 1
  inc %connections 1
  while (%servers < 6) {
    msg $chan Connection %connections - Network: $scon(%servers).network Server: $scon(%servers).server Port: $scon(%servers).port Status: $scon(%servers).status
    inc %servers 1
    inc %connections
  }
}

Comments

Sign in to comment.
IllogicTC   -  Dec 10, 2011
on *:TEXT:!allserv:#: {
  var %servers = $scon(0),%x = 0
  msg $chan I'm on $scon(%servers) networks, though I may not be connected to them.
  while (%x < %servers) {
    inc %x
    msg $chan Connection %x - Network: $scon(%x).network Server: $scon(%x).server Port: $scon(%x).port Status: $scon(%x).status
  }
}

Does the same thing, but a bit cleaner. This will also support you being on as many servers as you would like. It could be 1 or 100, and it'll work (although that many and you'll likely flood the channel and get in trouble)

*When increasing or decreasing a variable, if it's going up or down by 1 you do not have to specify the amount to increase or decrease it.

When using this as a channel-only command (like where it's posting to the channel), use # instead of in the ON TEXT event, otherwise people could keep PMing you with the command.

*You should use var instead of set for these variables, since they're only used within this snippet and don't need to be remembered forever, just for the length of the script.

 Respond  
Frenetic   -  Dec 10, 2011

Ah I see. :)

 Respond  
Kentaro Kurosaki   -  Dec 10, 2011

I know, it was telling me how many at the certain time i was on :P
ie if I had 5 connections up for him it would tell me 5

 Respond  
Frenetic   -  Dec 10, 2011

$scon(0) returns the amount of servers you're on, lol.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.