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.

read from a file

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
i
ircaddict
Voice
Posts: 1
Joined: Sat Mar 03, 2012 12:00 pm

read from a file

Post by ircaddict »

Hello,
I have some problems with reading from a file and then output that read into a channel, so thing is like this I wrote a script which stores some data into a txt file in this way:
order *here goes order*
nick *nick who set orders*
time *time when orders were set*
day *day when orders were set*
and so on
so now part that I can`t figure out is:
I would like that when someone writes .order on channel bot would open up txt file and search for word in it (obviusly order) and then output everything thats behind behind that word, for .ordersby output would be nick who set orders so bot would have to open the file find word nick and output everything behind that word... and so on.
One more thing I need help with is time and date:
lets say that my day 1 started on 1/1/2012 @ 8h local computer time, now I would like to see my date and time to be:
day 64
time 13:03
Thx in advance with any help
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

You should try make the script using array it would be much easier for you to read the information and display it anywhere you want in any form you want. If you are still interested in this script i can guide you creating the script, if so reply to this topic and we will get started when i am around and have time.

NOTE: I don`t use files like that to store data. I only use array to store data's into the eggdrop . Much easier (for me)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Or even better, if you can save that file in a json format is then very easy to parse it and get what results you wish from it.

Also, instead of an array you can use a dictionary (dict) to store stuff in. you can even convert dict to json and vice-verse. :)
Once the game is over, the king and the pawn go back in the same box.
Post Reply