Sign in to follow this  
Followers 0
TCK

Script Extractor

15 posts in this topic

Where was that script extractor I saw a long time ago? I've been enjoying games more recently and thought I'd screw around in some more of my old projects, but I realized that after my hard drive crashed, all I had left of them were compiled maps themselves; which means the rest of the tags I got no problem, but I need to be able to extract my scripts.

NeX likes this

Umh7x1l.gif

Share this post


Link to post
Share on other sites

Tiddy-bits:

Huh, I thought we had a topic for it here somewhere, or that it was written by one of our members. Thanks.


Umh7x1l.gif

Share this post


Link to post
Share on other sites

Oh yeah, pretty useful thing. Great for examining what's pre-existing. My only gripe is that it pulls everything as this giant gagglefuck of a single script, but I assume that's how the engine throws it together.

 

It's how I originally got a working version of the day/night BSPs working, that plus TCK's UI menu button addition script. Good stuff.

 

Still wish I'd had any experience with functional programming/scripting while in school. Never really touched on LISP-style syntax, so it's still pretty foreign to me. Easy enough to learn I guess, just never had the need or desire :P

WaeV likes this

KsqHutE.png

Share this post


Link to post
Share on other sites

Still wish I'd had any experience with functional programming/scripting while in school. Never really touched on LISP-style syntax, so it's still pretty foreign to me. Easy enough to learn I guess, just never had the need or desire :P

Never too late to learn. I still try to learn new programming languages when time permits.

We covered Scheme in one class at school, but I want to pick up Common Lisp.

Lisp's syntax is so simple it hardly has a syntax. It's just `(command arg1 arg2 arg3 ...)` for every single type of command.

Share this post


Link to post
Share on other sites

Yeah Common Lisp is my fucking jam.

Lisp's syntax is so simple it hardly has a syntax. It's just `(command arg1 arg2 arg3 ...)` for every single type of command.

Exactly. That's one of the reasons I have trouble with learning new languages, though. I'm so used to how Lisp says, "lol hey kid, repeatedly stick this inside itself with different words."

One thing I'm curious about, before I try learning C++: is recursion uncommon outside of Lisp?


Umh7x1l.gif

Share this post


Link to post
Share on other sites

Not really but most people tend to avoid it. its generally easier to do things without recursion unless the problem requires it.

Share this post


Link to post
Share on other sites

C and C++ use "the stack" pretty heavily: every function call allocates a new frame of memory on top of the stack. If your recursive algorithm goes too deep, you run out of memory with a "stack overflow" error.

Since for/while-loops just reuse local variables and don't allocate new stack space, they are typically used more.

There's probably plenty of recursion in the Boost libraries? They're kind of a second standard library - sort of a breeding ground for new stdlib proposals. They like to experiment.

NeX likes this

Share this post


Link to post
Share on other sites

Pretty much what WaeV was saying. The stack gets heavily worked with recursion, and if you're doing something that has an absurdly long regression, then you could easily run out of space before your algorithm finished.

 

Think the classic Towers of Hanoi problem, or a simple Fibonacci calculator - most of the time an iterative solution is less elegant but potentially infinitely more efficient.


KsqHutE.png

Share this post


Link to post
Share on other sites

Ah. That's another bit I'll have to move past then. To use your example, this is what a Fibonacci calculator would look like in Common Lisp:

(defun fib (x y z)
	(cond
		((<= z 0) nil)
		((= z 1) x)
		((> z 1) (fib y (+ x y) (- z 1)))
	)
)
So to use that function I'd give it a first term, second term, and the number of the term I want to find. It first tests if I asked for a negative term number, because that would make it impossible, and if so it says nil. Then it checks to see if it's already got the number it wants (if the number of times left to run is 1) and if so returns the first term. Then it runs and reduces the times left to run.

(fib 1 1 1119)
That would return the value of the 1119th term of the normal Fibonacci sequence. That's the way we're supposed to do it in Lisp; any other way is considered worse.

Also just to illustrate two points at once, what Waev means about Lisp having almost no syntax is that this:

(defun fib (x y z) (cond ((<= z 0) nil) ((= z 1) y) ((> z 1) (fib y (+ x y) (- z 1)))))
would compile EXACTLY the same as the first block of code; all the formatting is for user benefit and varies by preference (but has certain conventions). Edited by TCK
NeX likes this

Umh7x1l.gif

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.