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

	<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-09-10T13:19:49-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Dreamxtreme]]></name></author>
		<updated>2010-09-10T13:19:49-04:00</updated>

		<published>2010-09-10T13:19:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94317#p94317</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94317#p94317"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94317#p94317"><![CDATA[
Ah yes okie dokie then im a idiot <br><br> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11233">Dreamxtreme</a> — Fri Sep 10, 2010 1:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2010-09-10T12:33:36-04:00</updated>

		<published>2010-09-10T12:33:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94316#p94316</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94316#p94316"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94316#p94316"><![CDATA[
Not sure if this is the reason, but you have mixed up your throttled and throttled2 variables.. in proc throttled they should all just be throttled, not throttled2<br><div class="codebox"><p>Code: </p><pre><code>proc throttled {id time} {    global throttled    if {[info exists throttled($id)]} {       set left 0       foreach t [utimers] {          if {[string equal $throttled2($id) [lindex $t 2]]} {             set left [lindex $t 0]             break          }       }       putserv "privmsg #xtreme :You have $left left before next hunting attempt!"       return 1    } {       set throttled($id) [utimer $time [list unset throttled2($id)]]       return 0    } } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Fri Sep 10, 2010 12:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Dreamxtreme]]></name></author>
		<updated>2010-09-10T11:31:17-04:00</updated>

		<published>2010-09-10T11:31:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=94315#p94315</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=94315#p94315"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=94315#p94315"><![CDATA[
