egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ı can't runnig Wordgame.tcl
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Sat Jul 23, 2005 10:55 am    Post subject: ı can't runnig Wordgame.tcl Reply with quote

ı can't runnig this code !!!
Code:
#Change the f|f if you want.

bind pub f|f !score the_score
bind pub f|f !word pub_word
bind time - "05 03 % % %" wo_refresh_time
bind msg m !wordswitch word_onoff
bind msg m !wordanswer answer_onoff

## VARIABLES, set these.

# This is the file that holds the wordlist, set it to whatever
set wlistfile /home/egg/kinks/scripts/wordlist.txt

# This file keeps scores again call it whatever
set wscorefile /home/egg/kinks/scripts/wscore

# This special user is added to the bots userlist and used to track
# where each chan is in the wordlist
set specuser specialwd

# Say the answer if no one gets it
# 0 is don't say it / 1 is say it
set ansonoff 0

## ----------------Leave the rest alone----------------------------------

# This variable tells whether the script is being run.  It will only allow
# the game to be played in one channel at a time, otherwise too many timers
# too much confusion.
# Occasionally, the script may become confused during desynchs and says its
# running when it isn't. You must reset this variable to 0. Don't worry
# it doesnt happen often.  Obviously leave it set to 0 here
set winuse 0

# This variable is the place in the wordlist.  Its initialized to 0 don't
# mess with it.  I tried randomizing this, but found this worked better,
# but its not hard to randomize if you like that better.
set word_list_count 0

# On off switch for the annoying people
# 0 is off/ 1 is on
set glonoff 1

# Global channel variable, initialized to null, leave alone
set chan ""

# Initializes global wordlist to null, leave it alone
set words ""

# ----------CODE--------------------------------------------------------

# Procedure to turn on/off whether the answer is given if no one
# gets it.
proc answer_onoff {nick uhost handle args} {
  global ansonoff botnick
  set onoff [string tolower [ string trim [lindex [split $args] 0] "{}" ]]
  if {$onoff == "on"} {
    set ansonoff 1
   putserv "NOTICE $nick :Wordgame will now tell you losers the answers ;-P"
   return
   }
  if {$onoff == "off"} {
   set ansonoff 0
   putserv "NOTICE $nick :Wordgame will no longer tell you losers the answers"
   return
   }
   putserv "NOTICE $nick :USAGE: /msg $botnick !wordanswer on\/off"
   return
}

# Had to add an on off switch cause some pple started annoying me
proc word_onoff {nick uhost handle args} {
  global botnick glonoff
  set onoff [string tolower [ string trim [lindex [split $args] 0] "{}" ]]
  if {$onoff == "on"} {
    set glonoff 1
   putserv "NOTICE $nick :Wordgame is turned on"
   return
   }
  if {$onoff == "off"} {
   set glonoff 0
   putserv "NOTICE $nick :Wordgame is turned off"
   return
   }
   putserv "NOTICE $nick :USAGE: /msg $botnick !wordswitch on\/off"
   return
}

# This is the main proc, it spews the word and sets the timers to do the
# rest.

proc pub_word {nick uhost handle channel args} {
   global wscorefile wlistfile words word_list_count answer winuse \
chan letone lettwo letters specuser glonoff
   if {$glonoff == 0} {
   putserv "PRIVMSG $channel :Sorry, wordgame is turned off, try again later"
   return
   }
   set chn [string tolower $channel]
   if {$word_list_count == 0} {
       if {![validuser $specuser]} {
          set channels [channels]
          adduser $specuser specuser!special@word.special.org
          foreach chann $channels {
             setuser $specuser XTRA wcount.$chann 0
          }
       }
       set word_list_count [getuser $specuser XTRA wcount.$chn]
       set words ""   
       set fd [open $wlistfile r]
       while {![eof $fd]} {
          lappend words [gets $fd]
       }
       close $fd
   }
   if {($winuse == 1) && ([string compare $chn $chan] != 0)} {
      putserv "PRIVMSG $chn :Sorry, they're already playing in $chan, go join in. I'll tell em your coming, $nick."
   return 0
   } elseif {($winuse == 1) && ([string compare $chn $chan] == 0)} {
        putserv "PRIVMSG $chan :HEY! One word at a time!"
     return 0
   } elseif {$winuse == 0} {
      set chan $chn
      set winuse 1
      set word_pair [lindex $words $word_list_count]
      set answer [lindex [split $word_pair :] 1]
      set word_split [split $word_pair :]
      set letters [lreplace $word_split 1 1]
      set let_split [split $letters {}]
      set letone [lindex $let_split 0]
      set slettwo $letone
      set slettwo [join [lappend slettwo [lindex $let_split 1]]]
      regsub { } $slettwo {} lettwo
      set i [llength $let_split]
      set smixed ""
      set tmixed ""
      for {set j 0} {$j < $i} {incr j} {
        set k [rand [llength $let_split]]
        set smixed $tmixed
        set smixed [lappend smixed [lindex $let_split $k]]
        set let_split [lreplace $let_split $k $k]
        regsub { } $smixed {} tmixed
      }
      set mixed $tmixed
      bind pub - $letters pub_gotit
      putserv "PRIVMSG $chan :Unscramble ---> \0036 $mixed "
      incr word_list_count
      if {$word_list_count >= [expr [llength $words] -1]} {
         set word_list_count "0"
      }
      setuser $specuser XTRA wcount.$chn $word_list_count
      utimer 60 noone_gotit
      utimer 15 clue_1
      utimer 30 clue_2
      utimer 45 clue_3
   }
}

