ScriptUO
Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: BadManiac on October 18, 2010, 01:31:49 PM
-
Old EUO:
SET %timeout #SCNT2 + 2500
...
IF #SCNT2 > %timeout
do stuff
How do we achieve the same functionality as simply as possible in OEUO? Least amount of code lines wins!
timeout = getticks() + 2500
...
if getticks() > timeout do
stuff
... BRAINFART, sorry >.<
-
Checkout my helper subs. I have second and milliseconds flavors.
http://www.scriptuo.com/index.php?topic=5960.0
-
I know TM, but for this purpose they are about as elegant as a donkey in tap dancing shoes. :P
A function call with object creation and all that just to get that done? Too complex for this simple use. getticks() does what I needed. I'm EXTREMELY anal when it comes to short optimized code, and I suffer BAD from NIH syndrome :(
I'll be abusing your subs for damn sure, maybe even add to them when we get to creating the SUO community library. But for such a simple thing as I was trying to do here, they are way overkill :)
-
I'll give up a bit of complexity for code clarity anyday; especially since we finally have a language we can really do some cool things with such as objects. I'll probably go overboard with object encapsulation just because WE CAN!! heh
-
OOP have no place here. Objects are great for larger things. They make no sense for this and make the code obfuscated and unnecessarily complex. But that's my opinion, I loathe OOP for anything but their intended purpose which is very LARGE projects, where they improve things immensely. They can stay out of my scripting world, thanks.
-
And yet I still had fun using it. ;)
Each to their own.
-
I'm sure we'll both have fun. This is honestly a good thing. You'll go class and object encapsulation nuts, and I'll be an old school procedural programmer nazi. Both ways work, and it expands the community's overall knowledge :) Yay for diversity. (obviously classes suck and you're wrong...)
-
Honestly, I'm just jazzed there's way more programming widgets available to us these days. Gotta love that!