<?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/13313" />

	<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>2009-05-04T16:13:55-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-04-20T14:02:16-04:00</updated>

		<published>2007-04-20T14:02:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72155#p72155</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72155#p72155"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72155#p72155"><![CDATA[
Checking the manual-page for <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm" class="postlink">string</a> shows there is a function for testing a strings type, "string is &lt;type&gt;", which will, amogn others, allow you to check wether a string is an integer (number) or not.<br>Testing wether a number is greater than another number is trivial. If not, the manpage for <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/if.htm" class="postlink">if</a> should provide enough information to sort that out.<br><br>If you just want someone to write it for you, rather than getting help on how to do it yourself, considder posting under <a href="http://forum.egghelp.org/viewforum.php?f=10" class="postlink">Script Requests</a>.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Apr 20, 2007 2:02 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2007-04-18T16:31:02-04:00</updated>

		<published>2007-04-18T16:31:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72117#p72117</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72117#p72117"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72117#p72117"><![CDATA[
I dont understand that sorry, can you modify the source with my 180 minutes example?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Wed Apr 18, 2007 4:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-04-18T12:29:05-04:00</updated>

		<published>2007-04-18T12:29:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72115#p72115</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72115#p72115"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72115#p72115"><![CDATA[
Validate that the bantime is a number, and then do a simple conditional to test wether it is less than your threshold. If not, set it to the threshold value.<br><br>You might wish to check the <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/string.htm" class="postlink">string</a> command for testing for types. Also, you really should'nt use lindex or lrange on a plain string (arg) like you do, <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/split.htm" class="postlink">split</a> it into a list first...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Apr 18, 2007 12:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2007-04-18T12:12:24-04:00</updated>

		<published>2007-04-18T12:12:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72114#p72114</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72114#p72114"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72114#p72114"><![CDATA[
Nobody can help me? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":-(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Wed Apr 18, 2007 12:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2009-05-04T16:13:55-04:00</updated>

		<published>2007-04-16T18:03:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72099#p72099</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72099#p72099"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72099#p72099"><![CDATA[
deleted<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Mon Apr 16, 2007 6:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2007-04-02T19:58:39-04:00</updated>

		<published>2007-04-02T19:58:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71759#p71759</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71759#p71759"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71759#p71759"><![CDATA[
<a href="http://www.peterre.info/characters.html" class="postlink">How to write eggdrop scripts that won't choke on special characters</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Mon Apr 02, 2007 7:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[r0t3n]]></name></author>
		<updated>2007-04-02T04:34:44-04:00</updated>

		<published>2007-04-02T04:34:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71746#p71746</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71746#p71746"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71746#p71746"><![CDATA[
