This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

what is that number, returned by [myip] ?

Help for those learning Tcl or writing their own scripts.
Post Reply
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

what is that number, returned by [myip] ?

Post by willyw »

Hello,

Was fiddling around with something, and in in tcl-commands.doc I found the
myip command.
Tried this, from partyline:
.tcl putserv "privmsg mynick : [myip] "

and the bot promptly sent me a ten digit number.

What is it? some sort of encoding of the bot's true ip number?


Thanks
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

It is the 32bit representation of your IP-address. Given the IP-address aaa.bbb.ccc.ddd, the 'long-IP' would be (2^24)*aaa+(2^16)*bbb+(2^8)*ccc+ddd.
NML_375
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

nml375 wrote:It is the 32bit representation of your IP-address. Given the IP-address aaa.bbb.ccc.ddd, the 'long-IP' would be (2^24)*aaa+(2^16)*bbb+(2^8)*ccc+ddd.
Thanks for explaining.

It is interesting. How would one make use of it though?
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

You may convert it into normal ip useing this proc from fsck function library v1.19 by perpleXa:

Code: Select all

# longip: Converts the long value of an ip to it's dotted quad ip.
proc longtoip {long} {
  format "%u.%u.%u.%u" [expr $long>>24] [expr ($long>>16)&255] [expr ($long>>8)&255] [expr $long&255];
}
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

willyw,
One of the main uses for the 'longip' version with eggdrops are for dcc chat/send requests
NML_375
Post Reply