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.

need help in this old script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
aslpls
Halfop
Posts: 42
Joined: Mon May 02, 2016 9:41 am

need help in this old script

Post by aslpls »

hi, i found this script and its old. it will load on the eggdrop but it will not play in the channel. anyone can help it out.

Code: Select all

# Author: tomekk
# Edited by GaRfWeN
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
#
#
#Simple lottery script
#Commands:
#!reg !regs
#!remove
#!start
#!stop
#well just read the script, you'll understand :p

bind pub M !start start_proc
bind pub M !prize prize_proc
bind pub - !reg reg_proc
bind pub - !regs regs_proc
bind pub M !setwinner setwinner
bind pub M !stop stop
bind pub M !setprize setprize
bind pub M !max maxusers
bind pub - "-m" menosm
bind pub - "+m" maism
bind pub - .not pub:server
bind pub - .notice pub:server
bind pub - !remove remove
bind pub - !del del
bind pub - !last last
bind pub - !lotterys number

set lotterynumber "1"


set corinicial "10,15\[6«5"  
set corfinal "6»10\]"  


set game_status 0
set game_prize ""
set reg_status 0
set max_players 0
set player_list [list]
set the_winner_is ""
set lotterychan "#Your Lottery Chan"
set mainchan "$lotterychan"
set lastwinner "None"
set lastlottery ""
set lastadmin ""
set lastprize ""
set onjoinchan "$mainchan"
set lotteryadmin ""
set lotterychan ""


proc number {nick uhost hand chan rest} {
        global lotterynumber
      putquick "privmsg $chan :$::corinicial Total Lotteries: $lotterynumber $::corfinal"

}

bind part - * holm-join_greet
proc holm-join_greet {nick uhost hand channel args} {
global onjoinchan greet reg_status player_list max_players game_status game_prize the_winner_is lotteryadmin mainchan  lotteryadmin lastwinner lotterynumber
      if {$game_status == 1} {
        if {(([lsearch -exact [string tolower $onjoinchan] [string tolower $channel]] != -1) || ($onjoinchan == "*"))} {
if { $nick == $lotteryadmin } {
      putquick "PRIVMSG $mainchan :$::corinicial $nick (admin) parted, Lottery canceled  $::corfinal" 
      utimer 10 [list putquick "TOPIC $channel :$::corinicial Welcome² $channel $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $lastwinner $::corfinal"]
      utimer 10 [list putquick "TOPIC $mainchan :$::corinicial Welcome² $channel $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $lastwinner $::corfinal"]
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
            set the_winner_is ""
      } else {
      set searchnode "$nick;$uhost"
   set pos [lsearch $player_list $searchnode]
      set player_list [lreplace $player_list $pos 0]
      }
   }
}
}

proc last {nick uhost hand chan rest} {
        global lastadmin lastlottery lastwinner lastprize
              if {$lastlottery == ""} {
      putquick "privmsg $chan :$::corinicial No stats yet, sorry. $::corfinal"
              } else {
      putquick "privmsg $chan :$::corinicial Last Lottery was on $lastlottery, by $lastadmin $::corfinal$::corinicial Winner was: $lastwinner , and his prize was: $lastprize $::corfinal"
}
}


proc pub:server { nick userhost handle channel text } {
if {[isop $nick $channel]} {
        global botnick
        putquick "mode $::mainchan -N"
        putquick "notice $::mainchan :$::corinicial $text ($nick) $::corfinal"
        putquick "notice $::mainchan :$::corinicial $text ($nick) $::corfinal"
        putquick "notice $::mainchan :$::corinicial $text ($nick) $::corfinal"
        putquick "mode $::mainchan +N"
}
}

proc setwinner {nick uhost hand chan rest} {
   global the_winner_is game_status
      if {$game_status == 1} {
if {[isop $nick $chan]} {
set the_winner_is $rest
      putquick "notice $nick :$::corinicial Winner added ($rest) $::corfinal"
}
}
}