# All the timers expired and no one got it. Spew to chan.

proc noone_gotit {} {
   global winuse chan letters ansonoff
   if {$ansonoff} {
     putserv "PRIVMSG $chan :Nobody got it...it\'s \0034$letters"
   } else {
     putserv "PRIVMSG $chan :Nobody got it...\0034losers!"
   }
   unbind pub - $letters pub_gotit
   set winuse 0
   set chan ""
}

# List of things to say when a validuser wins

set winsay {
"must be a fluke"
"you rule!!"
"how's that VD comin along?"
"can I be your friend?"
"you're such a badass!"
"must have gotten all the easy ones!"
"but you still suck!"
"you must be on \0034fire!!"
"cheater!"
}

# Somebody won, spew to chan and update score file. Scores are kept for both
# daily and cumulative.  Once anyone hits 500 all scores are reset.

proc pub_gotit {nick uhost handle channel args} {
   global wscorefile words letters answer  winuse chan winsay
   putserv "PRIVMSG $chan :Woohoo $nick!! You got it...\0034$letters"
   kill_timers   
   unbind pub - $letters pub_gotit
   if {![validuser $handle]} {
     set winuse 0
     set chan ""
     return 0
   }
   if {![file exists $wscorefile]} {
   set fd [open $wscorefile w]
   close $fd
   }
   set fd [open $wscorefile r]
   set j 0
   while {![eof $fd]} {
     lappend score [gets $fd]
     set j [incr j]
   }
   set i [expr $j - 1]
   set score [lreplace $score $i $i]
   close $fd
   for {set k 0} {$k < $i} {incr k 3} {
     set scnick [lindex $score $k]
     if {$handle == $scnick} {
        set newd [expr [lindex $score [expr $k + 1]] + 1]
        set newf [expr [lindex $score [expr $k + 2]] + 1]
        set score [lreplace $score [expr $k + 1] [expr $k + 2] $newd $newf]
        set dscore [lindex $score [expr $k + 1]]
        set rand_say [lindex $winsay [rand [llength $winsay]]]
        putserv "PRIVMSG  $chan :$nick you've won $dscore times today, $rand_say"
        if {$newf == 500} {
          putserv "PRIVMSG $chan :OH MY GAWD!! $scnick just scored 500 since time began!"
          set score [lreplace $score 1 2 0 0]
          for {set k 1} {$k < $i} {incr k 2} {
            set score [lreplace $score $k $k 0]
       incr k
            set score [lreplace $score $k $k 0]
          }
          putserv "PRIVMSG $chan :\001ACTION sprinkles bot dust and time begins again!"
        }
        set winuse 0
        set chan ""
        set fd [open $wscorefile w]
        foreach line $score {
          puts $fd $line
        }
        close $fd
        return 0
     } 
   }
   putserv "PRIVMSG $chan :$nick this is your first ever win!!!...Don't you feel pathetic!"
   set score [lappend score $handle]
   set score [lappend score 1]
   set score [lappend score 1]
   set fd [open $wscorefile w]
     foreach line $score {
       puts $fd $line
     }
   close $fd
   set winuse 0
   set chan ""
}