Can someone tell why the hunt game isnt telling i have 30mins to wait and how many seconds i have left. It just doesnt display a thing yet the fish one works fine <br><div class="codebox"><p>Code: </p><pre><code>bind pub - !hunt huntbind pub - !fish fishbind pub - !trophy trophybind msg - newmonth newmonthset hunttargets {"bear""gopher""rabbit""hunter""deer""fox""duck""moose""pokemon named Pikachu""park ranger""Yogi Bear""Boo Boo Bear""dog named Benji""cow""raccoon""koala bear""camper""channel lamer"}set fish {"Salmon""Herring""Yellowfin Tuna""Pink Salmon""Chub""Barbel""Perch""Nothern Pike""Brown Trout""Arctic Char""Roach""Brayling""Bleak""Cat Fish""Sun Fish""Old Tire""Rusty Tin Can""Genie Lamp""Love Message In A Bottle""Old Log""Rubber Boot""Dead Body""Loch Ness Monster""Old Fishing Lure""Piece of the Titanic""Chunk of Atlantis""Squid""Whale""Dolphin""Porpise""Stingray""Submarine""Seal""Seahorse""Jellyfish""Starfish""Electric Eel""Great White Shark""Scuba Diver""X""Lag Monster""Virus""Soggy Pack of Smokes""Weed""Boat Anchor""Pair Of Floaties""Mermaid""Merman""Halibut""Used Johhny" "Old Rubber Boot"}set huntplaces {"in some bushes""in a hunting blind""in a hole""up in a tree""in a hiding place""out in the open""in the middle of a field""downtown""on a street corner""at the local mall""in some [censored] up bar"}set fishplaces {"Stream""Lake""River""Pond""Ocean""Bathtub""Kiddie's Swimming Pool""Toilet""Pile of Vomit""Pool of Urine""Kitchen Sink""Bathroom Sink""Mud Puddle""Pail of Water""Bowl of Jell-O (tm)""Wash Basin""Rain Barrel""Aquarium""SnowBank""WaterFall""Cup of Coffee""Glass of Milk"}proc hunt {nick uhost hand chan args} {if {![throttled $uhost:#Xtreme 1800]} { global hunttargets fish fishplaces huntplaces    set huntplace [lindex $huntplaces [rand [llength $huntplaces]]]    set critter [lindex $hunttargets [rand [llength $hunttargets]]]      if ![file exists "hunttrophy"] {       set f [open "hunttrophy" w]       puts $f "Nerfbendr 5 Ant"       close $f      }    set f [open "hunttrophy" r]    gets $f huntrecord    close $f    set maxweight [lindex $huntrecord 1]      set maxweight [expr $maxweight + 100]    set weightnumber [rand $maxweight]    putserv "privmsg $chan :$nick hides $huntplace and wait for something to wander by..."    putserv "privmsg $chan $nick :You think you hear something and fire wildly in that direction..."    if [rand 2] {        putserv "privmsg $chan :Congratulations, $nick! You just bagged yourself a $weightnumber pound $critter!"    } else {        putserv "privmsg $chan :Bollocks! $nick missed the little sod, Better luck next time!"        return 1    }set f [open "hunttrophy" r]gets $f huntrecordclose $fif { $weightnumber &gt; [lindex $huntrecord 1] } {    putserv "privmsg $chan :Wow!!! That's a new record! Way to go, $nick! Type !trophy to see it!"    putserv "privmsg $chan :$nick just bagged a $weightnumber pound $critter and set a new record!"    set f [open "hunttrophy" w]    puts $f "$nick $weightnumber $critter"    close $f    return 1} else {    putserv "privmsg $chan :Sorry $nick...that's not a new record! Good try, though!"    return 1}}              putserv "privmsg #xtreme :Sorry $nick - You need to wait 30 minutes between attempts!"}proc fish {nick uhost hand chan args} {if {![throttled2 $uhost:#xtreme 1200]} { global hunttargets fish fishplaces huntplaces    set fishplace [lindex $fishplaces [rand [llength $fishplaces]]]    set fishtocatch [lindex $fish [rand [llength $fish]]]      if ![file exists "fishtrophy"] {       set f [open "fishtrophy" w]       puts $f "Nerfbendr 5 Guppie"       close $f      }    set f [open "fishtrophy" r]    gets $f fishrecord    close $f    set maxweight [lindex $fishrecord 1]    set maxweight [expr $maxweight + 100]    set weightnumber [rand $maxweight]    putserv "privmsg $chan  :$nick you cast your line into a $fishplace and wait for a bite..."    putserv "privmsg $chan  :$nick feels a tug on the line and reels this bad boy in..."    if [rand 2] {        putserv "privmsg $chan :Congratulations, $nick! just caught yourself a $weightnumber pound $fishtocatch!"    } else {        putserv "privmsg $chan :Bollocks!...the slippery little bugger got away, Better luck next time! $nick"        return 1    }set f [open "fishtrophy" r]gets $f fishrecordclose $fif { $weightnumber &gt; [lindex $fishrecord 1] } {    putserv "privmsg $chan :Wow!!! That's a new record! Way to go, $nick! Type !trophy to see it!"    putserv "privmsg $chan :$nick just caught a $weightnumber pound $fishtocatch and set a new record!"    set f [open "fishtrophy" w]    puts $f "$nick $weightnumber $fishtocatch"    close $f    return 1} else {    putserv "privmsg $chan :Sorry $nick...that's not a new record! Good try, though!"    return 1}}    putserv "privmsg #xtreme :Sorry $nick - You need to wait 20 minutes between attempts!"}proc newmonth {nick uhost hand chan args} {global hunttargets fish fishplaces huntplacesset f [open "fishtrophy" w]puts $f "Nerfbendr 5 Guppie"close $fset f [open "hunttrophy" w]puts $f "Nerfbendr 5 Ant"close $fputserv "privmsg $chan :Online hunting and fishing scores have been reset! Type !cast or !hunt to play!"return 1}proc trophy {nick uhost hand chan args} {global hunttargets fish fishplaces huntplacesif ![file exists "fishtrophy"] {set f [open "fishtrophy" w]puts $f "Nerfbendr 5 Guppie"close $f}if ![file exists "hunttrophy"] {set f [open "hunttrophy" w]puts $f "Nerfbendr 5 Ant"close $f}set f [open "fishtrophy" r]gets $f fishrecordclose $fset f [open "hunttrophy" r]gets $f huntrecordclose $fputserv "privmsg $chan :[lindex $fishrecord 0] holds the fishing record when they caught a [lindex $fishrecord 1] pound [lrange $fishrecord 2 end]!"putserv "privmsg $chan :[lindex $huntrecord 0] holds the hunting record when they bagged a [lindex $huntrecord 1] pound [lrange $huntrecord 2 end]!"return 1}proc throttled {id time} {   global throttled   if {[info exists throttled($id)]} {      set left 0      foreach t [utimers] {         if {[string equal $throttled2($id) [lindex $t 2]]} {            set left [lindex $t 0]            break         }      }      putserv "privmsg #xtreme :You have $left left before next hunting attempt!"      return 1   } {      set throttled($id) [utimer $time [list unset throttled2($id)]]      return 0   }}proc throttled2 {id time} {   global throttled2   if {[info exists throttled2($id)]} {      set left 0      foreach t [utimers] {         if {[string equal $throttled2($id) [lindex $t 2]]} {            set left [lindex $t 0]            break         }      }      putserv "privmsg #xtreme :You have $left left before next fishing attempt!"      return 1   } {      set throttled2($id) [utimer $time [list unset throttled2($id)]]      return 0   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11233">Dreamxtreme</a> — Fri Sep 10, 2010 11:31 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2009-08-08T15:22:40-04:00</updated>

		<published>2009-08-08T15:22:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89793#p89793</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89793#p89793"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89793#p89793"><![CDATA[
Thanks! that worked<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Sat Aug 08, 2009 3:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2009-08-08T13:32:35-04:00</updated>

		<published>2009-08-08T13:32:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89786#p89786</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89786#p89786"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89786#p89786"><![CDATA[
since throttled($id) contains the timer's name, you can use it to get the remaining time of that timer.<div class="codebox"><p>Code: </p><pre><code>proc throttled2 {id time} {   global throttled2   if {[info exists throttled2($id)]} {      set left 0      foreach t [utimers] {         if {[string equal $throttled2($id) [lindex $t 2]]} {            set left [lindex $t 0]            break         }      }      putserv "privmsg #CHANNEL :You have $left left before next fishing attempt!"      return 1   } {      set throttled2($id) [utimer $time [list unset throttled2($id)]]      return 0   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Aug 08, 2009 1:32 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2009-08-08T12:50:50-04:00</updated>

		<published>2009-08-08T12:50:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89778#p89778</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89778#p89778"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89778#p89778"><![CDATA[
ok - so.. i was actually wrong - it doesn't reset the timer each time.. its just that i was posting the wrong variable.. <br><br>How can I output to the channel how much time is left for that one user? $time is total time (which i've set to 20 mins now)..<br><div class="codebox"><p>Code: </p><pre><code>proc throttled2 {id time} {    global throttled2    if {[info exists throttled2($id)]} {      putserv "privmsg #CHANNEL :You have $time left before next fishing attempt!"       return 1    } {       set throttled2($id) [utimer $time [list unset throttled2($id)]]       return 0    } } </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8276">MIODude</a> — Sat Aug 08, 2009 12:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[MIODude]]></name></author>
		<updated>2009-08-08T15:22:58-04:00</updated>

		<published>2009-08-06T19:42:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89764#p89764</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89764#p89764"/>
		<title type="html"><![CDATA[[Solved] Run Command Once an Hour Only]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89764#p89764"><![CDATA[
hi - I'm using a game script.. really fun called FishingAndHunting.  You type !cast or !hunt, and it does the little command.. But - people keep running it over and over until they get the top score.. so I want to limit it to once per hour per nick. <br><br>I have the code that i found searching here.. but, it appears that it resets everytime they run the command.. i'd rather it not reset the counter, and instead tell them how many seconds left.<br><br>Here is the full code with teh changes I made.. I've removed some of the random events to cut down on the code<br><br>I used Throttled and Throttled2 procs so that the timer would be different for each command (!cast and !hunt).  What can i do so that <br><br>1) It doesn't keep resetting the timer <br>2) it tells each person how much time they have left<br>3) Optional: Would be cool if could allow 3 per hour? Then on 4th attempt it locks user out for 1 hour duration<br><br><div class="codebox"><p>Code: </p><pre><code>bind pub - !hunt huntbind pub - !cast fishbind pub - !trophy trophybind msg o newmonth newmonthset hunttargets {"bear"}set fish {"Salmon"}set huntplaces {"in some bushes"}set fishplaces {"Stream"}proc hunt {nick uhost hand chan args} { if {![throttled $uhost:#CHANNEL 3600]} {global hunttargets fish fishplaces huntplacesset huntplace [lindex $huntplaces [rand [llength $huntplaces]]]set critter [lindex $hunttargets [rand [llength $hunttargets]]]      if ![file exists "hunttrophy"] {       set f [open "hunttrophy" w]       puts $f "Nerfbendr 5 Ant"       close $f      }set f [open "hunttrophy" r]gets $f huntrecordclose $fset maxweight [lindex $huntrecord 1]      set maxweight [expr $maxweight + 100]set weightnumber [rand $maxweight]putserv "PRIVMSG #CHANNEL :You hide $huntplace and wait for something to wander by..."putserv "privmsg #CHANNEL :You think you hear something and fire wildly in that direction..."if [rand 2] {putserv "privmsg #CHANNEL :Congratulations, $nick! You just bagged yourself a $weightnumber pound $critter!"} else {putserv "privmsg #CHANNEL :Rats...you missed it, $nick! Better luck next time!"return 1}set f [open "hunttrophy" r]gets $f huntrecordclose $fif { $weightnumber &gt; [lindex $huntrecord 1] } {putserv "privmsg #CHANNEL:Wow!!! That's a new record! Way to go, $nick! Type !trophy to see it!"putserv "privmsg $chan :$nick just bagged a $weightnumber pound $critter and set a new record!"set f [open "hunttrophy" w]puts $f "$nick $weightnumber $critter"close $freturn 1} else {putserv "privmsg #CHANNEL :Sorry $nick...that's not a new record! Good try, though!"return 1}}       putserv "privmsg #CHANNEL :Sorry $nick - You need to wait 60 minutes between attempts!"}proc fish {nick uhost hand chan args} {   if {![throttled2 $uhost:#CHANNEL 3600]} {global hunttargets fish fishplaces huntplacesset fishplace [lindex $fishplaces [rand [llength $fishplaces]]]set fishtocatch [lindex $fish [rand [llength $fish]]]      if ![file exists "fishtrophy"] {       set f [open "fishtrophy" w]       puts $f "Nerfbendr 5 Guppie"       close $f      }set f [open "fishtrophy" r]gets $f fishrecordclose $fset maxweight [lindex $fishrecord 1]set maxweight [expr $maxweight + 100]set weightnumber [rand $maxweight]putserv "PRIVMSG #CHANNEL :You cast your line into a $fishplace and wait for a bite..."putserv "privmsg #CHANNEL :You feel a tug on your line and reel it in..."if [rand 2] {putserv "privmsg #CHANNEL :Congratulations, $nick! You just caught yourself a $weightnumber pound $fishtocatch!"} else {putserv "privmsg #CHANNEL :Rats...it got away, $nick! Better luck next time!"return 1}set f [open "fishtrophy" r]gets $f fishrecordclose $fif { $weightnumber &gt; [lindex $fishrecord 1] } {putserv "privmsg #CHANNEL :Wow!!! That's a new record! Way to go, $nick! Type !trophy to see it!"putserv "privmsg $chan :$nick just caught a $weightnumber pound $fishtocatch and set a new record!"set f [open "fishtrophy" w]puts $f "$nick $weightnumber $fishtocatch"close $freturn 1} else {putserv "privmsg #CHANNEL :Sorry $nick...that's not a new record! Good try, though!"return 1}}       putserv "privmsg #CHANNEL :Sorry $nick - You need to wait 60 minutes between attempts!"}proc newmonth {nick uhost hand chan args} {global hunttargets fish fishplaces huntplacesset f [open "fishtrophy" w]puts $f "Nerfbendr 5 Guppie"close $fset f [open "hunttrophy" w]puts $f "Nerfbendr 5 Ant"close $fputserv "privmsg $chan :Online hunting and fishing scores have been reset! Type !cast or !hunt to play!"return 1}proc trophy {nick uhost hand chan args} {global hunttargets fish fishplaces huntplacesif ![file exists "fishtrophy"] {set f [open "fishtrophy" w]puts $f "Nerfbendr 5 Guppie"close $f}if ![file exists "hunttrophy"] {set f [open "hunttrophy" w]puts $f "Nerfbendr 5 Ant"close $f}set f [open "fishtrophy" r]gets $f fishrecordclose $fset f [open "hunttrophy" r]gets $f huntrecordclose $fputserv "privmsg $chan :[lindex $fishrecord 0] holds the fishing record when they caught a [lindex $fishrecord 1] pound [lrange $fishrecord 2 end]!"putserv "privmsg $chan :[lindex $huntrecord 0] holds the hunting record when they bagged a [lindex $huntrecord 1] pound [lrange $huntrecord 2 end]!"return 1}proc throttled {id time} {   global throttled    if {[info exists throttled($id)]} {       putserv "privmsg #CHANNEL :You have $time left before next hunting attempt!"      return 1    } {       set throttled($id) [utimer $time [list unset throttled($id)]]       return 0    } }proc throttled2 {id time} {   global throttled2   if {[info exists throttled2($id)]} {     putserv "privmsg #CHANNEL :You have $time left before next fishing attempt!"      return 1   } {      set throttled2($id) [utimer $time [list unset throttled2($id)]]      return 0   }}</code></pre></div>Props to Shawn Roles (Nerfbendr) for a great and fun script <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=8276">MIODude</a> — Thu Aug 06, 2009 7:42 pm</p><hr />
]]></content>
	</entry>
	</feed>
