View Single Post
  #2  
Old 06-14-2012, 10:19 AM
fadetree fadetree is offline
Planar Protector


Join Date: Mar 2012
Posts: 1,958
Default

Well, I was actually just teasing, but if you are seriously asking, its bad programming style. If you ever need to change the way something is defined that you've hardcoded, (in this case its an item id), you'll have to go hunt through all the source for occurrences and make sure you get them all. If they are centrally defined somewhere you can just change that one spot.
Code:
$oncursor(20039)
becomes something like

Code:
$oncursor(LEFT_PORTAL_KEY)
Makes it easier to read as well. You'd have the constant LEFT_PORTAL_KEY defined as being equal to 20039 in some constants file that all of the code imports from.

Now, I don't know if in the specific case of EQ EMU scripting it is important or not ( ie., there is NO chance the ID numbers would ever change and you have them all memorized ), but it's still considered generally bad coding practice.
__________________
The Ancient Ranger
Awake again.
Last edited by fadetree; 06-14-2012 at 10:21 AM..