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.

Eggdrop/Tcl script problem

Old posts that have not been replied to for several years.
Locked
r
rb201

Eggdrop/Tcl script problem

Post by rb201 »

I am trying to make an older script that ran in early eggdrop run in newer eggdrop. The old script user user-get/user-set commands. I have tried all types of commands but have been unable to get this to work. This is supposed to user the userfile and xtra data areas to keep an info listing sort of a mini database. I am lost at this point and ready to give up as I can't seem to get any further reading the forums trying to find a similar script to use as an example. Any help would be appreciated. Thanks
---------------------------------------------------------

Code: Select all

set logo "XxX"
bind pub * !add ts_add
bind pub * !dupe ts_dupe
bind pub * !addsite ts_addsite
bind pub o !delsite ts_del
bind pub o !del ts_delrel
bind pub o !name ts_name
bind pub * !link ts_link
bind pub * !platforms ts_platform
bind pub * !affils ts_affils
bind pub * !showaffils ts_affilsinfo
bind pub * !status ts_status
bind pub * !gadmin ts_gadmin
bind pub * !test ts_reset
bind pub * !extra ts_com
bind pub * !site ts_siteinfo
bind pub * !sites ts_sitesall
bind pub * !search ts_search
bind pub * !xhelp ts_help
bind pub * !list ts_sites


proc ts_addsite {nick uhost hand channel arg} {

  global logo

  set site     [lindex $arg 0]
  set sitename [lrange $arg 1 end]

  if {$site == ""} {
  putserv "PRIVMSG $channel :\[ $logo \]USAGE!Addsite Site Full_Name ie:!AddsiteIP   ThePalace"
  return 1 }

  if {$sitename == ""} { set sitename "not available" }

# check for dupes

  set cc 0
  set dupes [userlist 9]

  foreach dupe $dupes {

  set site1 [getuser $dupe XTRA ab]
  set aadupe [string tolower $site1]
  set awho [string tolower $site]

   if {$aadupe == $awho} { 

    set cc [getuser $dupe qu]
    if {$cc == ""} { set cc 0 }
    incr cc 1
    set userinfo $dupe XTRA qu $cc
    set awho [string toupper $site]
    putserv "PRIVMSG $channel :\[ $logo \] DUPE Detected Renaming... $awho to $awho$cc"
    set site $awho$cc
 }

# new site add it
}
  set nt "not available"
  set wt "up"
  set boom [getuser TS count]
  incr boom
  setuser TS count $boom

  set ts "ts"
  set newsite $ts  
  set test $site

  adduser $newsite *! $newsite @*.ts.net
  chattr $newsite +9

  adduser $test *! $newsite @*.ts.net
  chattr $test +1
  set userinfo $newsite XTRA ab $site
  set userinfo $newsite XTRA name $sitename
  set userinfo $newsite XTRA status $wt
  set userinfo $newsite XTRA slots $nt
  set userinfo $newsite XTRA com "none"
  set userinfo $newsite XTRA link $nt
  set userinfo $newsite XTRA platform $nt
  set userinfo $newsite XTRA gadmin $nt
  set userinfo $newsite XTRA affils $nt


  putserv "PRIVMSG $channel :\[ $logo \] New Site: $site - $sitename added to my site   database"
  return 1
}


proc ts_del {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set sitedel [lindex $arg 0]
  set sitedel [string tolower $sitedel]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $sitedel} {
      deluser $site
      putserv "PRIVMSG $channel :\[ $logo \] DELETED: $site1 from my site database"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $sitedel "
}

 
proc ts_delrel {nick host hand channel arg} {

  global logo

  set sites    [userlist 5]
  set sitedel [lindex $arg 0]
  set sitedel [string tolower $sitedel]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $sitedel} {
      deluser $site
      putserv "PRIVMSG $channel :\[ $logo \] DELETED: $site1 from my dupe database"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] DUPE NOT FOUND: $sitedel "
}