proc remove {nick uhost hand chan rest} {
   global reg_status player_list max_players game_status game_prize the_winner_is 
      if {$game_status == 1} {
        set searchnode "$nick;$uhost"
   set pos [lsearch $player_list $searchnode]
   if { $pos > -1 } {
            set player_list [lreplace $player_list $pos 0]
      putserv "NOTICE $nick :$::corinicial Removed! $::corfinal"
   } else {
      putserv "NOTICE $nick :$::corinicial You are not registered! $::corfinal"
   }
}
}
proc setprize {nick uhost hand chan rest} {
   global game_prize max_players lastadmin game_status
      if {$game_status == 1} {
      putquick "privmsg $chan :$::corinicial Prize changed to: $rest $::corfinal"
set game_prize $rest
    utimer 5 [list putquick "TOPIC $chan :$::corinicial Lottery started $::corfinal$::corinicial Max users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal"]
}
}

proc stop {nick uhost hand chan rest} {
   global reg_status player_list max_players game_status game_prize the_winner_is lotterynumber lastwinner
      if {$game_status == 1} {
      putquick "PRIVMSG $chan :$::corinicial The game has been stopped by $nick $::corfinal" 
            putquick "TOPIC $chan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $lastwinner $::corfinal"
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
set the_winner_is ""
set lotterychan ""
}
}


