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

	<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>2005-06-25T03:18:47-04:00</updated>

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

		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-06-25T03:18:47-04:00</updated>

		<published>2005-06-25T03:18:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51340#p51340</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51340#p51340"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51340#p51340"><![CDATA[
User once helped me with that problem, its rather simple, the vars wont be evaluated within th {} baces, so remove them:<div class="codebox"><p>Code: </p><pre><code>    switch -- $origin \        $pmain {            set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]        } \        $main {            set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]        } \        $eva {            set matches [http::data [http::geturl "http://xidesign.net/evanextmatch.php"]]        } \        $peva {            set matches [http::data [http::geturl "http://xidesign.net/evanextmatch.php"]]        } \        default {            putserv "NOTICE $nick :Unrecognised channel Please see my admin"        }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Sat Jun 25, 2005 3:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-25T02:44:51-04:00</updated>

		<published>2005-06-25T02:44:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51338#p51338</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51338#p51338"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51338#p51338"><![CDATA[
ahh doh was off the top of my head and wasn't tested but glad you fixed it <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=3723">^DooM^</a> — Sat Jun 25, 2005 2:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[xiphrex]]></name></author>
		<updated>2005-06-24T18:09:50-04:00</updated>

		<published>2005-06-24T18:09:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51329#p51329</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51329#p51329"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51329#p51329"><![CDATA[
Nice one man!<br><br>It doesnt work as you have shown since it doesnt evaluate the variables before running, even when in quotes. So I just changed the variable to an actual channel like #lostsanity without the quotes and it works perfect.<br><br>Good job, thanks to all who helped!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6167">xiphrex</a> — Fri Jun 24, 2005 6:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-24T15:58:30-04:00</updated>

		<published>2005-06-24T15:58:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51321#p51321</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51321#p51321"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51321#p51321"><![CDATA[
ok lets try it this way.<br><div class="codebox"><p>Code: </p><pre><code>set main "#lostsanity"set pmain "#ls-war"set eva "#xippy"set peva "#xippy"bind pub -|- !nextmatch proc:nextmatchpackage require httpproc proc:nextmatch {nick host handle chan content} {global pmain main eva peva    set origin $chan    switch -- $origin {        "$pmain" {            set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]        }        "$main" {            set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]        }        "$eva" {            set matches [http::data [http::geturl "http://xidesign.net/evanextmatch.php"]]        }        "$peva" {            set matches [http::data [http::geturl "http://xidesign.net/evanextmatch.php"]]        }        default {            putserv "NOTICE $nick :Unrecognised channel Please see my admin"        }    }    regsub -all "\n" $matches "" matches    regexp "&lt;NAME&gt;(.*)&lt;/NAME&gt;" $matches match name    regexp "&lt;DESC&gt;(.*)&lt;/DESC&gt;" $matches match desc    regexp "&lt;SERVER&gt;(.*)&lt;/SERVER&gt;" $matches match server    regexp "&lt;TIME&gt;(.*)&lt;/TIME&gt;" $matches match time    regexp "&lt;TYPE&gt;(.*)&lt;/TYPE&gt;" $matches match type    regexp "&lt;URL&gt;(.*)&lt;/URL&gt;" $matches match url    regexp "&lt;STATUS&gt;(.*)&lt;/STATUS&gt;" $matches match status    putserv "NOTICE $nick :\002\00315,1 Nextmatch:\002\0030,1 $name \002"    putserv "NOTICE $nick :\002\00315,1 Time/Date:\002\0030,1 $time \002"    putserv "NOTICE $nick :\002\00315,1 Server:\002\0030,1 $server \002"    putserv "NOTICE $nick :\002\00315,1 Type:\002\0030,1 $type \002"    putserv "NOTICE $nick :\002\00315,1 Details:\002\0030,1 $desc \002"    putserv "NOTICE $nick :\002\00315,1 URL:\002\0030,1 $url \002"    putserv "NOTICE $nick :\002\00315,1 Status:\002\0030,1 $status \002"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Fri Jun 24, 2005 3:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[xiphrex]]></name></author>
		<updated>2005-06-24T15:36:55-04:00</updated>

		<published>2005-06-24T15:36:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51320#p51320</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51320#p51320"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51320#p51320"><![CDATA[
