This is World Cup 2011, Schedule with only one command
!cricket2011*
!cwc2
!cwc3
!cwc4
!cwc5
!cwc6
!final
on *:TEXT:!cricket2011*:#: {
.msg $nick 4WorLd Cup 2011 CRICKET Match Schedule
.msg $nick 19/2/11 02:30 PM 2India Vs Bangladesh Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 20/2/11 09:30AM 2Kenya Vs New Zealand M.A. Chidambaram Chepauk, Chennai
.msg $nick 20/2/11 02:30PM 3Sri Lanka Vs Canada Hambantota Sooriyawewa, Hambantota District, Southern Provinc
.msg $nick 21/2/11 02:30PM 4Australia Vs Zimbabwe Sardar Patel Stadium Ahmedabad, India
.msg $nick 22/2/11 02:30PM 5England Vs Netherlands Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 23/2/11 02:30PM 4Kenya Vs Pakistan Hambantota Sooriyawewa, Hambantota District, Southern Provinc
.msg $nick 24/2/11 2:30PM 6South Africa Vs West Indies Feroz Shah Kotla New Delhi India
.msg $nick 25/2/11 9:00AM 7Bangladesh Vs Ireland Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 25/2/11 2:30PM 10Australia Vs New Zealand Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 26/2/11 2:30PM4Sri Lanka Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc2
}
on *:TEXT:!cwc2*:#: {
.msg $nick 27/2/11 2:30PM 12India Vs England M Chinnaswamy Stadium Bangalore,India
.msg $nick 28/2/11 9:30AM 13Canada Vs Zimbabwe Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 28/2/11 2:30PM 14Netherlands Vs West Indies Feroz Shah Kotla New Delhi India
.msg $nick 1/3/11 2:30PM 2Sri Lanka Vs Kenya R Premadasa Stadium Colombo,Srilanka
.msg $nick 2/3/11 2:30PM 3England Vs Ireland M Chinnaswamy Stadium Bangalore,India
.msg $nick 3/3/11 9:30AM 4Netherlands Vs South Africa Punjab Cricket Association Stadium Mohali,India
.msg $nick 3/3/11 2:30PM4Canada Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 4/3/11 9:30AM 4New Zealand Vs Zimbabwe Sardar Patel Stadium Ahmedabad, India
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc3
}
on *:TEXT:!cwc3*:#: {
.msg $nick 4/3/11 2:30PM 5Bangladesh Vs West Indies Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 5/3/11 2:30PM 5Sri Lanka Vs Australia R Premadasa Stadium Colombo,Srilanka
.msg $nick 6/3/11 9:30AM 6England Vs South Africa M.A. Chidambaram Chepauk, Chennai
.msg $nick 6/3/11 2:30PM 7India Vs Ireland M Chinnaswamy Stadium Bangalore,India
.msg $nick 7/3/11 2:30PM 10CanadaVs Kenya Feroz Shah Kotla New Delhi India
.msg $nick 8/3/11 2:30PM 4New Zealand Vs Pakistan Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 9/3/11 2:30 PM 12India Vs Netherlands Feroz Shah Kotla New Delhi India
.msg $nick 10/3/11 2:30PM 13Sri Lanka Vs Zimbabwe Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc4
}
on *:TEXT:!cwc4*:#: {
.msg $nick 11/3/11 9:30AM 14Ireland Vs West Indies Punjab Cricket Association Stadium Mohali,India
.msg $nick 11/3/11 2:30PM 2Bangladesh Vs England Zohur Ahmed Chowdhury Stadium Chittagong,Bangladesh
.msg $nick 12/3/11 2:30PM 3India Vs South Africa Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 13/3/11 9:30AM 4Canada Vs New Zealand Wankhede Stadium Mumbai,India
.msg $nick 13/3/11 2:30PM 5Australia Vs Kenya M Chinnaswamy Stadium Bangalore,India
.msg $nick 14/3/11 9:00AM 6Bangladesh Vs Netherlands Zohur Ahmed Chowdhury Stadium Chittagong,Bangladesh
.msg $nick 14/3/11 2:30PM4Pakistan Vs Zimbabwe Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 15/3/11 2:30PM 7Ireland Vs South Africa M Chinnaswamy Stadium Bangalore,India
.msg $nick 16/3/11 2:30PM 10Australia Vs Canada M Chinnaswamy Stadium Bangalore,India
.msg $nick 17/3/11 02:30PM12 England Vs West Indies M.A. Chidambaram Chepauk, Chennai
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc5
}
on *:TEXT:!cwc5*:#: {
.msg $nick 18/3/11 09:30AM13 Ireland Vs Netherlands M Chinnaswamy Stadium Bangalore,India
.msg $nick 18/3/11 02:30PM 14New Zealand Vs Sri Lanka Wankhede Stadium Mumbai,India
.msg $nick 19/3/11 09:30AM 2Bangladesh Vs South Africa Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 19/3/11 02:30PM4Australia Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 20/3/11 09:30AM 3Kenya Vs Zimbabwe M Chinnaswamy Stadium Bangalore,India
.msg $nick 20/3/11 02:30PM 4India Vs West Indies M.A. Chidambaram Chepauk, Chennai
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc6
}
on *:TEXT:!cwc6*:#: {
.msg $nick 23/3/11 02:30PM q1 3TBC Vs TBC Sardar Patel Stadium Ahmedabad, India
.msg $nick 24/3/11 02:30PM q2 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 25/3/11 02:30PM q3 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 26/3/11 02:30PM q4 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 0,10 If YOu Wana Watch FinaL ScheduLe Then Type On Main this -> !Final
}
on *:TEXT:!final*:#: {
.msg $nick 0,1 29/3/11 02:30PM semi1 TBC Vs TBC R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,1 30/3/11 02:30PM semi2 TBC Vs TBC R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,1 2/4/11 02:30PM final TBC Vs TBC Wankhede Stadium Mumbai,India
.msg $nick 11 -----------------
Linuxuser, you need to be aware of that your regex will trigger if you enter, say, 93. You need to make sure it ends at the single digit number 9 by adding the dollar sign at the end:
/(cricket2011|cwc[0-9])$/i
and you may want to make it case insensitive so it will recognize the cricket2011 command if a user enters it with one uppercase letter in it. Regex by design is case sensitive until you specify the /i modifier or (?i) switch. While you can get away without using the delimiters / / at both ends, it's a best practice that you do when dealing with regex. You can incorporate the regex into the match-text section of the text event and then add the $ prefix to indicate that it's a regex match. You can also add the /S modifier to it to strip control codes. This modifier is designed for mIRC only and not a standard one in regex.
linuxuser
The data in this snippet has the life expectancy of a gnat. Why rewrite it with yet another version that mixes the data with the code? Altho your regex is fine, there is yet a better way to implement it in this snippet. Also, it could be shortened alot by setting a 'cricket alias' to eliminate all the halts and other redundancies.
on :TEXT:!:#:{
if ($regex($1,(cricket2011|cwc[0-9])) {
goto $regml(1)
:cricket2011
.msg $nick 4WorLd Cup 2011 CRICKET Match Schedule
.msg $nick 19/2/11 02:30 PM 2India Vs Bangladesh Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 20/2/11 09:30AM 2Kenya Vs New Zealand M.A. Chidambaram Chepauk, Chennai
.msg $nick 20/2/11 02:30PM 3Sri Lanka Vs Canada Hambantota Sooriyawewa, Hambantota District, Southern Provinc
.msg $nick 21/2/11 02:30PM 4Australia Vs Zimbabwe Sardar Patel Stadium Ahmedabad, India
.msg $nick 22/2/11 02:30PM 5England Vs Netherlands Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 23/2/11 02:30PM 4Kenya Vs Pakistan Hambantota Sooriyawewa, Hambantota District, Southern Provinc
.msg $nick 24/2/11 2:30PM 6South Africa Vs West Indies Feroz Shah Kotla New Delhi India
.msg $nick 25/2/11 9:00AM 7Bangladesh Vs Ireland Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 25/2/11 2:30PM 10Australia Vs New Zealand Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 26/2/11 2:30PM4Sri Lanka Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc2
.halt
:cwc2
.msg $nick 27/2/11 2:30PM 12India Vs England M Chinnaswamy Stadium Bangalore,India
.msg $nick 28/2/11 9:30AM 13Canada Vs Zimbabwe Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 28/2/11 2:30PM 14Netherlands Vs West Indies Feroz Shah Kotla New Delhi India
.msg $nick 1/3/11 2:30PM 2Sri Lanka Vs Kenya R Premadasa Stadium Colombo,Srilanka
.msg $nick 2/3/11 2:30PM 3England Vs Ireland M Chinnaswamy Stadium Bangalore,India
.msg $nick 3/3/11 9:30AM 4Netherlands Vs South Africa Punjab Cricket Association Stadium Mohali,India
.msg $nick 3/3/11 2:30PM4Canada Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 4/3/11 9:30AM 4New Zealand Vs Zimbabwe Sardar Patel Stadium Ahmedabad, India
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc3
.halt
:cwc3
.msg $nick 4/3/11 2:30PM 5Bangladesh Vs West Indies Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 5/3/11 2:30PM 5Sri Lanka Vs Australia R Premadasa Stadium Colombo,Srilanka
.msg $nick 6/3/11 9:30AM 6England Vs South Africa M.A. Chidambaram Chepauk, Chennai
.msg $nick 6/3/11 2:30PM 7India Vs Ireland M Chinnaswamy Stadium Bangalore,India
.msg $nick 7/3/11 2:30PM 10CanadaVs Kenya Feroz Shah Kotla New Delhi India
.msg $nick 8/3/11 2:30PM 4New Zealand Vs Pakistan Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 9/3/11 2:30 PM 12India Vs Netherlands Feroz Shah Kotla New Delhi India
.msg $nick 10/3/11 2:30PM 13Sri Lanka Vs Zimbabwe Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc4
.halt
:cwc4
.msg $nick 11/3/11 9:30AM 14Ireland Vs West Indies Punjab Cricket Association Stadium Mohali,India
.msg $nick 11/3/11 2:30PM 2Bangladesh Vs England Zohur Ahmed Chowdhury Stadium Chittagong,Bangladesh
.msg $nick 12/3/11 2:30PM 3India Vs South Africa Vidarbha Cricket Association Stadium Jamtha, Nagpur
.msg $nick 13/3/11 9:30AM 4Canada Vs New Zealand Wankhede Stadium Mumbai,India
.msg $nick 13/3/11 2:30PM 5Australia Vs Kenya M Chinnaswamy Stadium Bangalore,India
.msg $nick 14/3/11 9:00AM 6Bangladesh Vs Netherlands Zohur Ahmed Chowdhury Stadium Chittagong,Bangladesh
.msg $nick 14/3/11 2:30PM4Pakistan Vs Zimbabwe Pallekele International Cricket Stadium Kandy,Srilanka
.msg $nick 15/3/11 2:30PM 7Ireland Vs South Africa M Chinnaswamy Stadium Bangalore,India
.msg $nick 16/3/11 2:30PM 10Australia Vs Canada M Chinnaswamy Stadium Bangalore,India
.msg $nick 17/3/11 02:30PM12 England Vs West Indies M.A. Chidambaram Chepauk, Chennai
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc5
.halt
:cwc5
.msg $nick 18/3/11 09:30AM13 Ireland Vs Netherlands M Chinnaswamy Stadium Bangalore,India
.msg $nick 18/3/11 02:30PM 14New Zealand Vs Sri Lanka Wankhede Stadium Mumbai,India
.msg $nick 19/3/11 09:30AM 2Bangladesh Vs South Africa Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 19/3/11 02:30PM4Australia Vs Pakistan R Premadasa Stadium Colombo,Srilanka
.msg $nick 20/3/11 09:30AM 3Kenya Vs Zimbabwe M Chinnaswamy Stadium Bangalore,India
.msg $nick 20/3/11 02:30PM 4India Vs West Indies M.A. Chidambaram Chepauk, Chennai
.msg $nick 0,10 If U Wana See More Match Schedule Then TYPE on Main this -> !Cwc6
.halt
:cwc6
.msg $nick 23/3/11 02:30PM q1 3TBC Vs TBC Sardar Patel Stadium Ahmedabad, India
.msg $nick 24/3/11 02:30PM q2 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 25/3/11 02:30PM q3 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 26/3/11 02:30PM q4 3TBC Vs TBC Shere Bangla National Stadium Mirpur Thana, Dhaka
.msg $nick 0,10 If YOu Wana Watch FinaL ScheduLe Then Type On Main this -> !Final
.halt
:final
.msg $nick 0,1 29/3/11 02:30PM semi1 TBC Vs TBC R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,1 30/3/11 02:30PM semi2 TBC Vs TBC R Premadasa Stadium Colombo,Srilanka
.msg $nick 0,1 2/4/11 02:30PM final TBC Vs TBC Wankhede Stadium Mumbai,India
.msg $nick 11 -----------------
.halt
}
}
simple regex combining all the on texts into one plus adding a goto command instaed of lots of if-then-elses and later i may consider doing a socket version to collect active data instead of static.
halt commands stop flooding or errors in the goto command
in future use /notice as it doesn't block up a pm box and posts to the active window instead of the user manually trying to find the pm box.
overall your script is nice just need to practice using regex to reduce the code or even start looking at examples of sockets and practicing using them in conjuction with regex to get the most simple but efficient code whilst still getting active full data.
I didn't start by making one text event per routine. Good thing I was taught to use if-then-elseif-else when I first discovered MSL. I suppose I was lucky to meet many great msl coders whom I have learned a lot from.
These days I've seen many people mislead other beginners into writing a code that they think is the right way, but in actuality they wind up making the code more redundant and inefficient. We have to learn to distinguish between the good and bad codes, which beginners are often clueless. It's also unfortunate to hurt others' feelings when you pinpoint their code with either constructive criticism or else. Some perceive your input negatively...whether your intention is positive.
In closing, I don't claim myself as the best there is, and I still have lots to learn.
If this is an ever changing sporting event schedule then sockets may be best. Then the command could be simply "!cricket" every year. At any rate, I wouldn't want data hard-coded in with code at least store it in an ini file and read from there and next year easier to edit. Unless of course you don't plan to be around next year in which case, "carry on!"
My style would be to use a socket for this if I were you, but that's just me.
You should consider putting all the schedule info in a text file and play it to the nick who triggers it. This can be done with the /play command with the -t switch. The -t switch will prompt the accordant topics to play. One nice thing is, the play command comes with one second delay so you don't send out all the messages in one shot to appear flood-like.