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.

Qoutes...kind of !

Old posts that have not been replied to for several years.
Locked
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Qoutes...kind of !

Post by Pitchat »

Hi
i wonder if it is possible to make a command available in dcc like .something (text) and have it store in a txt file in the format

date-text-bywhom

so it will lokk like that

in dcc : .something this is a test

in the text file

11-05-2003 : this is a test : set by user

thanks for ideas

Pitchat
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Yes it is possible. Have a text file with each line in the format:

unixtime username text

The reason is that unixtime and username are guaranteed to be only one word, whereas text may be several words with any character. This way it's easier to parse the data.

Anyway, have your script read in each line and search for whatever the user typed, displaying any matches.

If you have any more specific questions as your script progresses, feel free to ask.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

sure i have questions lol

i try almost all quotes scripts available and i must admit i am lost so if you can get me started in the right direction it will be appreciate
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

set bla(file) "bla.txt"

bind dcc - bla dcc:bla

proc dcc:bla {hand idx text} {
if {![file exists $::bla(file)]} {
putdcc $idx "Error: $::bla(file) dose not exist."
return 0
}
set file [open "$::bla(file)" r]
while {![eof $file]} {
set line [gets $file]
if {[string match [lrange [split $text] 1 end] $line]} {
putdcc $idx "Topic already exists."
return 0
}
}
catch {close $file}
set file [open "$::bla(file)" a]
puts $file "[unixtime] [lrange [split $text] 1 end] $hand"
putdcc $idx "New topic added: [lrange [split $text] 1 end]"
catch {close $file}
}
I haven't tested it cos I don't have where (ATM) cos I'm @ school :)
Once the game is over, the king and the pawn go back in the same box.
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

Post by Pitchat »

it seems to work but not the way i want ;)

[12:45] (Pitchat): .potin test
[12:45] (Precieuse): Topic already exists.

it is not for a topic purpose it is more of a reminder thing so it doesnt add the infos in the txt file.


ideas ?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Replace from:

Code: Select all

if {[string match [lrange [split $text] 1 end] $line]} { 
to:

Code: Select all

if {[string match [lrange [split $text] 0 end] $line]} { 
and from:

Code: Select all

puts $file "[unixtime] [lrange [split $text] 1 end] $hand" 
putdcc $idx "New topic added: [lrange [split $text] 1 end]" 
to:

Code: Select all

puts $file "[unixtime] [lrange [split $text] 0 end] $hand" 
putdcc $idx "New topic added: [lrange [split $text] 0 end]" 
and should be working..
Once the game is over, the king and the pawn go back in the same box.
Locked