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 

how do i make files

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Wed Aug 09, 2006 5:27 pm    Post subject: how do i make files Reply with quote

im trying to make a script when someone does
!add <game> <code>
it writes
the persons name and code and the game they added
like
[$nick]
<game>
<code>
like that
Back to top
View user's profile Send private message Send e-mail
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Wed Aug 09, 2006 5:36 pm    Post subject: Reply with quote

That sould do it I hope:
Code:
set gamefile "scripts/game.txt"
if {![file exists $gamefile]} {
   catch {close [open $gamefile w]}
}
bind pub - !add pub:add
proc pub:add {nick uhost hand chan arg} {
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
 if {$game != "" && $code != ""} {
  set fd [open $::gamefile r+]
    while {![eof $fd]} {
     lappend list [gets $fd]
    }
    if {[lindex $list end] == ""} {
      set list [lreplace $list end end]
    }
     lappend list "\[$nick\] <$game> <$code>"
     seek $fd 0
     puts -nonewline $fd [join $list \n]
     close $fd
 } else {
   putserv "PRIVMSG $nick :Usage: !add <game> <code>"
 }
}


Last edited by darton on Sun Aug 13, 2006 5:46 pm; edited 2 times in total
Back to top
View user's profile Send private message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Wed Aug 09, 2006 6:14 pm    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message Send e-mail
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Wed Aug 09, 2006 6:53 pm    Post subject: Reply with quote

Code:

##########################################################
#Friendcodes IRC script written by monie                 #
#email monie <xg.monie089@gmail.com>                     #
#monie @ Friendcodes #NintendoXG,#IRCsupport,#Friendcodes#
##########################################################
bind pub -|- !friendcodes pub:friendcodes

proc pub:friendcodes {nickname hostname handle channel arguments } {
putquick "PRIVMSG $nickname :$nickname Welcome ShadowBot Wifi Central"
putquick "PRIVMSG $nickname :$nickname,To use WiFi Central"
putquick "PRIVMSG $nickname :Games currently supported are"
putquick "PRIVMSG $nickname :MKDS,MPH,LM,THAS,DSAIR,StarFox"
putquick "PRIVMSG $nickname :Type !add <game> <code> "
putquick "PRIVMSG $nickname :To find a friendcode type"
putquick "PRIVMSG $nickname :!find <nick>"
putquick "PRIVMSG $nickname :To Delete Your code type"
putquick "PRIVMSG $nickname :!del <game>"
putquick "PRIVMSG $nickname :Scripted by MÔnie"
}
set gamefile "scripts/game.txt"
if {![file exists $gamefile]} {
   catch {close [open $gamefile w]}
}
bind pub - !add pub:add
proc pub:add {nick uhost hand chan arg} {
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
 if {$game && $code != ""} {
  set fd [open $::gamefile r+]
      while {![eof $fd]} {
         lappend list [gets $fd]         
      }   
   lappend list "[$nick] <$game> <$code>"
    puts -nonewline $fd [join $list \n]
    close $fd   
 } else {
    putserv "PRIVMSG $chan :Usage: !add <game> <code>"
 }
}



putlog "Monies custom Friendcodes script loaded"

thats what i have so far but how do i make it find someones name and displays there code, also how do i do !del if someone wants to delete there code
Back to top
View user's profile Send private message Send e-mail
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Aug 09, 2006 10:13 pm    Post subject: Reply with quote

Moved to: Scripting Help
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Thu Aug 10, 2006 2:27 pm    Post subject: Reply with quote

Code:

##########################################################
#Friendcodes IRC script written by monie                 #
#email monie <xg.monie089@gmail.com>                     #
#monie @ Friendcodes #NintendoXG,#IRCsupport,#Friendcodes#
##########################################################
bind pub -|- !friendcodes pub:friendcodes

proc pub:friendcodes {nickname hostname handle channel arguments } {
putquick "PRIVMSG $nickname :$nickname Welcome ShadowBot Wifi Central"
putquick "PRIVMSG $nickname :$nickname,To use WiFi Central"
putquick "PRIVMSG $nickname :Games currently supported are"
putquick "PRIVMSG $nickname :MKDS,MPH,LM,THAS,acww"
putquick "PRIVMSG $nickname :Type !add <game> <code> "
putquick "PRIVMSG $nickname :To find a friendcode type"
putquick "PRIVMSG $nickname :!find <nick>"
putquick "PRIVMSG $nickname :To Delete Your code type"
putquick "PRIVMSG $nickname :!del <game>"
putquick "PRIVMSG $nickname :Scripted by MÔnie"
}
set gamefile "scripts/game.txt"

if {![file exists $gamefile]} {
   catch {close [open $gamefile w]}
}

bind pub - !add pub:add
proc pub:add { nick uhost hand chan arg} {
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
if {$game && code != ""} {
set fd open $::mphfile r+]
while {![eof $fd]} {
lappend list [gets $fd]
}
lappend list "[$nick] $game $code"
puts -nonewline $fd [join $list \n]
close $fd
} else {
putserv "PRIVMSG $nickname :Usage: !add <game> <code>"
}
}

bind pub - !find pub:find
proc pub:find {nick uhost hand chan arg} {
}




putlog "Monies custom Friendcodes script loaded"

thats the code but the add part doesnt work and for the find part how do i make it do
notice nickname $nicks code are
notice nickname mph:23232323
notice $nickname mkds:232343234
notice $nickname thas:232324323
notice $nickname acww:24334 name:blah town:blah
EDITED
Back to top
View user's profile Send private message Send e-mail
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Thu Aug 10, 2006 8:57 pm    Post subject: Reply with quote

i edited that can anyone help
Back to top
View user's profile Send private message Send e-mail
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Fri Aug 11, 2006 6:59 am    Post subject: Reply with quote

Now it should work. I deleted some mistakes.
Code:
set gamefile "scripts/game.txt"
if {![file exists $gamefile]} {
   catch {close [open $gamefile w]}
}
bind pub - !add pub:add
proc pub:add {nick uhost hand chan arg} {
set game [lindex [split $arg] 0]
set code [lindex [split $arg] 1]
 if {$game != "" && $code != ""} {
  set fd [open $::gamefile r+]
    while {![eof $fd]} {
     lappend list [gets $fd]
    }
    if {[lindex $list end] == ""} {
      set list [lreplace $list end end]
    }
     lappend list "\[$nick\] <$game> <$code>"
     seek $fd 0
     puts -nonewline $fd [join $list \n]
     close $fd
 } else {
   putserv "PRIVMSG $nick :Usage: !add <game> <code>"
 }
}

bind pub - !find find:nick
proc find:nick {nick uhost hand chan arg} {
global gamefile
set name [lindex [split $arg] 0]
 if {$name != ""} {
  set fd [open $::gamefile r]
    while {![eof $fd]} {
     lappend list [gets $fd]
    }
    close $fd
    if {[set le [lsearch -glob $list "*$name*"]] != -1} {
     set line [lindex $list $le]
     set code [string map {< "" > ""} [lindex $line 2]]
     putserv "NOTICE $nick :The code $code belongs to $name."
    } else {
     putserv "NOTICE $nick :Name not found."
    }
 } else {
   putserv "PRIVMSG $nick :Usage: !find <nick>"
 }
}


Last edited by darton on Fri Aug 11, 2006 11:40 am; edited 2 times in total
Back to top
View user's profile Send private message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Fri Aug 11, 2006 8:24 am    Post subject: Reply with quote

everything works but the find it keeps saying name not found
Back to top
View user's profile Send private message Send e-mail
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Fri Aug 11, 2006 10:54 am    Post subject: Reply with quote

Forgot to replace a word.
I've edited my post. Copy it again and it will work. I also improved the !add script.
Back to top
View user's profile Send private message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Fri Aug 11, 2006 11:48 am    Post subject: Reply with quote

Thanks it worked nw thanks for helping me im still learning
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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