If I remove the foreach loop, Im left with the same code I started off with. I think the foreach idea should work but for some reason its ignoring my if {} inside it and just carrying out the last {} whatever the channel.<br><br>Is there a way to make it detect the channel the command is being issues in, and when it does it sets the match variable according to that channel and then exits the loop and runs the rest of the procedure?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6167">xiphrex</a> — Fri Jun 24, 2005 3:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[De Kus]]></name></author>
		<updated>2005-06-24T14:11:56-04:00</updated>

		<published>2005-06-24T14:11:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51316#p51316</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51316#p51316"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51316#p51316"><![CDATA[
try removing the foreach loop, from what i understand about your purpose its redudant and only overwrites $chan and $matches<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2382">De Kus</a> — Fri Jun 24, 2005 2:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[xiphrex]]></name></author>
		<updated>2005-06-24T14:07:43-04:00</updated>

		<published>2005-06-24T14:07:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51315#p51315</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51315#p51315"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51315#p51315"><![CDATA[
Hi thanks for the reply.<br><br>I tried what you said but it doesnt matter what channel I do the command in, it will just do what it says in the last { }.<br><br>Here is the modified code:<br><div class="codebox"><p>Code: </p><pre><code>set main "#lostsanity"set pmain "#ls-war"set eva "#xippy"set peva "#xippy"bind pub -|- !nextmatch proc:nextmatchpackage require http proc proc:nextmatch {nick host handle chan content} {global pmain main eva pevaforeach chan [channels] {if {$chan == $main || $chan == $pmain} {set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]}if {$chan == $eva || $chan == $peva} {set matches [http::data [http::geturl "http://xidesign.net/evanextmatch.php"]]}}regsub -all "\n" $matches "" matchesregexp "&lt;NAME&gt;(.*)&lt;/NAME&gt;" $matches match nameregexp "&lt;DESC&gt;(.*)&lt;/DESC&gt;" $matches match descregexp "&lt;SERVER&gt;(.*)&lt;/SERVER&gt;" $matches match serverregexp "&lt;TIME&gt;(.*)&lt;/TIME&gt;" $matches match timeregexp "&lt;TYPE&gt;(.*)&lt;/TYPE&gt;" $matches match typeregexp "&lt;URL&gt;(.*)&lt;/URL&gt;" $matches match urlregexp "&lt;STATUS&gt;(.*)&lt;/STATUS&gt;" $matches match statusputserv "NOTICE $nick :\002\00315,1 Nextmatch:\002\0030,1 $name \002"putserv "NOTICE $nick :\002\00315,1 Time/Date:\002\0030,1 $time \002"putserv "NOTICE $nick :\002\00315,1 Server:\002\0030,1 $server \002"putserv "NOTICE $nick :\002\00315,1 Type:\002\0030,1 $type \002"putserv "NOTICE $nick :\002\00315,1 Details:\002\0030,1 $desc \002"putserv "NOTICE $nick :\002\00315,1 URL:\002\0030,1 $url \002"putserv "NOTICE $nick :\002\00315,1 Status:\002\0030,1 $status \002"}</code></pre></div>It will just display the information from "<a href="http://xidesign.net/evanextmatch.php" class="postlink">http://xidesign.net/evanextmatch.php</a>" even though according to that foreach loop it should get the information from "<a href="http://xidesign.net/nextmatch.php" class="postlink">http://xidesign.net/nextmatch.php</a>" in the channels $main and $pmain.<br><br>Any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6167">xiphrex</a> — Fri Jun 24, 2005 2:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-24T03:53:53-04:00</updated>

		<published>2005-06-24T03:53:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51305#p51305</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51305#p51305"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51305#p51305"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>foreach chan [channels] {    if{ $chan = "dynamic1"} { ... do some stuff ... }    if{ $chan = "dynamic2"} { ... do some different stuff ... }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Fri Jun 24, 2005 3:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[xiphrex]]></name></author>
		<updated>2005-06-23T09:05:36-04:00</updated>

		<published>2005-06-23T09:05:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=51281#p51281</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=51281#p51281"/>
		<title type="html"><![CDATA[Dynamic Script help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=51281#p51281"><![CDATA[
Hello,<br><br>I have a made a script that gets information from my website and puts it in an IRC channel when someone says something (like !edrank or !nextmatch).<br><br>However, it only works for one channel or a pair of channels - I want to make the script multi-channel so that it grabs different information from the website according to what channel the user requested it from.<br><br>So for example, the !nextmatch in #channel.a would be different from the !nextmatch in #channel.b. However I dont know how to do this and have tried to read about namespaces but have become more confused. Ideally I want the script to be dynamic so that I would only need to set a couple new variables mentioning the channel and url to the webpage that the info need to be grabbed from for that channel.<br><br>Here is the script that works atm, but when I load a replica of this script with changed variables, the one that has been loaded last overwrites the previous script so only one script works.<br><div class="codebox"><p>Code: </p><pre><code>#### Lost Sanity Clan bot script by xiphrex ##set main "#lostsanity"set pchan "#ls-war"set vent "212.42.13.171"set ventport "9807"set ventpass "password"set ladderid "35"set clanid "18931"set division "CSS: Premier"bind pub -|- !nextmatch proc:nextmatchbind pub -|- !displaymatch proc:displaymatchbind pub -|- !lastresult proc:lastresultbind pub -|- !vent proc:ventbind pub -|- !edrank proc:edrankpackage require http proc proc:nextmatch {nick host handle chan content} {global pchan mainif {$chan == $main || $chan == $pchan} {set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]regsub -all "\n" $matches "" matchesregexp "&lt;NAME&gt;(.*)&lt;/NAME&gt;" $matches match nameregexp "&lt;DESC&gt;(.*)&lt;/DESC&gt;" $matches match descregexp "&lt;SERVER&gt;(.*)&lt;/SERVER&gt;" $matches match serverregexp "&lt;TIME&gt;(.*)&lt;/TIME&gt;" $matches match timeregexp "&lt;TYPE&gt;(.*)&lt;/TYPE&gt;" $matches match typeregexp "&lt;URL&gt;(.*)&lt;/URL&gt;" $matches match urlregexp "&lt;STATUS&gt;(.*)&lt;/STATUS&gt;" $matches match statusputserv "NOTICE $nick :\002\00315,1 Nextmatch:\002\0030,1 $name \002"putserv "NOTICE $nick :\002\00315,1 Time/Date:\002\0030,1 $time \002"putserv "NOTICE $nick :\002\00315,1 Server:\002\0030,1 $server \002"putserv "NOTICE $nick :\002\00315,1 Type:\002\0030,1 $type \002"putserv "NOTICE $nick :\002\00315,1 Details:\002\0030,1 $desc \002"putserv "NOTICE $nick :\002\00315,1 URL:\002\0030,1 $url \002"putserv "NOTICE $nick :\002\00315,1 Status:\002\0030,1 $status \002"}}proc proc:displaymatch {nick host handle chan content} {global pchan mainif {![isop $nick $chan]} {puthelp "NOTICE $nick : You are not allowed to view this content!"} else {if {$chan == $main || $chan == $pchan} {set matches [http::data [http::geturl "http://xidesign.net/nextmatch.php"]]regsub -all "\n" $matches "" matchesregexp "&lt;NAME&gt;(.*)&lt;/NAME&gt;" $matches match nameregexp "&lt;DESC&gt;(.*)&lt;/DESC&gt;" $matches match descregexp "&lt;SERVER&gt;(.*)&lt;/SERVER&gt;" $matches match serverregexp "&lt;TIME&gt;(.*)&lt;/TIME&gt;" $matches match timeregexp "&lt;TYPE&gt;(.*)&lt;/TYPE&gt;" $matches match typeregexp "&lt;URL&gt;(.*)&lt;/URL&gt;" $matches match urlregexp "&lt;STATUS&gt;(.*)&lt;/STATUS&gt;" $matches match statusputserv "PRIVMSG $pchan :\002\00315,1 Nextmatch:\002\0030,1 $name \002"putserv "PRIVMSG $pchan :\002\00315,1 Time/Date:\002\0030,1 $time \002"putserv "PRIVMSG $pchan :\002\00315,1 Server:\002\0030,1 $server \002"putserv "PRIVMSG $pchan :\002\00315,1 Type:\002\0030,1 $type \002"putserv "PRIVMSG $pchan :\002\00315,1 Details:\002\0030,1 $desc \002"putserv "PRIVMSG $pchan :\002\00315,1 URL:\002\0030,1 $url \002"putserv "PRIVMSG $pchan :\002\00315,1 Status:\002\0030,1 $status \002"}}}proc proc:lastresult {nick host handle chan content} {global pchan mainif {$chan == $main || $chan == $pchan} {set matches [http::data [http::geturl "http://clan-a.iqcss.co.uk/r_last_match.php"]]regsub -all "\n" $matches "" matchesregexp "&lt;DESC&gt;(.*)&lt;/DESC&gt;" $matches match descregexp "&lt;RESULT&gt;(.*)&lt;/RESULT&gt;" $matches match resultregexp "&lt;TIME&gt;(.*)&lt;/TIME&gt;" $matches match timeregexp "&lt;TYPE&gt;(.*)&lt;/TYPE&gt;" $matches match typeregexp "&lt;TEAM&gt;(.*)&lt;/TEAM&gt;" $matches match teamregexp "&lt;MAP&gt;(.*)&lt;/MAP&gt;" $matches match mapputserv "PRIVMSG $chan :\002\00315,1 Last Match:\002\0030,1 $desc \002"putserv "PRIVMSG $chan :\002\00315,1 Result:\002\0030,1 $result \002"putserv "PRIVMSG $chan :\002\00315,1 Time/Date:\002\0030,1 $time \002"putserv "PRIVMSG $chan :\002\00315,1 Type:\002\0030,1 $type \002"putserv "PRIVMSG $chan :\002\00315,1 Team:\002\0030,1 $team \002"putserv "PRIVMSG $chan :\002\00315,1 Map:\002\0030,1 $map \002"}}proc proc:vent {nick host handle chan content} {global vent ventport ventpass main pchanif {![isop $nick $chan]} {puthelp "NOTICE $nick : You are not allowed to view this content!"} else {if {$chan == $main} {putserv "NOTICE $nick :\00315,1 Do !vent in #ls-war \002"} else {if {$chan == $pchan} {putserv "PRIVMSG $pchan :\002\00315,1 Vent IP:\002\0030,1 $vent \002\00315,1 Port:\002\0030,1 $ventport \002\00315,1 Password:\002\0030,1 $ventpass \002"}}}}proc proc:edrank {nick host handle chan content} {global ladderid clanid division main pchanset content [http::data [http::geturl "http://www.enemydown.co.uk/ed_clanrank.php?ladder=$ladderid&amp;clan=$clanid"]] if {[regexp "&lt;b&gt;(.*)&lt;/b&gt;" $content match rank] } { regsub -all {&lt;.+?&gt;} $match {} matchif {$chan == $main || $chan == $pchan} {puthelp "PRIVMSG $chan :\002\00315,1 Enemy Down \0037,1::\002\00315,1 $division Ladder \002\0037,1::\002\00315,1 Rank:\002\0030,1 $match \002" }} }putlog "lostsanity.tcl v1.5 has been successfully loaded. EDrank by Stoo"</code></pre></div>I would like to know how to go about making this script dynamic. All help is appreciated, thank you.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6167">xiphrex</a> — Thu Jun 23, 2005 9:05 am</p><hr />
]]></content>
	</entry>
	</feed>
