<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17938" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-08-19T03:11:38-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17938</id>

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2010-08-19T03:11:38-04:00</updated>

		<published>2010-08-19T03:11:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93984#p93984</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93984#p93984"/>
		<title type="html"><![CDATA[country codes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93984#p93984"><![CDATA[
what a horrible way to store and search that data, .. why not just use array names for the country code and attach country name as data.<div class="codebox"><p>Code: </p><pre><code>array set list {  BE Belgium FR France ..}foreach {x} [array names list] {  if {[string equal -nocase $x "be"]} {    puts $list($x)  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Thu Aug 19, 2010 3:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Torrevado]]></name></author>
		<updated>2010-08-18T14:45:14-04:00</updated>

		<published>2010-08-18T14:45:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93981#p93981</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93981#p93981"/>
		<title type="html"><![CDATA[country codes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93981#p93981"><![CDATA[
@willyw<br><br>Thank you very much <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8047">Torrevado</a> — Wed Aug 18, 2010 2:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2010-08-18T13:38:50-04:00</updated>

		<published>2010-08-18T13:38:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93979#p93979</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93979#p93979"/>
		<title type="html"><![CDATA[Re: country codes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93979#p93979"><![CDATA[
<blockquote class="uncited"><div>...<br><br>I noticed 2 problems: <br><br>1- It is case-sensitive (if I set up "Canada" it won't find it for a request: !country canada).</div></blockquote>Change:<br>lsearch exact <br>to:<br>lsearch -nocase<br><br><blockquote class="uncited"><div>I guess this could be solved setting countries uppercased and using [string toupper $arg] but I really don't like displaying countries this way.<br><br>2- It won't find countries longer than 1 word.<br></div></blockquote>Remove:<br>|| [llength $arg] &gt; 1<br><br><div class="codebox"><p>Code: </p><pre><code>set ccver "v1.2"# country code script 1.2 for eggdrop v1.3# edited by toot &lt;toot@melnet.co.uk&gt;# tested on eggdrop v1.3.28+# i got the original code from entertain.tcl which probably ripped# it from somewhere else before ;)bind pub - !country pub_countryproc pub_country {nick uhost hand channel arg} {  global country symbol botnick  if {$arg == ""} {    putserv "NOTICE $nick :Correct usage: !country &lt;node&gt;"    putserv "NOTICE $nick :      Example: !country .[lindex $symbol [rand [llength $country]]]"    return 0  }  set this [lsearch -exact $symbol [string trimleft [string toupper $arg] .]]  if {$this &gt; -1} {    putserv "PRIVMSG $channel :Country name for .[string trimleft [string toupper $arg] .] is [lindex $country $this]"    return 1  } else { set this [lsearch -nocase $country [string trimleft $arg]]  if {$this &gt; -1} {    putserv "PRIVMSG $channel :Code name for [string trimleft $arg] is [lindex $symbol $this]"    return 1  }}}set country { "South Georgia and the South Sandwich Islands" "Ascension Island""Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua And Barbuda" "Argentina" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "Brunei Darussalam""Bulgaria" "Burkina Faso" "Burundi" "Byelorussian SSR" "Cambodia" "Cameroon" "Canada" "Cap Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos (Keeling) Islands" "Colombia" "Comoros" "Congo" "Cook Islands" "Costa Rica" "Cote D'ivoire" "Croatia" "Hrvatska" "Cuba" "Cyprus" "Czechoslovakia" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "East Timor" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Estonia" "Ethiopia" "Falkland Islands" "Malvinas" "Faroe Islands" "Fiji" "Finland" "France" "French Guiana" "French Polynesia" "French Southern Territories" "Gabon" "Gambia" "Georgia" "Germany" "Deutschland" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guinea" "Guinea Bissau" "Gyana" "Haiti" "Heard And Mc Donald Islands" "Honduras" "Hong Kong" "Hungary" "Iceland" "India" "Indonesia" "Iran" "Iraq" "Ireland" "Israel" "Italy" "Jamaica" "Japan" "Jordan" "Kazakhstan" "Kenya" "Kiribati" "North Korea" "South Korea" "Kuwait" "Kyrgyzstan" "Laos" "Latvia" "Lebanon" "Lesotho" "Liberia" "Libyan Arab Jamahiriya" "Liechtenstein" "Lithuania" "Luxembourg" "Macau" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mexico" "Micronesia" "Moldova" "Monaco" "Mongolia" "Montserrat" "Morocco" "Mozambique" "Myanmar" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "Neutral Zone" "New Caledonia" "New Zealand" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn" "Poland" "Portugal" "Puerto Rico" "Qatar" "Reunion" "Romania" "Russian Federation" "Rwanda" "Saint Kitts And Nevis" "Saint Lucia" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "Sao Tome And Principe" "Saudi Arabia" "Senegal" "Seychelles" "Sierra Leone" "Singapore" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "Spain" "Sri Lanka" "St. Helena" "St. Pierre and Miquelon" "Sudan" "Suriname" "Svalbard And Jan Mayen Islands" "Swaziland" "Sweden" "Switzerland" "Cantons Of Helvetia" "Syrian Arab Republic" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "Uganda""Ukrainian SSR" "United Arab Emirates" "United Kingdom" "Great Britain" "United States of America" "United States Minor Outlying Islands" "Uruguay" "Soviet Union" "Uzbekistan" "Vanuatu" "Vatican City State" "Venezuela" "Viet Nam" "Virgin Islands (US)" "Virgin Islands (UK)" "Wallis and Futuna Islands" "Western Sahara" "Yemen" "Yugoslavia" "Zaire" "Zambia" "Zimbabwe" "Commercial Organisation (US)" "Educational Institution (Us)" "Networking Organisation (US)" "Military (US)" "Non-Profit Organisation (Us)" "Government (Us)" "Korea - Democratic People's Republic Of" "Korea - Republic Of" "Lao Peoples' Democratic Republic" "Russia" "Slovakia" "Czech"}set symbol { GS AC AF AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BA BW BV BR IO BN BG BF BI BY KH CM CA CV KY CF TD CL CN CX CC CO KM CG CK CR CI HR HR CU CY CS DK DJ DM DO TP EC EG SV GQ EE ET FK FK FO FJ FI FR GF PF TF GA GM GE DE DE GH GI GR GL GD GP GU GT GN GW GY HT HM HN HK HU IS IN ID IR IQ IE IL IT JM JP JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU MX FM MD MC MN MS MA MZ MM NA NR NP NL AN NT NC NZ NI NE NG NU NF MP NO OM PK PW PA PG PY PE PH PN PL PT PR QA RE RO RU RW KN LC VC WS SM ST SA SN SC SL SG SI SB SO ZA ES LK SH PM SD SR SJ SZ SE CH CH SY TW TJ TZ TH TG TK TO TT TN TR TM TC TV UG UA AE UK GB US UM UY SU UZ VU VA VE VN VI VG WF EH YE YU ZR ZM ZW COM EDU NET MIL ORG GOV KP KR LA SU SK CZ}putlog "\002country codes\002 $ccver edited by toot, loaded!@"</code></pre></div>Try that, and see if it does what you want now.<br><br>With a couple quick tests, it worked for me. <br><br>Purposely, I've tried to only address the questions you posed....making only minimal changes,  to try to alleviate confusion.   <br><br><br>There are other things that I question, and would likely experiment with changing, in this script.<br>Example:<br> [lsearch -nocase $country [string trimleft $arg]]<br>lsearch takes a list, but $country looks like a big ol' string to me.   <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>As often happens, it seems to work, as-is.   But were it me, that's the type of thing I'd have to experiment with to get it more proper....   or...  ask a TCL guru around here if it should even be worth worrying about.<br><br><br>I hope this has helped.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Wed Aug 18, 2010 1:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Torrevado]]></name></author>
		<updated>2010-08-18T07:46:55-04:00</updated>

		<published>2010-08-18T07:46:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93975#p93975</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93975#p93975"/>
		<title type="html"><![CDATA[country codes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93975#p93975"><![CDATA[
Hello,<br><br>I'm trying to modify this old country code script. It just find a country name for a given country code:<blockquote class="uncited"><div>!country US<br>&lt;bot&gt; result: code US is from United States</div></blockquote>I'd like it to find *also* a country code for a country name:<blockquote class="uncited"><div>!country United States<br>&lt;bot&gt; result: United States code is US</div></blockquote>I noticed 2 problems: <br><br>1- It is case-sensitive (if I set up "Canada" it won't find it for a request: !country canada).<br>I guess this could be solved setting countries uppercased and using [string toupper $arg] but I really don't like displaying countries this way.<br><br>2- It won't find countries longer than 1 word.<br><br> <div class="codebox"><p>Code: </p><pre><code>set ccver "v1.2"# country code script 1.2 for eggdrop v1.3# edited by toot &lt;toot@melnet.co.uk&gt;# tested on eggdrop v1.3.28+# i got the original code from entertain.tcl which probably ripped# it from somewhere else before ;)bind pub - !country pub_countryproc pub_country {nick uhost hand channel arg} {  global country symbol botnick   if {$arg == "" || [llength $arg] &gt; 1} {    putserv "NOTICE $nick :Correct usage: !country &lt;node&gt;"    putserv "NOTICE $nick :      Example: !country .[lindex $symbol [rand [llength $country]]]"    return 0  }  set this [lsearch -exact $symbol [string trimleft [string toupper $arg] .]]  if {$this &gt; -1} {    putserv "PRIVMSG $channel :Country name for .[string trimleft [string toupper $arg] .] is [lindex $country $this]"    return 1  } else {  set this [lsearch -exact $country [string trimleft $arg]]  if {$this &gt; -1} {    putserv "PRIVMSG $channel :Code name for [string trimleft $arg] is [lindex $symbol $this]"    return 1  }}}set country { "South Georgia and the South Sandwich Islands" "Ascension Island""Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua And Barbuda" "Argentina" "Armenia" "Aruba" "Australia" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "Brunei Darussalam""Bulgaria" "Burkina Faso" "Burundi" "Byelorussian SSR" "Cambodia" "Cameroon" "Canada" "Cap Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos (Keeling) Islands" "Colombia" "Comoros" "Congo" "Cook Islands" "Costa Rica" "Cote D'ivoire" "Croatia" "Hrvatska" "Cuba" "Cyprus" "Czechoslovakia" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "East Timor" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Estonia" "Ethiopia" "Falkland Islands" "Malvinas" "Faroe Islands" "Fiji" "Finland" "France" "French Guiana" "French Polynesia" "French Southern Territories" "Gabon" "Gambia" "Georgia" "Germany" "Deutschland" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guinea" "Guinea Bissau" "Gyana" "Haiti" "Heard And Mc Donald Islands" "Honduras" "Hong Kong" "Hungary" "Iceland" "India" "Indonesia" "Iran" "Iraq" "Ireland" "Israel" "Italy" "Jamaica" "Japan" "Jordan" "Kazakhstan" "Kenya" "Kiribati" "North Korea" "South Korea" "Kuwait" "Kyrgyzstan" "Laos" "Latvia" "Lebanon" "Lesotho" "Liberia" "Libyan Arab Jamahiriya" "Liechtenstein" "Lithuania" "Luxembourg" "Macau" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mexico" "Micronesia" "Moldova" "Monaco" "Mongolia" "Montserrat" "Morocco" "Mozambique" "Myanmar" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "Neutral Zone" "New Caledonia" "New Zealand" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn" "Poland" "Portugal" "Puerto Rico" "Qatar" "Reunion" "Romania" "Russian Federation" "Rwanda" "Saint Kitts And Nevis" "Saint Lucia" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "Sao Tome And Principe" "Saudi Arabia" "Senegal" "Seychelles" "Sierra Leone" "Singapore" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "Spain" "Sri Lanka" "St. Helena" "St. Pierre and Miquelon" "Sudan" "Suriname" "Svalbard And Jan Mayen Islands" "Swaziland" "Sweden" "Switzerland" "Cantons Of Helvetia" "Syrian Arab Republic" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "Uganda""Ukrainian SSR" "United Arab Emirates" "United Kingdom" "Great Britain" "United States of America" "United States Minor Outlying Islands" "Uruguay" "Soviet Union" "Uzbekistan" "Vanuatu" "Vatican City State" "Venezuela" "Viet Nam" "Virgin Islands (US)" "Virgin Islands (UK)" "Wallis and Futuna Islands" "Western Sahara" "Yemen" "Yugoslavia" "Zaire" "Zambia" "Zimbabwe" "Commercial Organisation (US)" "Educational Institution (Us)" "Networking Organisation (US)" "Military (US)" "Non-Profit Organisation (Us)" "Government (Us)" "Korea - Democratic People's Republic Of" "Korea - Republic Of" "Lao Peoples' Democratic Republic" "Russia" "Slovakia" "Czech"}set symbol { GS AC AF AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BA BW BV BR IO BN BG BF BI BY KH CM CA CV KY CF TD CL CN CX CC CO KM CG CK CR CI HR HR CU CY CS DK DJ DM DO TP EC EG SV GQ EE ET FK FK FO FJ FI FR GF PF TF GA GM GE DE DE GH GI GR GL GD GP GU GT GN GW GY HT HM HN HK HU IS IN ID IR IQ IE IL IT JM JP JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU MX FM MD MC MN MS MA MZ MM NA NR NP NL AN NT NC NZ NI NE NG NU NF MP NO OM PK PW PA PG PY PE PH PN PL PT PR QA RE RO RU RW KN LC VC WS SM ST SA SN SC SL SG SI SB SO ZA ES LK SH PM SD SR SJ SZ SE CH CH SY TW TJ TZ TH TG TK TO TT TN TR TM TC TV UG UA AE UK GB US UM UY SU UZ VU VA VE VN VI VG WF EH YE YU ZR ZM ZW COM EDU NET MIL ORG GOV KP KR LA SU SK CZ}putlog "\002country codes\002 $ccver edited by toot, loaded!@"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8047">Torrevado</a> — Wed Aug 18, 2010 7:46 am</p><hr />
]]></content>
	</entry>
	</feed>
