Blockland Forums > Modification Help
Looping a function
Nexus:
--- Quote from: Uristqwerty on November 17, 2011, 10:27:18 PM ---
--- End quote ---
You are a moron. Please leave this thread immediately.
Uristqwerty:
--- Quote from: Nexus on November 17, 2011, 10:36:50 PM ---You are a moron. Please leave this thread immediately.
--- End quote ---
No, I just happen to fully understand the importance of properly educating less experienced coders. You should never tell someone who has just started writing C to use gets(), for example, as you would be telling them that they should make their code exploitable and easy to crash, when given unexpectedly long input lines.
Giving bad advice ("Use eval!", without mentioning the dangers) is a sign that you are either intentionally trying to mislead them so that they never make any mods to compete with your own, or it shows that you don't understand how to teach others properly.
Specifically in this thread, you gave a snippet of code that, clearly, you were proud about having devised yourself, since it clearly solved the person's problem. Except, you didn't put the time in to explain how to use it, any drawbacks, or, really, how it supposedly solves their problem! First, you assume that they know that eval takes a string of code. Imagine their surprise if they end up getting a syntax error once per second as soon as they try to loop(myFunc, 1000); Or worse, loop(myFunc, 1); /*That is one second, right?*/. So, assuming they understand that eval takes a string and that schedule measures in thousandths of a second, and that eval executes code, so they'll need to add brackets and a semicolon, why would they need to ask the question in the first place?
Oh, and what if they were asking about recursion, rather than looping over time? Less likely, but entirely plausible, from their less-than-perfectly-clear phrasing?
So, your response is to give an overgeneralized solution that you are too proud of to accept any sort of criticism, and that you feel can solve any problem. A function so well thought out that nobody could possibly need an explaination for how it works. A function that will doubtlessly be copy-pasted into numerous other add-ons, with the same exact name. Oh, and then someone modifies it. Gasp! But why? It's clearly a perfect function, there is no reason at all possible that would cause somebody to ever edit it!
Except someone does. And then everyone who downloads it and any other add-on that uses your function get to experience the joys of subtle version incompatibilities!
If you share code, you must take the responsibility to ensure that it's recipients understand how it works. Otherwise, you are irresponsibly subjecting countless people playing to numerous bugs because somebody took your code and broke it because they didn't understand it.
Nexus:
--- Quote from: Uristqwerty on November 17, 2011, 11:20:34 PM ---
--- End quote ---
Jesus, its like an autistic kid with insecurities about his intelligence learned to script.
Don't use eval?
My brief example code has bad namespace?
Never use recursion accomodate for more types of input?
These are all examples of terrible advice. Ever heard of a default function called messageboxyesno(%title, %text, %yes, %no) ?
Guess what it does!
eval(%yes); and eval(%no);
Hundreds of blocklanders die every day because of the dangerous side effects of using such a wild and exploitable functions. Very Tragic.
Do not waste your time on such large paragraphs, no one respects will respect what you have to say about coding after this.
Superb:
Lol a lot of people in this thread don't know what they are talking about.
Here it is, lol:
function loopThing(%arg1,%arg2,%arg3)
{
if(isEventPending($loopThing))
{
cancel($loopThing);
}
//code here
$loopThing = schedule(milliseconds, 0, loopThing, %arg1, %arg2, %arg3);
}
To stop it, use the cancel function.
cancel($loopThing);
Amade:
--- Quote from: Uristqwerty on November 17, 2011, 11:20:34 PM ---
--- End quote ---
Actually you're just a moron eager to flaunt some information you've picked up but misinterpreted. You aim only to make yourself look supreme by bashing examples posted by others that supposedly contain flaws that you also committed in the examples you posted. You're not helping the poster of the thread at all.