Posted 06 August 2014 - 10:23 PM
I just looked at your code and holy cow you have a lot of pointers
They're known to cause memory leaks and a crap load load of bugs that results in indefinite recursion aka stackoverflow
It totally depends on the platform though, if it doesn't give stackoverflow it will slowdown ZC considerably while a quest using a script like this
If the ZC compiler has a garbage collection feature disregard this comment, if not i would recommend you clear all pointer variables
(not sure what it is in ZC but in C++ it is delete)
Also when pointing to objects you should pass-by- and return-by- reference, the clearing of the pointer variables will return any object
(link for instance) to his original state before execution of the script
I noticed you are always passing by value and that always slows down run time since it makes a copy of itself and is still there even after runtime.
If the script runs enough times it could possibly result in stackoverflow terminating the entire program
If ZC can pass/return by constant rvalue like c++ can, most of your problems in the code can be solved quite eaisly since it is destroyed after runtime
Your script is quite small so the memory leak issue won't be apparent, but it's better to do it right the first time
On a real SNES zelda 3 slows down considerably after the functions that perform spin attack, dash attack, and even during boss fights because there
was no such thing as pass by reference until C++11, later games like minish cap that use c++ don't have slow down anymore because of the things i just said
I have zero experience with z-script so I don't really know if anything is appliciable, but in OOP this is basic
Didn't want to sound mean or anything but I don't want such a cool script to go to waste