proc the_score {nick uhost handle channel args} {
  global botnick wscorefile words answer winuse chan
  if {($winuse == 1) && ($chan == $channel)} {
    putserv "PRIVMSG $chan :Sheesh! Can't you see we're playing here!!"
  return 0
  }
  if {![file exists $wscorefile]} {
    putserv "PRIVMSG $chan : No one has scored yet!"
    return
  }
  set fd [open $wscorefile r]
  set j 0
   while {![eof $fd]} {
     lappend score [gets $fd]
    incr j
   }
   set i [expr $j - 1]
   set score [lreplace $score $i $i]
   close $fd
   set looptest [llength $score]
   if {$looptest > 30} {
      set looptest 30
   }
   for {set k 0} {$k < $looptest} {incr k 3} {
      set wosnick [lindex $score $k]
      set dscore [lindex $score [expr $k + 1]]
      set fscore [format "%d" [lindex $score [expr $k + 2]]]
      lappend tempsortscore [format "%.20d %d %s" $fscore $dscore $wosnick]
   }
   set tempsortscore [lsort -decreasing $tempsortscore]
   set k 0
   foreach i $tempsortscore {
     incr k
    set newtempsortscore [string trimleft [lindex $i 0] 0]
     append sortscore [format "\0034 %s\.\003 %s\(%d\/%d\)  " $k [lindex $i 2] $newtempsortscore [lindex $i 1]]
   }
   set slength [llength $sortscore]
   putserv "PRIVMSG $channel :The top 10 Scramble scorers are (Total/Daily):"
   putserv "PRIVMSG $channel :$sortscore"
}

# Give clue word

proc clue_1 {} {
   global chan answer
   set clue $answer
   putserv "PRIVMSG $chan :Clue --->\00312  $clue"
}


# Give first letter of the word

proc clue_2 {} {
   global chan letone
   set clue $letone
   putserv "PRIVMSG $chan :First letter --->\00312  $clue"
}

# Give the second letter

proc clue_3 {} {
   global chan lettwo
   set clue $lettwo
   putserv "PRIVMSG $chan :First two letters --->\00312  $clue"
}

# Kill all remaining timers when someone wins.

proc kill_timers {} {
   global chan
   foreach j [utimers] {
     if {[lindex $j 1] == "noone_gotit"} {
        killutimer [lindex $j 2]
     }
     if {[lindex $j 1] == "clue_1"} {
        killutimer [lindex $j 2]
     }
     if {[lindex $j 1] == "clue_2"} {
        killutimer [lindex $j 2]
     }
     if {[lindex $j 1] == "clue_3"} {
        killutimer [lindex $j 2]
     }
   }
   return 0
}

# Its 3:00 am, clear the daily scores.

proc wo_refresh_time {m h d mo y} {
  global wscorefile
  set fd [open $wscorefile r]
  set j 0
  while {![eof $fd]} {
     lappend score [gets $fd]
     set j [incr j]
    }
  set i [expr $j - 1]
  set score [lreplace $score $i $i]
  close $fd
  set score [lreplace $score 1 1 0]
  for {set k 1} {$k < $i} {incr k 3} {
     set score [lreplace $score $k $k 0]
  }
  set fd [open $wscorefile w]
  foreach line $score {
      puts $fd $line
  }
  close $fd
  return 1
}

putlog "Wordgame by murf loaded"

