Typocommented on mIRC Snippet: auto away
-
Jul 29, 2008
I was just thinking you might want to use On Start instead of On Text. You can just have a timer periodically do the check and that way your not counting on text being typed.
Theres no reason to use two variables for the away time. Just setting one should be enough. For instance:
Code
and then if you need the minutes later you could $calc(%atime / 60) to get it or you could reverse the whole idea and just set %atime to the actual minutes and $calc(%atime * 60) where you need it. Setting it into another variable would make sense if you needed it more than once but thats not the case here.
The other thing and probably the biggest issue is the fact that you never actually set the user away. You should be using mircs /away command to actually set them away or the "away" in "auto away" is sort of missleading.
Besides, using /away would also allow you to use the $away variable to track if the user is away or not instead of making a %away variable.
Type
Code
and
Code
in mirc for more information on the command and identifier.
I will do my best to just ignore the fact that your technically dogging on every script I have released by attacking my style of coding which nobody else seems to have a problem with, tho I do wonder why you single me out with so many better examples of sloppy coding spread throughout hawkee.
Atleast take a minute and explain why you say the byte count is off.
I have asked over and over for you to explain why you say its wrong but you won't.
I will give new examples as to why my method is correct because apparently the examples above werent enough. First off. You keep saying the byte count is wrong but windows and mirc seem to agree with me. I used windows and notepad for my examples before so I will try different methods this time.
New example one:
Type the following in any window and it will show you that 2 characters dont always mean 2 bytes. You have to consider the carriage return.
Code
It writes the letter A to the first line in a new file called tempbytes.temp and then writes the letter B in the second line. After that it echos the size of the file we just made to the active window and then it deletes the file.
In the Write commands the -c parameter clears the file first if it exists and the -n parameter stops it from adding a $crlf to the end of the added line. (Without the -n a new line is started so the file size would be 6 bytes and not 4).
New example two:
Use alt+r in mirc to open the script editor in the remotes tab. After ensuring you are in the remote tab goto File and then select New. This will start a new remote file and the name of it will be visible in the lower left corner and is usually something like script1.mrc. Write two lines of one letter each and then hit ok to save and close it but be sure you remember the file name or write it down. Now just type
Code
Where scriptfile.mrc would be replaced with the new script file you made. For me the line was "//echo -a $file(script4.mrc).size".
You will see the file is 6 bytes. This is because mirc, like the write command, automatically adds the carriage return at the end of the last line so the next line exists to recieve text so its adding a blank line to the end of the file.
The script also uses the $file().size method to get the size of the code so the repeated statements of innacurate byte count still confuse me.
See, the point of my script is to compare codes which it does very well and if I counted the byte size differently I dont think it would be considered accurate by anybody except Lindrian. Why should I have my reported codes size not match the actual file size it will be when its saved in any program whether it be notepad or in mirc or whatever else? I wouldnt consider those real world results.
BTW: I never said I didnt need a lesson in regex, infact Ive repeatedly said in several posts that Im trying to learn it and before this whole mess I was actually trying to remember who had offered me regex help on some server if I went (it was u I remember now obv) but I couldnt remember who.
Thanks jonsey, thats one of the bad habbits I have that I was talking about above, its fixed now. I noticed another == 0 and two more != $nulls that I got rid of too.
I just wish I could have got the regex to work for me for the right bracket check. I ended up using the method in my code because no matter what I did I couldnt get the right bracker search regex I came uo with catch the second } in } } but it caugth it EVERYWHERE else I needed it to. Thats the one part of this code I do personally think could be better. Dont get me wrong, it works just fine, its just if I had nailed the regex the code would be a few lines smaller.
Anyhow, thanks for the comment. I really need to break myself of that habbit and I think I finally will.
*edit*
On a closer look I found quite a few more if $v1 == $null or != $null or == 0 that I also fixed. Told ya it was a bad habbit. Those must be the horribly messy coding that Lindrian was talking about. Im just a horrible person I know. Lol :P
*edit*
No kidding, Imagine if I couldnt have fixed the regex on my own or if he had actually been right about the file size issue. If either of those were true I would STILL be waiting for the information I needed to fix it.
Lol at your newest edit of your last comment, You think you actually tried to help me? You never once did anything but say stuff is wrong. Not once did you explain why its wrong, how its wrong or how to fix it.
I love how you still cannot even try and explain yourself.
How is the file size wrong?
How is the file size example wrong because if the file size is than it must be too?
I didnt say I knew anything. All I wanted from you was an explanation of your own comments and you cant even manage to backup your own words.
You made a comment on my regex without even giving me an example of what I should have used and I immediately responded with updated code that fixes it even tho I forgot to update the script with it and even if you didnt know what I was trying to do I made a response to you with the new code that detailed what I was trying to do and your too stupid to even read it. You made the same regex comment today which makes it obvious you didnt read a single thing in my replies to you.
Also, you called my code messy and wont back that up either.
I would have deleted the comment too if I had made it, you looked like an idiot.
To everyone else: By this pooint I have hopefully made it clear that Lindrians comments were made in error. I have given him muliple chances to explain himself and he basically refuses.
The file size is fine, the script is fine. The problems all lye within lindrian and his inability to backup anything he says.
This whole thing started with a comment from him that said
Quote
ok, im not sure how ur calculating those bytes, but its definitely wrong.
And your regexes are totally messed up aswell, /[^(?:^$)]/ means "match the following literals: ^(:?$) (and the ^ is even duplicate - I really doubt this is what you're trying to do).
And he was right about the regex, which is fixed, even tho the script was still working fine but what strikes me is the statement "ok, im not sure how ur calculating those bytes, but its definitely wrong.". Does it really take that much effort or expertise to look at the code and see I'm using mircs own $file().size? I would think that someone qualified to call my coding messy would be able to figure out how I was calculating the file size.
I'm done now.
If anyone cares to see it here is the comment Lindrian deleted after making.
Quote
Byte are not counted like that typo. Each character is one byte, trailing and leading spaces are not accounted for.
And that regex would match anything but (, ?, :, ^, $, ) - is that what you're trying to do?
I mean not offense at all, but your code (coding style?) feels quite messy, if you want, I can teach you some 'better' coding (im not trying to brag, really) and how to properly master regex. If you're up for it, I'll be at: irc.deltaanime.net @ #Lindrian
Also in the future dont forget about the forums. Theyre a great place to get help perfecting a script before you release it or to just get some simple advice to help you with your code.
Updated with the regex line I meant to change a few days ago. Even tho the old regex wasnt right it still worked right for some reason so this doesnt really affect functionality but it is definately a recommened update.
If bytes are not counted like that then why is it that my following example is valid? And BTW, who the hell was talking about spaces at all? Trailing or leading spaces have nothing to do with anything Ive talked about yet. Its the carriage returns.
Do you even know how to read a response to your own comment?
Quote
For instance, weve all been taught that a single character is one byte so the following:
Code
would look like it should be 2 bytes but we would be forgetting the 2 bytes for the carriage return needed to start the second line.
If you start a new file and save it with the above lines you will see when looking at the file properties that it is 4 bytes and not 2.
Did you even try that?
You can say all day long that file sizes dont work that way but your wrong. Its simple, start a new file, make two lines of one character each and save it, check the file size in windows and by using $file().size as well. It will never equal 2 bytes even tho its two characters.
The script just compares 2 codes anyway, I could theoretically account for the carriage returns and take it out of the file size so it compares actual used characters but then nothing would match actual file sizes and I see no point in that.
Now on to the regex. You know I am learning regex and in the comment I made to you in this thread I mentioned that I realized you were right about the regex and came up with a fix and told you what it was that I was trying to do.
To negate a character group (meaning "anything but"), use a ^ character.
Also remember that you still have to escape special characters inside a character group. People tend to forget that for some reason.
$regex(abcdefg,/[^a-e]/g) -- Returns 2 because 2 letters (f and g) satisfied the character group of "anything but a-e"
Im sure you get what I was trying to do now but Im guessing by your comment that my method is wrong so Ill look into changing it with another method or a better regex right now. Off the top of my head I think just using /(^(?!$))/ should be fine but I need to make positive first .
I thought I had upgraded the code to the regex I mentioned in the above quote which was addressed to you but apparently I didnt so I will do so now. The new regex is /(^(?!$))/ and it seems to work great for me. I even did a test using /filter with -x to make it send the non matching lines and it did kick back the blanks.
Had you actually read what I typed in response to you instead of making the rude comment above you could have just mentioned that I needed to do the update I forgot to do so and if the new regex is actually wrong than you definately could have caught that too and since I went into detail to you what I was trying you actually could have helped me without inviting me to your network again.
Quote
I mean not offense at all, but your code (coding style?) feels quite messy, if you want, I can teach you some 'better' coding (im not trying to brag, really) and how to properly master regex. If you're up for it, I'll be at: irc.deltaanime.net @ #Lindrian
Who the hell would not take offense to that?
I want to know what about my coding style is messy, sure Im learning regex and your better than me at it but what about my coding exactly is it that you find messy?
Sure I use the if $1 == $null instead of if $1 and a couple other things like that that I consider bad habbits but compared to most my code is damn clean and easy to follow.
I decline the invitation to your network but I do reccomend in the future that you keep your posts less opinion and more factual.
Why tell someone somethings wrong and not why or how to fix it. Why say a file size is wrong when you dont even look at the code to see that its $file().size thats getting the size so it has to be right. Why for the second time dong on my regex without reading my response to you and helping me actually fix it. And btw, helping here is much more appropriate than making people come to your network.
Ok, Im going to give you a hand.
First: Get rid of the halts and use another else to make it so we dont need them.
Second: Change
Code
into
Code
since its all thats needed there.
Third: We need to get the commands each on its own line so its easier to figure out problems when they occur.
Fourth: Get rid of the settings that you dont neet and btw in the future you should use /var in situations like these so it unsets itself when the script is done.
Fifth: Fix the ban command to do the kick
Sixth: Use a $iif to add the reason to the end of the message if it exists instead of using a whole seperate else section.
Lastly: Get rid of the /'s since they arent needed inside scripts.
So your code before was:
Code
And after all the fixes its:
Code
That should fix all your problems.
I included your original code above the new code so you could easily compare them. Take a few minutes to see exactly what I did and learn from it.
Something else I forgot to mention. Using On *:Dialog:KillKline:*:*: really seams like a good idea but in reality it isnt. The reason is the fact that the dialog event covers mouse movements so any time the mouse is moved over any pixel in the dialog it triggers an event. This normally is no big deal when we dont monitor it but using your on dialog event you are and it actually has to process 6 lines before it knows it doesnt need to do anything.
To see what I mean you can try one of two things, either open the task manager in windows and have a look at the mirc.exe cpu usage and see what its at then open your dialog and move the mouse around on it and youll see this actually impacts the CPU. Depending on the pc will have a lot to do with the % but for me it seems to be about 3-10 percent because Im on a laptop. The other way to really visually see how much information this is would me to go ahead and make a little test by adding a new line at the top of your dialog event to echo every line to a window or the status window. IF you do that Im sure youll be amazed at the amount of events that fly by wjen you move your mouse.
Anyhow I just thought I should let you know. This is the one case where I actually think that multile events are better than one.
Lmao, you totally asked for that. Nice script man, I really like the idea as you know. I was thinking it would be cool if you also added a channel menu shortcut to start it. A lot of people dont like using command lines because of the fact that they forget the commands and their just not convenient.
I will now remove most the comments from Dragonflare as not even one of them is about my script. In fact in total there is currently 16 posts since dragonflares first post and not a one of them is about my script so either my script REALLY REALLY blows or somethings wrong here.
DragonFlare, to use the PM system here click on the word inbox from above by the red "MY". That will take you to your inbox where u can also click on "new post" to send a message to anyone on hawkee.
Also, DragonFlare, STOP SENDING MESSAGE AFTER MESSAGE AFTER MESSAGE!!!
This crap is getting old and fast. All the sudden every new user on here thinks they will be so cool with a high comment count so they post a ton of single word messages and its bs. They added the ability to edit comments for a reason, there is simply no excuse for four messgaes in a row all one to two words long. Its SPAM and its childish and mostly its damn annoying and btw nobody cares at all if your comment count is low or high. Its the kind of comments you make that matter.
The new regex I came up with while writing the above comment seems to be exactly what I needed so I am editing the code now with it now.
I also re-checked the file size being reported and once again it seems to be fine.
Don't forget Lindrian, and everyone else, that every time you use a cariage return it uses 2 bytes so even tho I already filter the blank lines it will seem as if its missreporting at times when its actually right.
For instance, weve all been taught that a single character is one byte so the following:
Quote
A
B
would look like it should be 2 bytes but we would be forgetting the 2 bytes for the carriage return needed to start the second line.
If you start a new file and save it with the above lines you will see when looking at the file properties that it is 4 bytes and not 2.
If thats the reason you said my reported file sizes were wrong than I understand the mistake as it threw me thru a loop for a lil bit too when making this. If not tho I would really like to know the problem so I can remedy it. Anybody who looks at this script is just going to see your comment and assume my script is broke and Im pretty sure it isnt.
As far as the byte count goes it matches up with the file size reported in windows every time when I was testing it. It uses the $file().size to return the byes in the file where the filtered text was sent.
I tested this with files between a byte in size and up almost 24 megs so I would appreciate more information on how a $file().size could be reporting improper file sizes.
Now to the regex. In the tutorials I use it says that to negate something you put it in [] with a ^ before it. So, the line /[^(?:^$)]/ is simply supposed to catch anything except for a blank line when used in the filter command like I had it.
To negate a character group (meaning "anything but"), use a ^ character.
Also remember that you still have to escape special characters inside a character group. People tend to forget that for some reason.
$regex(abcdefg,/[^a-e]/g) -- Returns 2 because 2 letters (f and g) satisfied the character group of "anything but a-e"
Im sure you get what I was trying to do now but Im guessing by your comment that my method is wrong so Ill look into changing it with another method or a better regex right now. Off the top of my head I think just using /(^(?!$))/ should be fine but I need to make positive first .
Lmao furby, thanks for a ton for shooting a couple ideas my way but im sure you prolly notice I didnt use your ideas this time. I love ideas from everyone but if I started thanking everyone who shot an idea my way whether I used it or not we would be here all night because I bother everyone for them.
Jonsey44, thanks for the tip. I just do that outta habbit.
I love how nobody mentions if they like it. It's just "Hey this is wrong" and "Hey, I gave you ideas".
Thanks to Furby and EL for bouncing ideas my way and listening to all my ideas and returning opinions. :)
I threw together a very primitive version of this snippet the night before last when i was helping someone make a code smaller and wanted to know how small. When more than one person asked me to release it I added some more options and am doing so.
Comments welcome.
Typocommented on mIRC Snippet: Trivia
-
Jul 25, 2008
Make sure you are pasting into a new remote file. In other words, when you hold down alt and press R to bring up the script editor already opened to the remotes tab, if there is anything already written you should start a new remote file for the trivia script.
To do that, double check that you are indeed on the remotes tab, now click File then New. It will start a new .mrc usually called script1.mrc or similiar. Now you can paste the script in and hit ok to save and close the script editor. When you hit OK to save the file and close the editor it should ask you the questions about the owner name and channel. If it doesnt you did something wrong again and that usually means either you didnt start a new file or you werent in the remotes tab in the scripts editor.
If you take your time following the instructions you should be ok.
H_M, you can edit any of your own comments to add to it or just change it, this makes it so u dont have to make 3 posts in two minutes.
Very nice script btw. Really handy for people who pastebin even just every so often.
Jonesy44, wth are you talking about? Please explain your statement because I find it highly unlikely that a simple socket managed to accidntly open up some vulnerability in a website.
Just out of curiosity, why are you releasing your game in peices that cannot be used as standalones? It seems like it would be a lot more appropriate to release it as a complete addon instead of multiple snippets.
Just wondering.
It looks like youve put a lot of work nto this tho and your code at a glance looks very clean. I especially like how I noticed in one of the other ones that you use aliases as if they were a variable and doing that had never crossed my mind before. That could come in handy.
Now this I believe you actually made.
Congrats for releasing something you did yourself.
Now, go back and check your brackets since your missing one. Also, you left a / on the very first say and in the same line you are missing the first ? that you say is supposed to be a cross. You should always use msg instead of say, if you type /help /say you will see that it says not to use it in "The remote section" you should use msg $active instead of say.
You oughta make the script replace the text anywhere in the line instead of if its the only word typed. To do that use isin and $replace.
The first line in your script with my changes would be:
Code
The $chr(44)'s are comma's so that the colors would work without messing with the format of the $replace. Also, I used so many $+'s I should have prolly used $+( ). Anyhow, with that example you should be able to redo the whole thing and have the text replace anywhere in your text. I did test the lol and it worked great.
Ok, theres sooooooooooo much to go over and its obvious that you have a bad habbit of getting ahead of yourself. I think we need to do this on irc. Ill help you rebuild this thing.
To answer one of your questions, you dont need a $+ at all between the %variable and the word times, thats why it was so confusing why you were doing it.
I couldnt get to sleep lastnight and I'm very tired now so I need to get some sleep before I help you. Ill join your server later today if you tell me what server yor on and what your nick will be and what channel I should look for ya in so I can help ya.
Do you not listen to anything said to you? You keep making the same mistakes over and over and over and over.
Read the comments on your other snippets and learn from them.
Once again you arent combing events, you are using $+ to make "3 times" look like "3times" which is silly, you have %+ where $+ belongs in atleast one spot, you say things like "hello has been said #times" but only check the word hello if its the first word in a sentence and this same exact problem repeats numerous times, you insist on using /'s for commands when you dont need them inside of scripts, you have absolutely no flood protection of any kind and infact your script intentionally and severly floods with the cmodes on text event.
Every single thing I mentioned above has been mentioned in your other recent snippets.
I could go on but I don't think you even listen. It's like you just don't care if the script you release is crap or quality.
If it's that you don't understand, then ask for help, me and a lot of other users here are more than willing to help you figure out anything your having trouble with.
Theres no reason to use two variables for the away time. Just setting one should be enough. For instance:
Code
and then if you need the minutes later you could $calc(%atime / 60) to get it or you could reverse the whole idea and just set %atime to the actual minutes and $calc(%atime * 60) where you need it. Setting it into another variable would make sense if you needed it more than once but thats not the case here.
The other thing and probably the biggest issue is the fact that you never actually set the user away. You should be using mircs /away command to actually set them away or the "away" in "auto away" is sort of missleading.
Besides, using /away would also allow you to use the $away variable to track if the user is away or not instead of making a %away variable.
Type
Code
and
Code
in mirc for more information on the command and identifier.
If you need help just respond here.
Good luck.