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

	<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>2002-09-22T11:07:42-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-22T11:07:42-04:00</updated>

		<published>2002-09-22T11:07:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=11244#p11244</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=11244#p11244"/>
		<title type="html"><![CDATA[Checking leftmost character of a list...  Newbie...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=11244#p11244"><![CDATA[
I am guessing the above solution, is based ont he fact that he is using a DB produced by himself, or a program he has created.<br><br>Most DB's are beyond the users control, and as such, if-elseif-else is the only solution.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Sun Sep 22, 2002 11:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[darko``]]></name></author>
		<updated>2002-09-20T12:37:27-04:00</updated>

		<published>2002-09-20T12:37:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=11184#p11184</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=11184#p11184"/>
		<title type="html"><![CDATA[Checking leftmost character of a list...  Newbie...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=11184#p11184"><![CDATA[
There is a neat solution for your problem:<br><br>.set blah 4<br>.putlog "Gimme \003${blah}colors!"<br><br>Try that, and you will get a coloured output based on the value of $blah.<br><br>Now, knowing that, it is obvious that you can avoid all those nasty if, else, elseif.<br><br>All you need to do is set some variable to the value of the first char and use it in the way i've shown. Of course, you will have to pay attention how you create database, so the first char will actually match the mirc color codes. That can be avoided too, but would involve creating tables and/or lists.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1881">darko``</a> — Fri Sep 20, 2002 12:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-20T04:36:14-04:00</updated>

		<published>2002-09-20T04:36:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=11157#p11157</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=11157#p11157"/>
		<title type="html"><![CDATA[Checking leftmost character of a list...  Newbie...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=11157#p11157"><![CDATA[
Try "string index" for one.<br><br>Note your syntax of the if statment is wrong.<br><br>If uses the format<br><blockquote class="uncited"><div>if {MatchExpr1} {<br>  Body1<br>} elseif {MatchExpr2} {<br>  Body2<br>} else {<br>  Body3<br>}</div></blockquote>There can be as many elseif statments within the if stament as you wish, however, if will only trigger/call the Body, of the first matching statment. Thus, you can't have more than 1 possitive match per IF.<br><br>All you matching must take place, within the MatchExpr part of the command.<br><br>If works, by evaluating staments. For if to work, it must evaluate to TRUE (any value above or below 0). It will not work, if evaluated to FALSE (any 0 value).<br><br>You reverse a value, so that TRUE becomes FALSE, and FALSE becomes TRUE, using the negate character !.<br><br>IE.<br>[string match "*d*" "hello"] == FALSE<br>![string match "*d*" "hello"] == TRUE<br><br>This first one can be spoken, <blockquote class="uncited"><div>Run if "hello" has a "d" in it.</div></blockquote>The second,<blockquote class="uncited"><div>Run if "hello" doesn't have a "d" in it.</div></blockquote>In your IF stament, your MatchExpr was running partaily outside the MatchExpr brackets.<br><br>It is as simple as moving a } past the ==0 and ==1<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Fri Sep 20, 2002 4:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-09-20T00:21:27-04:00</updated>

		<published>2002-09-20T00:21:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=11150#p11150</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=11150#p11150"/>
		<title type="html"><![CDATA[Checking leftmost character of a list...  Newbie...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=11150#p11150"><![CDATA[
Once again, I find myself stuck.  And I am quite positive that for the TCL gurus floating around here that this will be quite easy...<br><br>Basically I want to evaluate a line from a list as I am outputting it...<br><br>Lines in the list will be something like:<br><br>0 15 (123ms) JohnnyRotten<br>1 24 (73ms) TomThumb<br><br>I want to look at the first character (either the 0 or 1) and then assign a color based on the number...  Red for 0, Blue for 1...  As I am pushing it via a putquick privmsg statement...<br><br>I know that the answer is probably quite obvious, and I have looked at the TCL docs...  But I just can't get it figgered out...  <br><br>I am guessing that it will be something like:<br><div class="codebox"><p>Code: </p><pre><code>foreach output_line $output_list {  if {[string range $output_line 0 0]}==0{    putquick "PRIVMSG $nick : \00304,99 $output_line"  } elseif {[string range $output_line 0 0]}==1{    putquick "PRIVMSG $nick : \00302,99 $output_line"  } else {    putquick "PRIVMSG $nick : \00301,99 $output_line"  }}</code></pre></div>Am I on the right track?<p>Statistics: Posted by Guest — Fri Sep 20, 2002 12:21 am</p><hr />
]]></content>
	</entry>
	</feed>