ı have added script.tcl the conf file.. ( source/script/scramble.tcl
ı have edited the scramble.tcl ( created wscore , wordlist files )
ı have rehashed the eggdrop ( ./eggdrop -m scramble.conf ) , ( eggdrop 1.6.17) and the perfect come in the irc channel
ı have maked !word command but it not get reply !!
can you help me please ...
ı can to go mad Very Happy
Back to top
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Sat Jul 23, 2005 2:37 pm    Post subject: Reply with quote

Quote:

ı have added script.tcl the conf file.. ( source/script/scramble.tcl


that should be
Code:

source scripts/scramble.tcl

_________________
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Back to top
View user's profile Send private message Visit poster's website
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Sun Jul 24, 2005 3:03 am    Post subject: Reply with quote

oke ı have fixed but not ruuning again
Back to top
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Sun Jul 24, 2005 8:16 am    Post subject: Reply with quote

Did you actually turn the game on?

/msg yourbotsname !wordswitch

Make sure you have the flags +mf. Also noone but people added to your bot with the +f flag can play the game you may want to change the 'f|f' flags to '-|-' in the binds without the quotes''
_________________
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Back to top
View user's profile Send private message Visit poster's website
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Sun Jul 24, 2005 2:27 pm    Post subject: Reply with quote

you gotta set the variables to your specific bot Confused i see this tcl bitched about more & more, but it works fine ffs
Code:
## VARIABLES, set these.

# This is the file that holds the wordlist, set it to whatever
set wlistfile /home/egg/kinks/scripts/wordlist.txt

# This file keeps scores again call it whatever
set wscorefile /home/egg/kinks/scripts/wscore

_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Tue Jul 26, 2005 3:17 pm    Post subject: Reply with quote

^DooM^ wrote:
Did you actually turn the game on?

/msg yourbotsname !wordswitch

Make sure you have the flags +mf. Also noone but people added to your bot with the +f flag can play the game you may want to change the 'f|f' flags to '-|-' in the binds without the quotes''


ok ı have maked flags to -|-' but not get relpy "/msg botname !wordswitch and !word


Last edited by Mystical on Tue Jul 26, 2005 3:18 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Tue Jul 26, 2005 3:18 pm    Post subject: Reply with quote

YooHoo wrote:
you gotta set the variables to your specific bot Confused i see this tcl bitched about more & more, but it works fine ffs
Code:
## VARIABLES, set these.

# This is the file that holds the wordlist, set it to whatever
set wlistfile /home/egg/kinks/scripts/wordlist.txt

# This file keeps scores again call it whatever
set wscorefile /home/egg/kinks/scripts/wscore


oke ı have fixed it's but not running
Back to top
View user's profile Send private message
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Fri Jul 29, 2005 5:01 am    Post subject: Reply with quote

Are you sure you fixed it?

Are you running this on a windrop or eggdrop?
_________________
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Back to top
View user's profile Send private message Visit poster's website
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Fri Jul 29, 2005 4:39 pm    Post subject: Reply with quote

^DooM^ wrote:
Are you sure you fixed it?

Are you running this on a windrop or eggdrop?


yes sure.. it's running on a eggdrop .
Code:
#Change the f|f if you want.

bind pub -|- !score the_score
bind pub -|- !word pub_word
bind time - "05 03 % % %" wo_refresh_time
bind msg m !wordswitch word_onoff
bind msg m !wordanswer answer_onoff
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Jul 29, 2005 8:42 pm    Post subject: Reply with quote

Are you certain you have set the pathlist to wordlist.txt & wscore correctly? To recheck, from your bots ~scripts folder type >> pwd
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Sat Jul 30, 2005 6:40 am    Post subject: Reply with quote

Alchera wrote:
Are you certain you have set the pathlist to wordlist.txt & wscore correctly? To recheck, from your bots ~scripts folder type >> pwd

yes ı have again checked ... it is'nt problem...
Back to top
View user's profile Send private message
Ian-Highlander
Op


Joined: 24 Sep 2001
Posts: 165
Location: Ely, Cambridgeshire

PostPosted: Sat Jul 30, 2005 8:38 am    Post subject: Reply with quote

Mystical wrote:
^DooM^ wrote:
Did you actually turn the game on?

/msg yourbotsname !wordswitch

Make sure you have the flags +mf. Also noone but people added to your bot with the +f flag can play the game you may want to change the 'f|f' flags to '-|-' in the binds without the quotes''


ok ı have maked flags to -|-' but not get relpy "/msg botname !wordswitch and !word


Umm you do realise the command is actually:

/msg botnick !wordswitch on

Right?

You have to specify the on or off at the end, just a thought in case you'd missed it.
_________________
"Insanity Takes Its Toll, Please Have Exact Change"
Back to top
View user's profile Send private message Send e-mail
Mystical
Voice


Joined: 26 May 2005
Posts: 30

PostPosted: Sat Jul 30, 2005 9:52 am    Post subject: Reply with quote

Ian-Highlander wrote:
Mystical wrote:
^DooM^ wrote:
Did you actually turn the game on?

/msg yourbotsname !wordswitch

Make sure you have the flags +mf. Also noone but people added to your bot with the +f flag can play the game you may want to change the 'f|f' flags to '-|-' in the binds without the quotes''


ok ı have maked flags to -|-' but not get relpy "/msg botname !wordswitch and !word


Umm you do realise the command is actually:

/msg botnick !wordswitch on

Right?

You have to specify the on or off at the end, just a thought in case you'd missed it.


oke ı have inspected .. ı have maked /msg scramble ! !wordswitch on
but not get reply ..
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Jul 30, 2005 6:39 pm    Post subject: Reply with quote

Mystical wrote:
.. ı have maked /msg scramble ! !wordswitch on
but not get reply ..

Incase that's not a typing mistake it's
Quote:
/msg scramble !wordswitch on

as suggested by Ian-Highlander.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
^DooM^
Owner


Joined: 26 Aug 2003
Posts: 772
Location: IronForge

PostPosted: Sun Jul 31, 2005 6:20 am    Post subject: Reply with quote

hmmm odd that i missed the useful word 'on' in that lol. must of been another of my sleep deprived posts. Rolling Eyes
_________________
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber