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 

need help in this old script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
asL_pLs
Voice


Joined: 02 May 2016
Posts: 18

PostPosted: Tue Apr 27, 2021 3:21 pm    Post subject: need help in this old script Reply with quote

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:
# 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"
Back to top
View user's profile Send private message AIM Address
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Tue Apr 27, 2021 6:22 pm    Post subject: Reply with quote

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?t=16380&highlight=
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
asL_pLs
Voice


Joined: 02 May 2016
Posts: 18

PostPosted: Wed Apr 28, 2021 2:04 am    Post subject: Reply with quote

!start not working.. not showing in the channel.
Back to top
View user's profile Send private message AIM Address
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 877
Location: France

PostPosted: Wed Apr 28, 2021 11:09 am    Post subject: Reply with quote

Well, I see:
Code:
bind pub M !start start_proc

The M flag doesn't exist, the m flag does.
_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Wed Apr 28, 2021 11:11 am    Post subject: Reply with quote

The M flag does exist. It's one of the 26 custom flags that scripts can use:

Quote:
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
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 877
Location: France

PostPosted: Wed Apr 28, 2021 11:19 am    Post subject: Reply with quote

I know, I mean it's not a default flag and nowhere in the script I saw "add your user the M flag"
_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
DasBrain
Voice


Joined: 08 Apr 2021
Posts: 12

PostPosted: Wed Apr 28, 2021 11:23 am    Post subject: Reply with quote

The documentation for the script is essentially:
Quote:
#well just read the script, you'll understand :p
Back to top
View user's profile Send private message
asL_pLs
Voice


Joined: 02 May 2016
Posts: 18

PostPosted: Thu Apr 29, 2021 10:07 am    Post subject: Reply with quote

can you check here.. need help..


http://forum.egghelp.org/viewtopic.php?t=16380
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
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