You can use:<br><div class="codebox"><p>Code: </p><pre><code>string map { "\{" "" } ?var?</code></pre></div>or<div class="codebox"><p>Code: </p><pre><code>string range ?var? 0 end-1</code></pre></div>or maybe even<div class="codebox"><p>Code: </p><pre><code>string trimright ?var? }</code></pre></div>All of those should cancel out the }, the middle one (string range) will always trim 1 off the end of the string, so it might not be the best solution...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6300">r0t3n</a> — Mon Apr 02, 2007 4:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2009-05-04T16:13:36-04:00</updated>

		<published>2007-04-01T16:21:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71737#p71737</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71737#p71737"/>
		<title type="html"><![CDATA[ddf]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71737#p71737"><![CDATA[
dfdf<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Sun Apr 01, 2007 4:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-30T13:40:15-04:00</updated>

		<published>2007-03-30T13:40:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71696#p71696</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71696#p71696"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71696#p71696"><![CDATA[
@Tosser^^:<br>No need to split as mysqlsel is called with the -list (or -flatlist) option. Should already return a proper list<br><br>@Psyfire:<br>If you wish to use the "SELECT .... INTO newtable" construct, you must make sure your query exactly matches the structure of the new table; ie, if newtable has two integer fields, your select must return exactly two integers per result.<br>Ex:<br>newtable has fields: char(64) nick, char(64) ban, timestamp created, int valid<br>oldtable has fields: int id, timestamp creat, char(64) nickname, char(64) banmask<br>As I recall, a proper query would then be:<br>"SELECT (nickname, banmask, creat,1) FROM oldtable WHERE id = 21 INSERT INTO newtable"<br><br>Checking the manual at mysql.com might be a good idea.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Mar 30, 2007 1:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2007-03-30T13:08:20-04:00</updated>

		<published>2007-03-30T13:08:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71695#p71695</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71695#p71695"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71695#p71695"><![CDATA[
It inserted all right, expect from when I add a new ban and want to insert it again with this command he says:<br><br>Tcl error [ban:db:unban]: mysqlsel: handle already closed (dangling pointer)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Fri Mar 30, 2007 1:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[r0t3n]]></name></author>
		<updated>2007-03-30T12:51:32-04:00</updated>

		<published>2007-03-30T12:51:32-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71693#p71693</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71693#p71693"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71693#p71693"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>mysqlsel $sql(handle) "INSERT INTO amx_banhistory(bhid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name,unban_created,unban_reason,unban_admin_nick) VALUES('bhid','0.0.0.0','player_id','player_nick','$host','admin_id','$nick','ban_type','$unban_unban_reason','$unban_ban_time','ban_length','$chan','IRC','$unban_unban_created','$unban_unban_reason','$nick');"               mysqlclose $sql(handle) </code></pre></div>... all i can say here is, your not actually adding anything you selected.<br><br>just because you selected 'player_id' it doesn't mean you can use 'player_id' in the insert. All the select'd data is stored in the 'sma(qry)' variable, and if im correct, your using mysqltcl, and i think you need to use mysqlget/mysqlgetquery &lt;id&gt;, of which you get the id from the sma(qry) variable.<br><br>I also see that you add all the data from the amx_bans history is inserted in the same order into the amx_banhistory db with 3 extra bits of data.<br><br>You can try something like this:<br><br><br><div class="codebox"><p>Code: </p><pre><code>set sma(qry) [mysqlsel $sql(handle) "SELECT bid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name FROM amx_bans WHERE player_id = '$arg' OR bid = '$arg'" -list]if {$sma(qry) == ""} {    putserv "NOTICE $nick :No matches for '$arg'..."    return}mysqlsel $sql(handle) "INSERT INTO amx_banhistory (bid,player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name,unban_created,unban_reason,unban_admin_nick) VALUES('[lindex [split $sma(qry)] 0]' , '[lindex [split $sma(qry)] 1]' , '[lindex [split $sma(qry)] 2]' , '[lindex [split $sma(qry)] 3]' , '[lindex [split $sma(qry)] 4]' , '[lindex [split $sma(qry)] 5]' , '[lindex [split $sma(qry)] 6]' , '[lindex [split $sma(qry)] 7]' , '[lindex [split $sma(qry)] 8]' , '[lindex [split $sma(qry)] 9]' , '[lindex [split $sma(qry)] 10]' , '[lindex [split $sma(qry)] 11]' , '[lindex [split $sma(qry)] 12]' , '$unban_unban_created' , '$unban_unban_reason' , '$nick')"mysqlclose $sql(handle)putserv "NOTICE $nick :Done."   </code></pre></div>That code is not tested, so i can't say if it will work or not, but its a base for you to work on...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6300">r0t3n</a> — Fri Mar 30, 2007 12:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2007-03-30T12:50:46-04:00</updated>

		<published>2007-03-30T12:50:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71692#p71692</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71692#p71692"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71692#p71692"><![CDATA[
Hello,<br><br>I use mysql yes, also I tried what you said, but I cant get it work. Can you please help me with my code, to add your example in it?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Fri Mar 30, 2007 12:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-30T10:59:12-04:00</updated>

		<published>2007-03-30T10:59:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71690#p71690</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71690#p71690"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71690#p71690"><![CDATA[
If you're using mysql, you could use the "SELECT .... INTO newtable" construct.<br><br>As for your second query, it seems you're having alittle trouble keeping track of variable-spaces. That is, you're just inserting the string 'player_id' into the player_id field, rather than the value from the first query.<br>Mysql does support session-variables where you can store and use values/variables directly on the server although this can be abit tricky until you've fully learned the mechanics of it. Other than that, you would have to extract the value from the result of the first query, store it in a tcl-variable, and insert it into your second query-string.<br><br>Ex:<div class="codebox"><p>Code: </p><pre><code>set data [mysqlsel $handle "SELECT (data1) FROM my-db WHERE id = 1" -flatlist]mysqlsel $handle "INSERT INTO my-other-db (foobar, data) VALUES ('foobar', '[lindex $data 0]')" -flatlist]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Mar 30, 2007 10:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Psyfire]]></name></author>
		<updated>2009-05-04T16:12:59-04:00</updated>

		<published>2007-03-29T21:51:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71684#p71684</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71684#p71684"/>
		<title type="html"><![CDATA[deleted]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71684#p71684"><![CDATA[
deleted<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8354">Psyfire</a> — Thu Mar 29, 2007 9:51 pm</p><hr />
]]></content>
	</entry>
	</feed>
