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 

string match spanish accents

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


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun May 10, 2015 8:16 am    Post subject: string match spanish accents Reply with quote

Code:

bind pubm - * who_emit
proc who_emit {nick uhost hand chan text} {
global dj
if {($text eq "Quien esta emitiendo?") || ([string match "Quien está emitiendo?" $text]) {
putmsg $chan "Emite Dj $dj"
}}

Not match the second condition for the accent "á"
Quote:
<user> Quien esta emitiendo?
<bot> Emite Dj Roger
<user> Quien está emitiendo?


Besides accents, you can be fixed to coincide with additional question marks?
ie:
Quien está emitiendo??
or
Quien está emitiendo?????
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat May 16, 2015 1:56 am    Post subject: Reply with quote

I have fixed thanks to SpiKe^^

Code:
proc who_emit {nick uhost hand chan text} {
global radiocanal nombreradio counf
   if {$chan != "$radiocanal"} {return 0}
set who1 "Quien emite?"
set who2 "Quien está emitiendo?"
set who3 "Quien esta de dj?"
set whof "?"
if {(([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who1] 0 end]] != -1) && ([llength [split $text]] == 2) \
&& ([string index $text end] == "$whof")) \
|| (([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who2] 0 end]] != -1) && ([llength [split $text]] == 3) \
&& ([string index $text end] == "$whof")) \
|| (([lsearch -exact -ascii -nocase [lindex [split $text] 0 end] [lindex [split $who3] 0 end]] != -1) && ([llength [split $text]] == 4) && ([string index $text end] == "$whof")) } {
   if {[file exists dj]} {
    set temp [open "dj" r]
    set dj [gets $temp]
   set dj [lindex $dj 0]
    close $temp
   }
putmsg $chan [encoding convertfrom utf-8 "Our current DJ is $dj"}
}


The code is not case sensitive:
Code:
-nocase

I added a counter along the string, so I did not take as correct portions thereof:
Code:
[llength [split $text]] ==

I also added that work if the text has a question mark at the end, not to take any text expression but leads that sign.
Code:
set whof "?"

To make the text matched with Spanish accents, I used:
Code:
-ascii

In this example, the current DJ database is:
Code:
[file exists dj]

_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
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