mIRC Home    About    Download    Register    News    Help

Print Thread
Variables and Networks #79797 18/04/04 03:34 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I did a search on this and i didn't find anything, but again, im not very good at searching, so if this question has been asked and answered before, tell me where laugh

Is there a possible way to assign different variables to different networks?

I mean, i'm building a bot and i want it to be in 2 different networks at the same time. One of those networks has a Nick Serv so in its userlist it would just be 1000:Zyzzyx26!*@*

The thing is that the second network doesnt have a Ns service, but a ip masking one (username.users.undernet.org) - so, in its userlist it would be 1000:*!*@Zyzzyx26.users.undernet.org

Ok, so far so good.. but what if someone with the nick Zyzzyx26 joins Undernet (no nickserv) and uses 1000:Zyzzyx26!*@* to get access to the bot?

Is there a way to set 1000:Zyzzyx26!*@* only to one specific network?

Thanks a lot, Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79798 18/04/04 08:26 PM
Joined: Nov 2003
Posts: 67
C
Canario Offline
Babel fish
Offline
Babel fish
C
Joined: Nov 2003
Posts: 67
You can use $network identifier.

if ($network == Undernet) { commands }

You can use /auser 1000 address network
and then $ulist with .info propertie


irc.universochat.net
#escripting
Re: Variables and Networks #79799 18/04/04 08:40 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, its a very good idea! Though ive come to a problem lol..

When the bot is in 2 different networks and i tell it to op me in #chanA (in network1), if the $active of the bot is in network2 it wont work, since im not in #chanA in net2, but in #ChanA in net1 smile

If anyone has an answer, please come forward wink

Thanks, Zyzzy.


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79800 19/04/04 07:50 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
You use /scid or /scon to perform the command on the appropriate connection..

Here is a simple alias to find the CID of a particular network.
Code:
alias n-cid var %a | scon -a if $1 == $!network $eval({ var %a = $cid },0) | return %a

Example...
  • scid $n_cid(Undernet)
    mode #chanA o Zyzzyx26


Here is the same alias except this finds the CID by server name
Code:
alias s-cid var %a | scon -a if $1 == $!server $eval({ var %a = $cid },0) | return %a


Re: Variables and Networks #79801 19/04/04 12:26 PM
Joined: Jan 2003
Posts: 428
P
PastMaster Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Jan 2003
Posts: 428
As long as you are aware that not ALL servers fill the $network identifier - IRCnet, for example, has several that do not. So check before trying to use! wink

PM


IRCnet & DALnet @#travelersinn
:-: IRC for fun and relaxation :-:
Re: Variables and Networks #79802 19/04/04 12:38 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Mistake fixing: shocked
  • scid $$n-cid(Undernet)
    mode #chanA o Zyzzyx26


Re: Variables and Networks #79803 19/04/04 05:30 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, thats a nice command! laugh I had seen it before, but was never curious enough to dig in and find out about it :P

I made sth that tells me in what Nets the bot is right now:

Code:
ctcp 900:scid*:*: {
  unset %nets
  var %scid.total = $scid(0)
  var %i = 1
  while (%i <= %scid.total) {
    set % [ $+ [ $scid(%i).$network ] ] $scid(%i)
    set %nets %nets $+ $chr(32) $+ $scid(%i).$network
    inc %i
  }
  .notice $nick I am in: %nets
}


It also sets a var called %[network_name] which contains the $cid of that network.

Its useful IF i knew what to do with it lol smile I mean, how do i tell the bot to use this or that command in the right network? Do i have to add a /scid in every command of the bot?? Or is there a way to tell the bot to switch its $active to the network with $cid = 1 ? (that last question sounds confusing :P)

Thank you very much,
Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79804 19/04/04 08:15 PM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
ctcp 900:scid*:*: {
  • var %nets
    scid -at1 $(var %nets = %nets $network,0)
    .notice $nick I am in: %nets
}

You might also use that idea, along with $findtok, to figure out what the $scon numbers are you might need if you want to /scon N command

alias getNScon {
  • var %networks
    scon -at1 $(%networks = %networks $me $+ : $+ $network,0)
    return $findtok(%networks, $1, 1, 32)
}
alias getSScon {
  • var %servers
    scon -at1 $(%servers = %servers $me $+ : $+ $network,0)
    return $findtok(%servers, $1, 1, 32)
}

$getNScon(DALnet) or $getSScon(mesra.kl.my.dal.net)



DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Re: Variables and Networks #79805 20/04/04 12:27 AM
Joined: Dec 2002
Posts: 102
M
MIMP Offline
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
You can also manually add the server to your servers list specifying which network it's part of. laugh mIRC will check your own personal server list when it looks up $network and can use that to ensure that the identifier still works as intended even on servers that don't support the other methods.


-
MIMP
Re: Variables and Networks #79806 20/04/04 01:53 AM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Thanks for the tips given, they work! laugh

However the whole thing is still messy smirk

Let's say i have my bot in Undernet and DALnet andI am only in Undernet. Now, i want to change modes in the DALnet chan, so i'd have to make my bot do this:

/scon %DALnet /mode #chan <modes>
(presuming its already set with the ctcp scid command)
right?

well.. the bot already has the channel mode script in it:
Code:
ctcp 500:cmode*:*: {
  if ($me isop $$2) { 
    mode $$2 $$3-
    .notice $nick Changed channel mode to $$3-
    halt
  }
}


So i changed that to this:

Code:
ctcp 500:cmode*:*: {
  if ($me isop $$3) { 
    scon [color:blue]$$2[/color] mode $$3 $$4-
    .notice $nick Changed channel mode to $$4-
    halt
  }
}


The ctcp command would be: /ctcp <bot_nick> %Network.var cmode #channel <modes> - isnt it?

Assuming the code is right, it doesnt work.. so it must be wrong :P

But where?


I also tried this thing:
Code:
ctcp 500:s cmode*:*: {
  if ($me isop $$4) { 
    scon $$3 mode $$4 $$5-
    .notice $nick Changed channel mode to $$5-
    halt
  }
}


where the /ctcp command is slightely different (note is s cmode and not cmode). The command would be:
/ctcp <bot_nick> s cmode %Network.var #chan <modes>
But still nothing..

Thanks very much for the help,
Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79807 20/04/04 04:15 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
You send: /ctcp bot_nick cmode dalnet #channel modes

The bot has this:
Code:
ctcp 500:cmode *:*:{
  scid $$n-cid($2)
  if $me isop $3 { mode $3 $$4- }
  scid -r
  .notice $nick Changed channel mode to $$4-
  halt
}
alias n-cid var %a | scon -a if $1 == $!network $eval({ var %a = $cid },0) | return %a
alias s-cid var %a | scon -a if $1 == $!server $eval({ var %a = $cid },0) | return %a


Re: Variables and Networks #79808 20/04/04 04:25 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
For those to work I believe you would need to remove the "$me $+ : $+ "

alias getNScon {
  • var %networks
    scon -at1 $(%networks = %networks $network,0)
    return $findtok(%networks, $1, 1, 32)
}

Re: Variables and Networks #79809 20/04/04 06:39 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, so this looks up the $cid of the network and uses it?

and...What does this mean?
Code:
scid $$n-cid($2)  
if $me isop $3 { mode $3 $$4- }  
scid -r


(sorry for all the questions, but im a lil confused lol smile

the scid $$n-cid - what does it do?

Thanks a lot,
Zyzzy. laugh


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79810 20/04/04 10:24 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
  scid $$n-cid($2)                [color:brown]| ; Switches the script to whatever CID is connected to $2
                                  | ; in the example, $2 would be dalnet[/color]
 
  if $me isop $3 { mode $3 $$4- } [color:brown]| ; checks if $me (the bot) is opped on $3 (the channel)
                                  | ; and changes modes specified in $4-[/color]
 
  scid -r                         [color:brown]| ; resets CID, so it can notice you on the correct connection.[/color]
See /help /scid

"the scid $$n-cid - what does it do?"
From my first post: "Here is a simple alias to find the CID of a particular network." wink
$$n-cid(undernet) finds the CID of a connection to Undernet.
$$n-cid(dalnet) finds the CID of a connection to Undernet.
The '$$' causes the script to halt if there is no connection to $2 to avoid errors

Re: Variables and Networks #79811 20/04/04 10:56 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hurray!! laugh

I did some tests and it is working fine untill now! I havent tried all the commands but it seems like they are working! laugh

I want to thank everybody who helped me here! laugh Thanks a lot!

Regards,
Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
Re: Variables and Networks #79812 28/04/04 12:47 PM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Indeed. I just looked in my remotes for a similar script from something I'd written to answer someone else's question ages ago. That $me $+ solution obviously had to do with more than just the network names ... and I completely missed that they were still in that scriptlet (corrected now). I should have just typed it up again, instead of copy/pasting. crazy


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C