Quote:
Originally Posted by fadetree
[You must be logged in to view images. Log in or Register.]
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.
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.
|
What he posted is the player.pl perl script for TOFS. The items are only defined there. Not in the server code or other quest files. So doing that would actually be far
more complicated in this case. Generally you're right, though in this case it's easier as he has it.