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.

some help to write a simple script

Old posts that have not been replied to for several years.
Locked
s
skuttR

some help to write a simple script

Post by skuttR »

can someone help me write a script that uses a txt file or mysql database. I will that the bot should write out the latest post from a database or a txt file into the channel. I hace search on the net but i did't found something.
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

How's the txt file?
Do you want it in a public command like "!showlast", or in a timer?
:)
Xpert.
User avatar
Rusher2K
Halfop
Posts: 88
Joined: Fri Apr 18, 2003 10:45 am
Location: Germany
Contact:

Post by Rusher2K »

Here an example to read/write a file

Code: Select all

## reading:
set filesocket [open "your filename" r]; # open the file
set data(0) [gets $filesocket]; # read line1
set data(1) [gets $filesocket]; # read line2
close $filesocket; # close the file

# writing or appending 
if {![file exists "your filename"]} then { ; # check for file exist
    set fs [open "your filename" w]
} else {
    set fs [open "your filename" a]
}
puts $fs "your data"
close $fs 
Locked