proc maxusers {nick uhost hand chan rest} {
   global reg_status player_list max_players game_status game_prize the_winner_is lastadmin lastlottery lastwinner lastprize lotterychan lotterynumber mainchan
      if {$game_status == 1} {
      putquick "PRIVMSG $chan :$::corinicial Max-users is now $rest $::corfinal" 
            putquick "TOPIC $chan :$::corinicial Lottery started $::corfinal$::corinicial Max users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal"
            set max_players $rest
         if {[llength $player_list] == $max_players} {
              if {$the_winner_is == ""} {
            set lottery_winner [expr {int(rand() * $max_players)}]
            set the_winner_is [lindex [split [lindex $player_list $lottery_winner] ";"] 0]
     putquick "MODE $chan +v $the_winner_is"
        putquick "mode $chan +m"
set time "[clock format [clock seconds] -format {%H:%M:%S %x}]"
set lastlottery $time
set lastwinner $the_winner_is
set lastprize $game_prize
set lotterynumber [expr $lotterynumber +1]
            putquick "PRIVMSG $chan :$::corinicial $the_winner_is you have just won the lottery! your prize is $game_prize $::corfinal"
      putquick "TOPIC $chan :$::corinicial Lottery had finished. $::corfinal$::corinicial Number of Users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal$::corinicial Winner: $the_winner_is $::corfinal$::corinicial Brought to you by:  #aBNC - #iBots $::corfinal"
            putquick "PRIVMSG $the_winner_is :$::corinicial $the_winner_is congrats ! your prize is: $game_prize $::corfinal$::corinicial Please contact the Lottery admin.$::corfinal"
          utimer 15 [list putquick "TOPIC $chan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
          utimer 15 [list putquick "TOPIC $mainchan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
          utimer 16 [list putquick "mode $chan -m"]
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
set the_winner_is ""
set lotterychan ""
                    } else {
        putquick "mode $chan +m"
set time "[clock format [clock seconds] -format {%H:%M:%S %x}]"
set lastlottery $time
set lastwinner $the_winner_is
set lastprize $game_prize
set lotterynumber [expr $lotterynumber +1]
     putquick "MODE $chan +v $the_winner_is"
            putquick "PRIVMSG $chan :$::corinicial $the_winner_is you have just won the lottery! your prize is $game_prize $::corfinal"
      putquick "TOPIC $chan :$::corinicial Lottery had finished. $::corfinal$::corinicial Number of Users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal$::corinicial Winner: $the_winner_is $::corfinal$::corinicial Brought to you by:  #aBNC - #iBots $::corfinal"
            putquick "PRIVMSG $the_winner_is :$::corinicial $the_winner_is congrats ! your prize is: $game_prize $::corfinal$::corinicial Please contact the Lottery admin.$::corfinal"
          utimer 15 [list putquick "TOPIC $chan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
          utimer 15 [list putquick "TOPIC $mainchan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
          utimer 16 [list putquick "mode $chan -m"]
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
set the_winner_is ""
set lotterychan ""
            }
         }
   }
}


proc start_proc { nick uhost hand chan arg } {
   global max_players game_status

   if {$game_status == 0} {
      set players_num [lindex [split $arg] 0]

      if {[regexp {^([0-9]+)$} $players_num]} {
         set max_players $players_num
         set game_status 1
            putquick "PRIVMSG $chan :$::corinicial Trying to start a lottery with $max_players users (please type !prize <prize> to start.) $::corfinal"
      }
   }
}



proc prize_proc { nick uhost hand chan arg } {
   global game_status reg_status max_players game_prize lastadmin lotteryadmin lotterychan

   if {$game_prize == ""} {
      if {$game_status == 1} {
         if {$arg != ""} {
            set game_prize $arg
            set reg_status 1
        putquick "mode $chan +m"
set lastadmin $nick
set lotteryadmin $nick 
set lotterychan $chan
      putquick "TOPIC $chan :$::corinicial Lottery starting! $::corfinal$::corinicial Be ready !!! $::corfinal$::corinicial Lottery admin: $nick $::corfinal"
            putquick "PRIVMSG $chan :$::corinicial Removing Moderated in 10 seconds $::corfinal"
    utimer 10 [list putquick "mode $chan -m"]
    utimer 9 [list putquick "TOPIC $chan :$::corinicial Lottery started $::corfinal$::corinicial Max users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal"]
         }
      }
   }
}


proc reg_proc { nick uhost hand chan arg } {
   global reg_status player_list max_players game_status game_prize the_winner_is lastadmin lastlottery lastwinner lastprize lotterychan lotterynumber mainchan
   if {$reg_status == 0} {
            putquick "PRIVMSG $chan :$::corinicial There is no lottery game started ! $::corfinal"
         } else {
      set player_exists 0
      foreach new_player $player_list {
   set gimme_host [lindex [split $new_player ";"] 1]
   set current_in [llength $player_list]
       if {$gimme_host == $uhost} {
            set player_exists 1
            putquick "NOTICE $nick :$::corinicial You can only add one time with that adress $::corfinal"
            break
    }
  }
      if {$player_exists == 0} {
         lappend player_list "$nick;$uhost"

         if {[llength $player_list] == $max_players} {
              if {$the_winner_is == ""} {
            set lottery_winner [expr {int(rand() * $max_players)}]
            set the_winner_is [lindex [split [lindex $player_list $lottery_winner] ";"] 0]
     putquick "MODE $chan +v $the_winner_is"
        putquick "mode $chan +m"
set time "[clock format [clock seconds] -format {%H:%M:%S %x}]"
set lastlottery $time
set lastwinner $the_winner_is
set lastprize $game_prize
set lotterynumber [expr $lotterynumber +1]
            putquick "PRIVMSG $chan :$::corinicial $the_winner_is you have just won the lottery! your prize is $game_prize $::corfinal"
      putquick "TOPIC $chan :$::corinicial Lottery had finished. $::corfinal$::corinicial Number of Users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal$::corinicial Winner: $the_winner_is $::corfinal$::corinicial Brought to you by:  #aBNC - #iBots $::corfinal"
          utimer 15 [list putquick "TOPIC $chan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
          utimer 15 [list putquick "TOPIC $mainchan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
            putquick "PRIVMSG $the_winner_is :$::corinicial $the_winner_is congrats ! your prize is: $game_prize $::corfinal$::corinicial Please contact the Lottery admin.$::corfinal"
                     utimer 16 [list putquick "mode $chan -m"]
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
            set the_winner_is ""
set lotterychan ""
                    } else {
     putquick "MODE $chan +v $the_winner_is"
        putquick "mode $chan +m"
set time "[clock format [clock seconds] -format {%H:%M:%S %x}]"
set lastlottery $time
set lastwinner $the_winner_is
set lastprize $game_prize
set lotterynumber [expr $lotterynumber +1]
            putquick "PRIVMSG $chan :$::corinicial $the_winner_is you have just won the lottery! your prize is $game_prize $::corfinal"
      putquick "TOPIC $chan :$::corinicial Lottery had finished. $::corfinal$::corinicial Number of Users: $max_players $::corfinal$::corinicial Prize: $game_prize $::corfinal$::corinicial Winner: $the_winner_is $::corfinal$::corinicial Brought to you by:  #aBNC - #iBots $::corfinal"
          utimer 15 [list putquick "TOPIC $chan :$::corinicial Welcome² $chan $::corfinal$::corinicial Lotteries: $lotterynumber $::corfinal$::corinicial Last winner: $the_winner_is $::corfinal"]
            putquick "PRIVMSG $the_winner_is :$::corinicial $the_winner_is congrats ! your prize is: $game_prize $::corfinal$::corinicial Please contact the Lottery admin.$::corfinal"
          utimer 16 [list putquick "mode $chan -m"]
            set game_status 0
            set game_prize ""
            set reg_status 0
            set max_players 0
            set player_list [list]
set the_winner_is ""
set lotterychan ""
            }
         }
      }
   }
}

proc regs_proc { nick uhost hand chan arg } {
   global reg_status max_players game_prize player_list

   set current_in [llength $player_list]

   set rdy_player_list [list]

   foreach lt_player $player_list {
      if {$lt_player != ""} {
         set need_only_nick [lindex [split $lt_player ";"] 0]
         lappend rdy_player_list $need_only_nick
      }
   }

   if {$rdy_player_list == ""} {
      set rdy_player_list "-"
   } {
      set rdy_player_list [join $rdy_player_list ", "]
   }

   if {$reg_status == 1} {
      putquick "PRIVMSG $chan :$::corinicial Total regs: $current_in/$max_players: $rdy_player_list $::corfinal$::corinicial Prize: $game_prize $::corfinal"
   }
}


proc menosm {nick host hand chan text} {
if {[isop $nick $chan]} {
        putquick "mode $chan -m"
}
}

proc maism {nick host hand chan text} {
if {[isop $nick $chan]} {
        putquick "mode $chan +m"
}
}

putlog "lottery.tcl by tomekk, edited by GaRfWeN loaded" 
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

Firstly:
If you haven't tried these steps already

Have you tried .set errorInfo in partyline to have more information about it ?
Or maybe even look in Partyline?

Or tried .binds to insure the script is loaded?


Secondly

Perhaps even try Version 0.2 ?

http://forum.egghelp.org/viewtopic.php? ... highlight=
ComputerTech
User avatar
aslpls
Halfop
Posts: 42
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

!start not working.. not showing in the channel.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Well, I see:

Code: Select all

bind pub M !start start_proc
The M flag doesn't exist, the m flag does.
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

The M flag does exist. It's one of the 26 custom flags that scripts can use:
There are also 26 user-defined global flags (A-Z).
You can give it to someone with .chattr <handle> +M
Last edited by DasBrain on Wed Apr 28, 2021 11:23 am, edited 1 time in total.
User avatar
CrazyCat
Revered One
Posts: 1216
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I know, I mean it's not a default flag and nowhere in the script I saw "add your user the M flag"
D
DasBrain
Voice
Posts: 13
Joined: Thu Apr 08, 2021 12:31 pm

Post by DasBrain »

The documentation for the script is essentially:
#well just read the script, you'll understand :p
User avatar
aslpls
Halfop
Posts: 42
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

can you check here.. need help..


http://forum.egghelp.org/viewtopic.php?t=16380
Post Reply