Your preferred scripting methods
#4

It ultimately comes down to YOUR opinion, but here are my preferences:

#1 - In cases like the one you presented, I would go with define because it is a better fit for said example. I typically will only use an enum in that case when I have a list of constants whos values are set in a specific manner (The common ones being: each one is increased by one, or each value is shifted to the left/right (bitwise)).

#2 - I prefer the second one hands down. It just is much cleaner and organized.

#3 - Depends on the function and its usage! This is less a preference and more of a functionality issue. If I know I am going to be using CallRemoteFunction or using this function in a timer, It obviously has to be public; no choice about it. If its just a function that I am planning on releasing/using for one file, then I would chose stock.

#4 - This is also more about functionality, rather then preference, as they are not equal. I would go with the fastest method, which in my scripting days, was YCMD (followed closely by zcmd).

#5 - I would probably just use the macro if I had to pick one instead of just using my player array.

#6 - It depends on the situation. I have a BIG pet peeve when it comes to people over using the triadic operator because they think it makes them seem more knowledgeable, or skilled. If it's a small statement, I understand...but if not, just use a regular if statement (I prefer A btw).

#7 - I will always use a for loop over a while when it comes to iterating a specifically known amount of times. Any smart man would (less chances of mistakenly creating an endless loop).

#8 - It depends on my mood. This is a good preference thing to ask! I usually use b the most.

#9 - Situation. Unless its a straight up ideal situation for switch, I'll go with if instead. That simply comes from other languages though. Pawn has my favorite implementation of the control structure personally (i liked being able to specify constant number ranges).

#10 - (Ignoring that you do not need to fill the array dimensions in this case/have a size issue with the second dimension) The first one is cleaner, and I would definitely go with that if it was a simple script. I like building dynamic scripts that are easy to modify ingame...so I would likely go with something along the lines of the second one if I was building it for personal use.

#11 - I would probably format the players name into my sentence ("%s is a boss"). Not really a practical example in either case tbh.

#12 - I've used a and b (though I always null the string out when using strcat). I think format is more clear tbh, but some people are going to complain about the speed in this thread :P.

#13 - A flat out.

#14 - Oh dear gawd...a...just a...always (with the exception of g_ for globals).
Reply


Messages In This Thread
Your preferred scripting methods - by Emmet_ - 03.12.2013, 04:22
Re: Your preferred scripting methods - by Djole1337 - 03.12.2013, 05:15
Re: Your preferred scripting methods - by Bakr - 03.12.2013, 05:17
Re: Your preferred scripting methods - by Kyosaur - 03.12.2013, 05:27
Re: Your preferred scripting methods - by Pottus - 03.12.2013, 06:02
Re: Your preferred scripting methods - by Slice - 03.12.2013, 06:47
Re: Your preferred scripting methods - by iZN - 03.12.2013, 07:02
Re: Your preferred scripting methods - by Emmet_ - 03.12.2013, 08:04
Re: Your preferred scripting methods - by Slice - 03.12.2013, 09:47
Re: Your preferred scripting methods - by Kyle - 03.12.2013, 13:28

Forum Jump:


Users browsing this thread: 2 Guest(s)