What takes more resourses?
Posted: Thu Aug 20, 2009 6:07 pm
Can anyone tell me please...
Let's say you have 100 lines of code, and it runs each time an item is used.
What takes more system resourses? 10 lines of code script in 10 linked (hooked) scripts...
ItemUse.ecl is 10 lines which then calls 9 SubUse.ecl scripts 10 lines each
or
1 ItemUse.ecl script that is 100 lines long?
My thinking is this...If the main script calls 9 subscripts to perform 9 different functions, and upon completing 3 functions, no longer needs say 3 subscripts. Will you then be left with perhaps 70 lines of active code?
Would be nice to hear the logic behind it.
Let me see if I can think of an example:
Let's hypotheticaly say you have a magic staff.
When you double click the staff the following occurs...
1. The main script runs, checks for other magic properties and runs hooked scripts as a result (10 lines of code)
2. A light script is launched (10 lines of code)
3. Change colour of staff launched (10 lines of code)
4. Staff is equiped to hand (10 lines of code)
5. Regenerates user 2 hps every 15 seconds (10 lines of code)
6. Regen stamina 2 every 15 seconds (10 lines of code)
7. Lets user hear father (10 lines of code)
8. Makes user invisible (10 lines of code)
9. Plays bird sound effects (10 lines of code)
10. Gives player the hiccups (10 lines of code)
Yes I was having a hard time thing up suitable codes
P
Okay so there we have 100 lines of code.
Now lets say a few seconds after the item use and initial launch of the 10 scripts, #3, #4 and #8 finish their tasks and the programs end.
Are we left with just 70 lines of active code? Making this a far more effective way to code?
Thanks in advance for the feedback!
Let's say you have 100 lines of code, and it runs each time an item is used.
What takes more system resourses? 10 lines of code script in 10 linked (hooked) scripts...
ItemUse.ecl is 10 lines which then calls 9 SubUse.ecl scripts 10 lines each
or
1 ItemUse.ecl script that is 100 lines long?
My thinking is this...If the main script calls 9 subscripts to perform 9 different functions, and upon completing 3 functions, no longer needs say 3 subscripts. Will you then be left with perhaps 70 lines of active code?
Would be nice to hear the logic behind it.
Let me see if I can think of an example:
Let's hypotheticaly say you have a magic staff.
When you double click the staff the following occurs...
1. The main script runs, checks for other magic properties and runs hooked scripts as a result (10 lines of code)
2. A light script is launched (10 lines of code)
3. Change colour of staff launched (10 lines of code)
4. Staff is equiped to hand (10 lines of code)
5. Regenerates user 2 hps every 15 seconds (10 lines of code)
6. Regen stamina 2 every 15 seconds (10 lines of code)
7. Lets user hear father (10 lines of code)
8. Makes user invisible (10 lines of code)
9. Plays bird sound effects (10 lines of code)
10. Gives player the hiccups (10 lines of code)
Yes I was having a hard time thing up suitable codes
Okay so there we have 100 lines of code.
Now lets say a few seconds after the item use and initial launch of the 10 scripts, #3, #4 and #8 finish their tasks and the programs end.
Are we left with just 70 lines of active code? Making this a far more effective way to code?
Thanks in advance for the feedback!