| View previous topic :: View next topic |
| Author |
Message |
ircaddict Voice
Joined: 03 Mar 2012 Posts: 1
|
Posted: Sat Mar 03, 2012 8:05 pm Post subject: read from a file |
|
|
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 |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Wed Jan 30, 2013 8:54 am Post subject: |
|
|
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) _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Jan 30, 2013 3:00 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|