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 

Questions and more questions.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Thu Nov 01, 2007 9:45 am    Post subject: Questions and more questions. Reply with quote

Hi there,

I wanna ask is -exact of lsearch case sensitive? If it is, what option should I choose not to have the case sensitivity. Thank you.

I also got question regarding the file operation. If I wanted to update the file with the data from variable call "$data" which is a list. What should I do if I want to skip the first few line of the file from been overwrite. Thank you.

Regards,
Lu5ck
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Thu Nov 01, 2007 10:05 am    Post subject: Re: Questions and more questions. Reply with quote

If you have questions about particular commands, check the manual. There's no -nocase option in the latest stable release, so your best bet is to do a case insensitive regexp match
Code:
lsearch -regexp $list {(?i)yourword}
or convert everything to lower-/uppercase before doing the search.
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Nov 01, 2007 10:07 am    Post subject: Reply with quote

It is case sensitive, and unfortunately, there is no documented option to make it non-case sensitive.

Make sure you open the file in append-mode, such that it is not truncated and the write pointer is at the end of the file. Ex:
Code:
set fid [open "myfile" "WRONLY CREAT APPEND"]

See the manual page for open other options.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Mon Nov 05, 2007 10:01 am    Post subject: Reply with quote

Hi there,

Thanks. I want to ask about "bind time * <function>" as well. If I indicate it as *, how often will the function be run?

Regards,
Lu5ck
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Nov 05, 2007 10:04 am    Post subject: Reply with quote

Once every minute
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Mon Nov 05, 2007 10:08 am    Post subject: Reply with quote

Hi there,

Thanks.

Regard,
Lu5ck
Back to top
View user's profile Send private message
Lu5ck
Halfop


Joined: 07 Dec 2006
Posts: 43

PostPosted: Sat Nov 10, 2007 9:00 am    Post subject: String map Reply with quote

Hi there,

I got question about "string map" command. I don't know how it work, the documentation is confusing for me. I assume that you can have many replacement in string map right? But I still kinda confused.

Regards,
Lu5ck
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Nov 10, 2007 11:16 am    Post subject: Reply with quote

It can indeed handle multiple replacements at once.
In order to achieve this, create a list with odd numbered elements being the key to look for, and even elements being what to replace it with. Order is of importance in some cases, as string map will scan the list and stop at the first match (ai needs to come before a, otherwize a will always make the match).
A simple example of a "map":
Code:
set map [list "oldword1" "newword1" "oldword2" "oldword2" ...]

set map [list "aibo" "cool dog" "ai" "artificial intelligence" "a" "the letter a"]

You could also build this map using arrays and "array get", however, keep in mind that the order is not fixed when using "array get".
Code:
set mymap(oldword1) "newword1"
set mymap(oldword2) "newword2"
set map [array get mymap]

_________________
NML_375, idling at #eggdrop@IrcNET
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 -> Scripting Help 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