This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

hi guys why wont this work

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

hi guys why wont this work

Post by BhasIRC »

hi.. ok anyways i just dont understand why this code wont work, please will someone help me

Code: Select all

 bind pub - !fact pub:RandomFact


proc RandomFact {nick uhost hand chan args} {
 global factstouse
 set randomfacttouse [lindex $factstouse [rand [llength $factstouse]]]
 puthelp "PRIVMSG $chan :$randomfacttouse"
 return
}

set factstouse { 
 "'Dog kennel' is redundant The Latin 'canis' (dog) served as the base for the word 'canile' (dog house) This word entered French as 'kenel', which the English changed to kennel Thus, a kennel couldn't technically be for anything else but dogs"
 "'E' is the most frequently used letter in the English alphabet, 'Q' the least"
 "'Fine turkey' and 'honeycomb' are terms used for different qualities and textures of sponges"
 "'Flushable' toilets were in use in ancient Rome."
}
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

 bind pub - !fact pub:RandomFact


proc RandomFact {nick uhost hand chan args} { 
you might even spot it yourself ;)
Elen sila lúmenn' omentielvo
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

Post by BhasIRC »

i also tried it as

Code: Select all

bind pub - !fact RandomFact 


proc RandomFact {nick uhost hand chan args} { 
 global factstouse 
 set randomfacttouse [lindex $factstouse [rand [llength $factstouse]]] 
 puthelp "PRIVMSG $chan :$randomfacttouse" 
 return 
} 

set factstouse { 
 "'Dog kennel' is redundant The Latin 'canis' (dog) served as the base for the word 'canile' (dog house) This word entered French as 'kenel', which the English changed to kennel Thus, a kennel couldn't technically be for anything else but dogs" 
 "'E' is the most frequently used letter in the English alphabet, 'Q' the least" 
 "'Fine turkey' and 'honeycomb' are terms used for different qualities and textures of sponges" 
 "'Flushable' toilets were in use in ancient Rome." 
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

I tested the script above and it works fine as is, providing the missing end brace is added to the end of the script (probably just a cut and paste mistake).

Code: Select all

[14:29] <@arfer> !fact
[14:29] <@osmosis> 'E' is the most frequently used letter in the English alphabet, 'Q' the least
As a general rule, you should avoid use of the variable name 'args' in proc definitions unless intended, because it has special meaning.
I must have had nothing to do
B
BhasIRC
Voice
Posts: 27
Joined: Sat Jan 02, 2010 7:05 am
Location: south africa
Contact:

Post by BhasIRC »

thanks alot works 100%
Post Reply