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.

russian roulette

Old posts that have not been replied to for several years.
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

russian roulette

Post by Kaarel »

i would like to have a script like spin the bottle but in that script what I want there would be:
1) kick
2) ban
3) 10 min ban
4) 12 hour op
5) - @
6) -v
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind pub - !spin my:spin

proc my:spin {nick host handle channel text} {
  switch -- [rand 6] {
    "1" {
      # your stuff here
    }
    "2" {
      # your stuff here
    }
    "3" {
      # your stuff here
    }
    "4" {
      # your stuff here
    }
    "5" {
      # your stuff here
    }
    "6" {
      # your stuff here
    }
  }
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

[rand 6] returns a number from 0 to 5, so you might want to adjust your numbers.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups, yes, you are right. Umm..

Instead of [rand 6] should be:

Code: Select all

set numbers "1 2 3 4 5 6"
switch -- [lindex $numbers [rand [llength $numbers]]] {
This should do fine.. My appologies for my previous mistake. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

caesar wrote:Oups, yes, you are right. Umm..

Instead of [rand 6] should be:

Code: Select all

set numbers "1 2 3 4 5 6"
switch -- [lindex $numbers [rand [llength $numbers]]] {
This should do fine.. My appologies for my previous mistake. :)
Heh.. I think he meant more along the lines of changing your "1" { .. "2" ..
and subtracting 1 from them, not making a list and taking an element from the list to use.. if you don't want to change the branches, then the next best thing would probably be

Code: Select all

switch -- [expr [rand 6] + 1] {
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

..... :)
Elen sila lúmenn' omentielvo
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

Ok, but I need more help, I like to when somebody spins the bot says something like this

$nick spins the wheel
Where it will point nobody knows ....
Round and round it goes .....
Tick Tick Tick .....
Tick Tick .....
Tick .....
$nick gets free kick
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Kaarel wrote:Ok, but I need more help, I like to when somebody spins the bot says something like this

$nick spins the wheel
Where it will point nobody knows ....
Round and round it goes .....
Tick Tick Tick .....
Tick Tick .....
Tick .....
$nick gets free kick

Code: Select all

putserv "PRIVMSG <target> :<message>"
If you use the same queue for the messages/modes/kicks they will come in the right order.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

yes, the [rand 6] will *extract* a random number from 0 to 5 and by adding 1 to the result will do the trick to make it be from 1 to 6. Heh, nice, haven't thinked of this before. Silly me.
Once the game is over, the king and the pawn go back in the same box.
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

is that right for start

Code: Select all

bind pub - !spin my:spin 

proc my:spin {nick host handle channel text} { 
     set numbers "1 2 3 4 5 6" 
     switch -- [lindex $numbers [rand [llength $numbers]]] { 
    "1" { 
       putserv "MSG $chan :$nick  spins the wheel " 
       putserv "MSG $chan :Where it will point nobody knows ....  "
       putserv "MSG $chan :Round and round it goes ..... " 
       putserv "MSG $chan :Tick Tick Tick .....  " 
       putserv "MSG $chan :Tick Tick  .....  "  
       putserv "MSG $chan :Tick "  
      putserv "MSG $chan : And $nick gets a free kick out of here "  

    } 
    "2" { 
      # your stuff here 
    } 
    "3" { 
      # your stuff here 
    } 
    "4" { 
      # your stuff here 
    } 
    "5" { 
      # your stuff here 
    } 
    "6" { 
      # your stuff here 
    } 
  } 
} 
And how and where I put the code that kick the person
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Kaarel wrote:is that right for start
...
And how and where I put the code that kick the person
I suggest moving the standard messages out of the switch statement since those messages will be sent no matter (I guess).

Put the kick below the message in the execution body of the switch (where your messages are right now)
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

user wrote:
Kaarel wrote:is that right for start
...
And how and where I put the code that kick the person
I suggest moving the standard messages out of the switch statement since those messages will be sent no matter (I guess).

Put the kick below the message in the execution body of the switch (where your messages are right now)

Can you edit my code, I can`t underestand you right
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Kaarel wrote:Can you edit my code, I can`t underestand you right

Code: Select all

proc my:spin {nick host handle channel text} {
  putserv "MSG $chan :$nick  spins the wheel"
  putserv "MSG $chan :Where it will point nobody knows ...."
  putserv "MSG $chan :Round and round it goes ....."
  putserv "MSG $chan :Tick Tick Tick ....."
  putserv "MSG $chan :Tick Tick  ....."
  putserv "MSG $chan :Tick "
  switch [rand 2] {
    "0" {
      putserv "MSG $chan :And $nick gets a free kick out of here"
      putserv "KICK $chan $nick :Congratulations!"
    }
    "1" {
      putserv "MSG $chan :And $nick gets a free message (this one)"
    }
    # etc
  }
}
K
Kaarel
Halfop
Posts: 91
Joined: Sat Apr 26, 2003 5:24 am

Post by Kaarel »

Help I am so confused now. I would be thankful if you do the whole script to me
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sort of something like this:

Code: Select all

bind pub - !spin my:spin 

proc my:spin {nick host handle channel text} { 
  putserv "PRIVMSG $chan :$nick  spins the wheel " 
  putserv "PRIVMSG $chan :Where it will point nobody knows ....  " 
  putserv "PRIVMSG $chan :Round and round it goes ..... " 
  putserv "PRIVMSG $chan :Tick Tick Tick .....  " 
  putserv "PRIVMSG $chan :Tick Tick  .....  "  
  putserv "PRIVMSG $chan :Tick "  
  switch -- [expr [rand 6] + 1] {
    "1" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      putserv "PRIVMSG $chan :And $nick gets a free kick out of here "  
      putserv "KICK $chan $nick :Your free kick!"  
    } 
    "2" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      putserv "MODE $chan +b *!*@[lindex [split $host @] 1]"
    } 
    "3" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      set mask "*!*@[lindex [split $host @] 1]"
      newchanban $chan $mask $::botnick "Here is your prise.. 10 mintes ban!" 10
    } 
    "4" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      if {![isop $nick $chan]} {
        putserv "PRIVMSG $chan :And $nick gets op in here.."
      }
    }
    "5" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      if {[isop $nick $chan]} {
        putserv "PRIVMSG $chan :One deop comming up!"
        putserv "MODE $chan -o $nick"
      }
    } 
    "6" { 
      if {![botisop $chan]} {
        putserv "PRIVMSG $chan :I'm not oped here so I can't give you your prise.."
      }
      if {[isvoice $nick $chan]} {
        putserv "PRIVMSG $chan :One deop comming up!"
        putserv "MODE $chan -v $nick"
      }
    } 
  } 
}
I haven't tested it so.. Change the stuff in it to suit your needs.
Last edited by caesar on Wed Aug 13, 2003 4:27 pm, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
Locked