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 

read from a file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
ircaddict
Voice


Joined: 03 Mar 2012
Posts: 1

PostPosted: Sat Mar 03, 2012 8:05 pm    Post subject: read from a file Reply with quote

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
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Wed Jan 30, 2013 8:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Jan 30, 2013 3:00 pm    Post subject: Reply with quote

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. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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