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.

english Scramble script

Old posts that have not been replied to for several years.
Locked
C
Crow

english Scramble script

Post by Crow »

hi . iam looking for english scramble game for eggdrop , i looked alot for it and i cant find anyone but Nerfbendr'sTriviabot and its not good one
and its at the first trivia game .
so if anyone can help me get this scramble script ill be greatfull and if he need anything for it please say
thanx
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

# From what file are the words that will be scrambed?
set scramblefile "scramble.txt"

# How many seconds to play a scrambled word?
set ssecs 60

# Show the answer if nobody got the answer?
# 0 for NO and 1 for YES.
set sanswer 0

### Done with configurations, do not edit past here unless you know TCL. ###

# binds #
bind pub o !scramble pub:scramble

# messages #
set scongrats {
  "Well done"
  "Nice going"
  "Way to go"
  "You got it"
  "That's the way"
  "Show 'em how it's done"
  "Check out the big brain on"
}

set snonegotit {
  "Nobody got it right."
  "Hello? Anybody home?"
  "You're going to have to try harder!"
  "Are these too tough for you?"
  "Am I alone here or what?"
}

# scramble #
proc pub:scramble {nick uhost hand chan text} {
  if {![file exists $::scramblefile]} {
    putserv "PRIVMSG $chan :\002Error\002: $::scramblefile dose not exist."
    return
  }

  set sstarted 0
  foreach bla [utimers] {
    if {[string match "nobody:gotit*" [lindex $bla 1]]} {
      set sstarted 1
    }
  }
  if {$sstarted == 1} {
    putserv "PRIVMSG $chan :HEY! One word at a time!"
    return
  }
  set file [open "$::scramblefile" r] 
  set data [split [read $file] "\n"]
  close $file
  set word [lindex $data [rand [llength $data]]]
  putserv "PRIVMSG $chan :[scramble $word]"


  # stuff #
  bind pub - $word pub:gotit
  utimer $::ssecs [list nobody:gotit $word $chan]
}

# got it! #
proc pub:gotit {nick uhost hand chan text} {
  putserv "PRIVMSG $chan :[lindex $::scongrats [rand [llength $::scongrats]]] $nick.."

  # clean #
  foreach bla [utimers] {
    if {[string match "nobody:gotit*" [lindex $bla 1]]} {
      killutimer [lindex $bla 2]
    }
  }
  unbind pub - $::lastbind pub:gotit
}

# loosers! #
proc nobody:gotit {word chan} {
  if {$::sanswer == 1} {
    putserv "PRIVMSG $chan :The answer was \002$word\002.. [lindex $::snonegotit [rand [llength $::snonegotit]]]"
    unbind pub - $word pub:gotit
    return
  }
  putserv "PRIVMSG $chan :[lindex $::snonegotit [rand [llength $::snonegotit]]]"
  unbind pub - $word pub:gotit
}

# scramble proc by stdragon @ forum.egghelp.org
proc scramble {word} { 
  set letters [split $word ""] 
  set newword "" 
  while {[llength $letters]} { 
    set i [rand [llength $letters]] 
    append newword [lindex $letters $i] 
    set letters [lreplace $letters $i $i] 
  } 
  return $newword 
} 
Once the game is over, the king and the pawn go back in the same box.
K
KrE80r
Voice
Posts: 18
Joined: Thu Jun 05, 2003 10:34 am

Post by KrE80r »

well hi its great scramble game man what about if i need to add a hint system and points 4 people who answer coreect like the trivia game
an !top10 command how do i do so?
K
KrE80r
Voice
Posts: 18
Joined: Thu Jun 05, 2003 10:34 am

Post by KrE80r »

well also stupid me how to make it beside hte hints play continusely froma file and i dont have to type scramble to get each word???
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

To add a hint system, create a pub bind, and have it keep track of how many hints have been requested, then have it display part of the answer. Change it to store the word in a global var rather than doing that bind.

To do a top 10, you will need to come up with some code to add points to people when they get one. You could do it by creating a new eggdrop user for each person, or handle it yourself in a tcl hash array (by nickname). This way is harder because you need to do all the file management yourself.

It's nice that you asked how to do it rather than asking for someone to do it for you :)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

To have it play continuously, get rid of the pub bind, and add either a utimer or a time bind.
K
KrE80r
Voice
Posts: 18
Joined: Thu Jun 05, 2003 10:34 am

Post by KrE80r »

well man infact i cant do it myself i mean !top10 iam not that good in tcl
i was asking if any1 can add it 2 me and about hthe hint system i meant
example:
<BoT> Who Won World cup in the year 2002?
<BoT> Scrambled Answer: r a z b i l

<user> brazil
<BoT> Coreect Answer USER u get ! point u now have 10 points ur rank is 1st on 121 users


and also i dont know how to add a utimer man if am annoying u pls tell me

c what i mean???
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

I see what you mean... wow that's completely different from your original post. You're better off getting a trivia script.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Don't expect on me starting to work like a crazy monkey on it.. :) As stdragon said/sugested this is starting to look more like a trivia game or something.
Once the game is over, the king and the pawn go back in the same box.
K
KrE80r
Voice
Posts: 18
Joined: Thu Jun 05, 2003 10:34 am

Post by KrE80r »

well guys sorry if am pain in the neck well
how to make it run hmmmmm
like !start it goes on playing untill some1 types !stop how??
d
dun_dacil
Voice
Posts: 16
Joined: Wed Sep 04, 2002 3:36 pm
Location: Pisa, Italy

Post by dun_dacil »

Although the thread has taken a different direction, there is decent scramble script called
wordgame, by murf. It can be found among the tcl scripts on www.egghelp.org. It comes with 500 preset words, but more are easily added.

dun_dacil
Locked