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.
Old posts that have not been replied to for several years.
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 12:12 pm
I need to grab the IP of my bot in TCL so it can refer you to the stats pages its generating... how?
thanks!
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sun Dec 02, 2001 12:48 pm
in the script that dsplays the IP. Make sure the "my-ip" variable is global, and use it's value to refeer users.
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 1:16 pm
yes but the problem is the -...
if i do $[my-ip] it says no such command "my-ip"
without [] its nu such variable: $my
plz help
Petersen
Owner
Posts: 685 Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK
Post
by Petersen » Sun Dec 02, 2001 1:34 pm
${my-ip}
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 1:40 pm
tried that... result was empty... :/
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 1:52 pm
is there another variable what holds the IP perhaps?
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sun Dec 02, 2001 1:54 pm
No, this is the only variable that hold the IP - if this is empty, then you have not setup your bot correctly in the first place.
Read over your config file.
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 2:17 pm
ive set it up correctly for as far i can tell... It does connect to the network, accepts DCCs, all commands work fine...
And it doesnt say anywhere i have to set it myself...
Sorry admin for the new topic
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sun Dec 02, 2001 2:48 pm
Without "my-ip" being set in the config file, there are no simple ways to detect the IP of the machine.
d
doggo18
Post
by doggo18 » Sun Dec 02, 2001 3:09 pm
but how in earth am i gonna find out my IP with a dynamic IP then thru my bot??
Else, give me the hardway... Like a way that extracts the IP from eth0 on connect...
RedAlert
Voice
Posts: 17 Joined: Mon Nov 19, 2001 8:00 pm
Post
by RedAlert » Sun Dec 02, 2001 5:39 pm
This would be *extremely* ugly but if you're running Linux and you KNOW you are gonna use the IP from eth0, you could do something like
Code: Select all
set my-ip [exec /sbin/ifconfig eth0 | grep inet | head -1 | cut -d: -f2 | cut -d -f1]
which would set the IP using ifconfig (note that you could also do the manipulation of the output using TCL). Typically the if-everything-else-fails kind of solution...
G
Guest
Post
by Guest » Mon Dec 03, 2001 4:33 am
The command myip will return your ip.
example: putlog [myip]
Wcc
Master
Posts: 278 Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:
Post
by Wcc » Mon Dec 03, 2001 7:11 am
You can get the IP of your bot with the following code:
Code: Select all
proc getrealip {} {
binary scan [binary format I [myip]] cccc a b c d
return [format %d.%d.%d.%d [expr $a&255] [expr $b&255] [expr $c&255] [expr $d&255]]
}