Please Disable Ad-Block To View This Website.

If you block ads, this site can not survive!

Ads are very minimal for registered users. If you don't have an account please register now!

DOWNLOAD
 Full Scripts
 Addons
 Snippets
 DLLs
 MTS Themes
 Tutorials
 Misc.
 File Queue
 Download mIRC
INTERACT
 Screenshots
 Challenge
 Top Downloads
 Submit Form
 Forums

SEARCH
Site Search

FRIENDS
Link to us!
PhotoShelf

Home | Comments:
Common Pitfalls by myggan
Description:
This tutorial explains some of the known pitfalls that the newbie scripter may fall in to. It also provides some tips on debugging and how to act when asking for help.

Submitted Review Author's Updates

There is no review for this file yet.
There are no update notes.
Screenshot:
No
Screenshot
Available

Comments:

  Mode:    Create New Post

twigboyDec 20, 2005 3:31AM
lol pretty funny and helpful for both novice and medicore scripters

Ruger45Jan 1, 2009 5:13PM
what does medicare have to do with this????????

blue-elfDec 19, 2005 11:27PM
Regarding the INPUT EVENTS, there is more than one way to solve the problem mentioned. And that is, to specify a different target, ie.

ON *:INPUT:#:{ }
ON *:INPUT:?:{ }

The above two examples will work properly even if they are on the same script file, and no matter which one is on top. (Unless of course you meant having multiple INPUT events for the SAME TARGET window)

For the use of $$, this should also be included in the /readfile examples as one solution to solve insufficient parameter problems.

Finally, while it may not be appropriate, I think it's worth mentioning that certain scripting practices can become pitfall such as the use of too many piped commands in a single line, i.e. cmd | cmd | cmd | etc.. This makes finding bugs a lot harder.

P.S. I'm not quite comfortable with your explanation on if's and () because I've a strong opinion on this :-) But I think I'll just blame Khaled instead!

Text edited by author on Dec 19, 2005 @ 11:31PM


hixxyDec 19, 2005 11:43PM
quote:
blue-elf said:

Regarding the INPUT EVENTS, there is more than one way to solve the problem mentioned. And that is, to specify a different target, ie.

ON *:INPUT:#:{ }
ON *:INPUT:?:{ }


That's mentioned in the tutorial ;)

mygganDec 20, 2005 9:54AM
I meant the same target window for input events, it says in the 'double events' section that it does not affect events with different targets.

$$ isn't a very good solution as mentioned in the '$$' part. It should only be used in scripts if you're sure it can't incorrectly halt further processing, which it might if you made /readfile more advanced.

What is your opinion about if's and ()'s then? As I said, it's a very personal thing and I don't say neither of the methods are wrong (except the one that has neither one of () and {}). For me, it provides better readability without ()'s, and as it can't be parsed incorrectly I see no reason to change my scripting style.

hixxyDec 19, 2005 11:42PM
on DNS also works like on INPUT:

on ^*:dns:{
  var %i = 1
  while ($dns(%i)) {
    echo -s $v1
    inc %i
  }
  haltdef
}

Nothing^

on *:dns:{
  var %i = 1
  while ($dns(%i)) {
    echo -s $v1
    inc %i
  }
  haltdef
}

Works fine^

mygganDec 20, 2005 9:45AM
Thanks for pointing that out.

MpdreamzDec 19, 2005 4:12PM
Pretty nice tutorial i had some laughs reading it, nicely written and i agree with almost everything put there, except for the () story
I think especially newbies should always use () as intended, because when theres gonna be multiple && ||'s it will be easier to debug since you can just follow how the ()'s are grouped to see how it tests the conditionals.
Also i believe that "if (condition) command" is faster as "if condition { command } " so its better to use () with single commands as well.

Nice tut

mygganDec 19, 2005 4:34PM
You are right, () are faster than {}, but as long as you use any of the two, that's not wrong. This section was added because most people think both () and {} are required, which they're not. I also wasn't implying one is better than the other, I was merely comparing the different methods along with my personal opinion :)

Thanks for commenting.



Create New Post

You must be logged in to post messages.