proc ts_name {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set sitename [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site name $sitename
      putserv "PRIVMSG $channel : \[ $logo \] $siteone name changed to $sitename"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_link {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set sitelink [lrange $arg 1 end]
  set siteone [string tolower $siteone]

 foreach site $sites { set site1 [getuser $site ab]

   set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site link $sitelink
      putserv "PRIVMSG $channel : \[ $logo \] $siteone link changed to $sitelink"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_platform {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteplatform [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]

  set site1 [string tolower $site1]
   
   if {$site1 == $siteone} {
      setuser $site platforms $siteplatform
      putserv "PRIVMSG $channel : \[ $logo \] $siteone platform changed to $siteplatform"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 
proc ts_gadmin {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set sitegadmin [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site gadmin $sitegadmin
      putserv "PRIVMSG $channel : \[ $logo \] $siteone gadmin changed to $sitegadmin"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_slots {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteslots [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]

   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site slots $siteslots
      putserv "PRIVMSG $channel : \[ $logo \] $siteone slots changed to $siteslots"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_status {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set sitestatus [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site status $sitestatus
      putserv "PRIVMSG $channel : \[ $logo \] $siteone status changed to $sitestatus"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 
proc ts_com {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set sitecom [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]

   set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site com $sitecom
      putserv "PRIVMSG $channel : \[ $logo \] $siteone extra info changed to $sitecom"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_affils {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteaffils [lrange $arg 1 end]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {
      setuser $site affils $siteaffils
      putserv "PRIVMSG $channel : \[ $logo \] $siteone affils changed to $siteaffils"
      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_siteinfo {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set site1 [string tolower $site1]

   if {$site1 == $siteone} {

      set sitename     [getuser $site name]
      set sitelink     [getuser $site link]
      set siteplatform [getuser $site platforms]
      set sitegadmin   [getuser $site gadmin]
      set siteslots        [getuser $site slots]
      set sitestatus       [getuser $site status]
      set siteaffils       [getuser $site affils]
      set siteextra       [getuser $site com]

  if {$siteextra == ""} {
  setuser $site com "none"
  set siteextra "none"
}

  set site1 [string toupper $site1]
  set siteaffils [lsort -increasing $siteaffils]
  set siteaffils [string toupper $siteaffils]

      putserv "PRIVMSG $channel : \[name\] $sitename"
      putserv "PRIVMSG $channel : \[link\] $sitelink"
      putserv "PRIVMSG $channel : \[platforms\] $siteplatform"
      putserv "PRIVMSG $channel : \[gadmin\] $sitegadmin"
      putserv "PRIVMSG $channel : \[slots\] $siteslots"
      putserv "PRIVMSG $channel : \[status\] $sitestatus"
      putserv "PRIVMSG $channel : \[affils\] $siteaffils"
      putserv "PRIVMSG $channel : \[extrainfo\] $siteextra"

      return 0
   }
}
  putserv "PRIVMSG $channel : \[ $logo \] SITE NOT FOUND: $siteone "
}

 

proc ts_affilsinfo {nick host hand channel arg} {

  global logo

  set results ""
  set resultsu ""
  set resultse ""

  set spc " "
  set pace 0
  set paceu 0
  set pacee 0
  set paceo 0

  set euro "EU"
  set usam "US"
  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set stop 1
  set check [getuser $site affils]
  set typen [getuser $site link]
  set check [string tolower $check]
  set site1 [string tolower $site1]

    if {[string first $siteone $check] != "-1"} {
    incr pace 1

    set ssa   [getuser $site status]

    if {$ssa == "up"} {
    } else {
    set site1 "$site1"
 }

 

set typen [getuser $site link]

    if {[string first $usam $typen] != "-1"} {
    set resultsu $site1$spc$resultsu
    incr paceu 1
    set stop 0
   }

    if {[string first $euro $typen] != "-1"} {
    set resultse $site1$spc$resultse
    incr pacee 1
    set stop 0
   }
    if {$stop == "1"} {
    set results $site1$spc$results
    incr paceo 1
   }
 }
}
  set siteone [string toupper $siteone]

  if {$pace == "0"} {
  putserv "PRIVMSG $channel : \[ $logo \] no sites found with $siteone as affils: "
  return 1
}

  set results [string toupper $results]
  set resultsu [string toupper $resultsu]
  set resultse [string toupper $resultse]

  set resultsu [lsort -increasing $resultsu]
  set resultse [lsort -increasing $resultse]
  set results [lsort -increasing $results]

  putserv "PRIVMSG $channel : \[ $logo \] $pace site(s) with $siteone as affils: "
  if {$paceu > "0"} {putserv "PRIVMSG $channel : \[ $logo \] US ($paceu)  $resultsu " }
  if {$pacee > "0"} { putserv "PRIVMSG $channel : \[ $logo \] EU ($pacee)  $resultse  " }
  if {$paceo > "0"} { putserv "PRIVMSG $channel : \[ $logo \] Other ($paceo)  $results     " }
}

 

proc ts_reset {nick host hand channel arg} {

  global logo

  set lamahs [userlist 9]
  set nicklist [lsort -increasing [userlist 9]]
  putserv "PRIVMSG $channel : \[ $logo \] $nicklist"
}

 
proc ts_sites {nick host hand channel arg} {

  global logo

  set sites    [userlist 9]

  foreach site $sites { set site1 [getuser $site ab]
   
      set sitename     [getuser $site name]
      set sitelink     [getuser $site link]
      set siteplatform [getuser $site platforms]
      set sitegadmin   [getuser $site gadmin]
      set siteslots        [getuser $site slots]
      set sitestatus       [getuser $site status]
      set siteaffils       [getuser $site affils]

      putserv "PRIVMSG $nick : \[ $logo \] $sitename / $siteaffils "
   }
}

 
proc ts_sitesall {nick host hand channel arg} {

  global logo

  set results ""
  set resultsu ""
  set resultse ""

  set sites    [userlist 9]
  set allinfo ""
  set spc " "
  set pace 0
  set paceu 0
  set pacee 0
  set paceo 0
  set euro "EU"
  set usam "US"

  foreach site $sites { set site1 [getuser $site ab]
   
      set stop 1
      set sitename     [getuser $site name]
      set allinfo $site1$spc$allinfo    
      set typen [getuser $site link]
      set ssa   [getuser $site status]

    if {$ssa == "up"} {
    } else {
    setuser $site ab "$site1"
    set site1 "$site1"
   }

    if {[string first $usam $typen] != "-1"} {
    set resultsu $site1$spc$resultsu
    incr paceu 1
    set stop 0
   }

    if {[string first $euro $typen] != "-1"} {
    set resultse $site1$spc$resultse
    incr pacee 1
    set stop 0
   }

    if {$stop == "1"} {
    set results $site1$spc$results
    incr paceo 1
   }
}

  set results [string toupper $results]
  set resultsu [string toupper $resultsu]
  set resultse [string toupper $resultse]

  set allinfo [string toupper $allinfo]
  putserv "PRIVMSG $channel : \[ $logo \] $allinfo"
  set resultsu [lsort -increasing $resultsu]
  set resultse [lsort -increasing $resultse]
  set results [lsort -increasing $results]

  if {$paceu > "0"} {putserv "PRIVMSG $channel : \[ $logo \] US ($paceu)  $resultsu" }
  if {$pacee > "0"} { putserv "PRIVMSG $channel : \[ $logo \] EU ($pacee)  $resultse  " }
  if {$paceo > "0"} { putserv "PRIVMSG $channel : \[ $logo \] Other ($paceo)  $results  " }

}

 

proc ts_search {nick host hand channel arg} {

  global logo

  set results ""
  set resultsu ""
  set resultse ""

  set spc " "
  set pace 0
  set paceu 0
  set pacee 0
  set paceo 0

  set euro "eu"
  set usam "us"
  set sites    [userlist 9]
  set siteone [lindex $arg 0]
  set siteone [string tolower $siteone]

  foreach site $sites { set site1 [getuser $site ab]
   
  set stop 1
  set check [getuser $site affils]
  set plat [getuser $site platforms]
  set typen [getuser $site link]
  set check [string tolower $check]
  set site1 [string tolower $site1]

    set ssa   [getuser $site status]

    if {$ssa == "up"} {
    } else {
    set site1 "$site1"
    }


  set typen [string tolower $typen]
  set plat [string tolower $plat]
  set siteone [string tolower $siteone]


    if {[string first $siteone $typen] != "-1"} {
    incr pace 1


 

    if {[string first $usam $typen] != "-1"} {
    set resultsu $site1$spc$resultsu
    incr paceu 1
    set stop 0
  }

    if {[string first $euro $typen] != "-1"} {
    set resultse $site1$spc$resultse
    incr pacee 1
    set stop 0
  }
    if {$stop == "1"} {
    set results $site1$spc$results
    incr paceo 1
  }
}

    if {[string first $siteone $plat] != "-1"} {
    incr pace 1


    if {[string first $usam $typen] != "-1"} {
    set resultsu $site1$spc$resultsu
    incr paceu 1
    set stop 0
  }

    if {[string first $euro $typen] != "-1"} {
    set resultse $site1$spc$resultse
    incr pacee 1
    set stop 0
  }
    if {$stop == "1"} {
    set results $site1$spc$results
    incr paceo 1
   }
 }
}
  set siteone [string tolower $siteone]

  if {$pace == "0"} {
  putserv "PRIVMSG $channel : \[ $logo \] no sites found: search pattern - $siteone "
  return 1
}

  set results [string toupper $results]
  set resultsu [string toupper $resultsu]
  set resultse [string toupper $resultse]

  putserv "PRIVMSG $channel : \[ $logo \] $pace site(s) found: search pattern - $siteone"
  set resultsu [lsort -increasing $resultsu]
  set resultse [lsort -increasing $resultse]
  set results [lsort -increasing $results]

  if {$paceu > "0"} {putserv "PRIVMSG $channel : \[ $logo \] US ($paceu)  $resultsu " }
  if {$pacee > "0"} { putserv "PRIVMSG $channel : \[ $logo \] EU ($pacee)  $resultse " }
  if {$paceo > "0"} { putserv "PRIVMSG $channel : \[ $logo \] Other ($paceo)  $results  " }
}

 

proc ts_add {nick uhost hand channel arg} {

  global logo

  set site     [lindex $arg 0]
  set relname  [lrange $arg 0 end]

  if {$site == ""} {
  putserv "PRIVMSG $channel :\[ $logo \] USAGE !Add XXX_Name-GROUP XX/XX DATE\(optioal\)"
  return 1
}


 
# check for dupes
 
  set cc 0
  set dupes [userlist 5]

  foreach dupe $dupes {

  set site1 [getuser $dupe ab]
  set aadupe [string tolower $site1]
  set awho [string tolower $site]

   if {$aadupe == $awho} { 

    putserv "PRIVMSG $channel :\[ $logo \] DUPE Detected of $site1"
    return 1
 }

}

 
# new site add it
 
  set nt "not available"
  set wt "up"
  set boom [userget TS count]
  incr boom
  setuser TS count $boom

  set ts "ts"
  set newsite $ts $boom
  set test $site

  adduser $newsite *!$newsite@*.ts.net
  chattr $newsite +5

  setuser $newsite ab $site
  setuser $newsite platform $relname

  putserv "PRIVMSG $channel :\[ $logo \] New XXX: $relname added to my dupe database"
  return 1
}

 

proc ts_dupe {nick host hand channel arg} {

  global logo
  set jx "0"
  set dupes [userlist 5]
  set site  [lindex $arg 0]

  putserv "PRIVMSG $channel : \[ $logo \] Searching... "

  foreach dupe $dupes {

  set awho [string tolower $site]
  set typen [getuser $dupe platform]
  set typen [string tolower $typen]

    if {[string first $awho $typen] != "-1"} {
   
    incr jx 1

       if {$jx < 10} {
       putserv "PRIVMSG $channel : \[ $logo \] $typen"
       }
   }
}    
  putserv "PRIVMSG $channel : \[ $logo \] $jx found "
}

 

proc ts_help {nick host hand channel arg} {

  global logo

  putserv "PRIVMSG $nick : \[ $logo \] !showaffils affil (shows sites with affil as an    affil)"
  putserv "PRIVMSG $nick : \[ $logo \] !addsite ex Example_Site (add a site)"
  putserv "PRIVMSG $nick : \[ $logo \] !delsite ex (delete a site)"
  putserv "PRIVMSG $nick : \[ $logo \] !name ex Example_Site (rename a site)"
  putserv "PRIVMSG $nick : \[ $logo \] !link ex OC3 (set site link)"
  putserv "PRIVMSG $nick : \[ $logo \] !platforms ex ISO VCD MP3 (set site platforms)"
  putserv "PRIVMSG $nick : \[ $logo \] !affils ex razoriso risciso (set affils for a  site)"
  putserv "PRIVMSG $nick : \[ $logo \] !status ex working (set site status)"
  putserv "PRIVMSG $nick : \[ $logo \] !gadmin ex that1guy (set site gadmin)"
  putserv "PRIVMSG $nick : \[ $logo \] !slots ex 4 wWyZ (set site slots)"
  putserv "PRIVMSG $nick : \[ $logo \] !site ex (display site info)"
  putserv "PRIVMSG $nick : \[ $logo \] !sites (displays a brief list of all sites)"
  putserv "PRIVMSG $nick : \[ $logo \] !list (shows a detail list of sites)"
  putserv "PRIVMSG $nick : \[ $logo \] The End...."

}
Last edited by rb201 on Fri Aug 26, 2005 11:06 pm, edited 1 time in total.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

"been unable to get this to work" doesn't mean anything to us; describe your problem(s) in details

and fix the format your code is posted in, after reading carefully this forum's top sticky thread
r
rb201

Post by rb201 »

Sorry for the confusing code formatting, I am not an expert at this. The error the bot gives is :
TCL error [ts_addsite]: wrong # args: should be "set varName ?newValue?"

bot responds with that error when "!addsite testsite" is used in channel

All I can figure is that I am not calling the procedure with the correct commands to control the userfile.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

reading and proceeding according the top post of this forum doesn't require expert efforts - just do it (in case you haven't noticed, you can edit your posts)
Locked