PDA

View Full Version : Odd functions in Halo Script.



Dwood
October 23rd, 2009, 04:26 PM
It has come to my attention that Halo Script has some odd attributes to it that no one to my knowledge explores/takes advantage of.

Let's take a look at the Halo Scripting Bible (http://www.freewebs.com/desphm/HS_Bible.htm)

The main thing I would like to point out is the top part of HSB:



' quote
The quote character is used to block LISP evaluation. When LISP evaluates a quoted thing the quote is "stripped off" and the expression following the quote is returnd.

? (+ 3 4) ; LISP evalutates the list
7

? '(+ 3 4) ; quote blocks evaluation
(+ 3 4) ; the quote is stripped off

? PI ; LISP evalutates the symbol
3.141592653589793
? ''PI ; the first quote is stripped off
'PI ; leaving the second quote intact

: colon
The colon introduces a special type of symbol called a keyword. A keyword is self-evaluating, that is, it is constant data.

? :woof-woof!
:WOOF-WOOF!

# cross
The cross character is used to introduce a special interpretation of the subsequent expression. Here are several examples:

#xFF00
Introduces digits in hexidecimal radix.
#(1 2 3)
Creates a vector (array) from a list of elements.
#'list
Returns the function associated with the symbol list. If no function is associated with the symbol LISP signals an error.
#|
Introduces a comment that lasts more than one line. A #| must be balanced by a terminating |#.


One of the first things I don't get, are the practical uses of the ' character in Halo Script.

Then, I think there's something that's even more useful but I just don't understand its uses are, is the colon.

and Third, something that I don't understand is how to use an array in LISP as HSB defines:

#(1 2 3) - wait, what?

like, could I use an array of script functions so I could say

array = #(scriptFunct1 scriptFunct2 scriptFunct3)

then in my script:

(begin_random array) ?

Or should I not even be looking at the Halo Script Bible?

Rob Oplawar
October 23rd, 2009, 08:27 PM
HSC = LISP?
Mind = blown
(I've heard of LISP all over the place, but I never actually knew what it looked like. Now I know)

er, on topic, I am intrigued by this post. I may have to play around with CE a bit, to see if there really is a straight LISP interpreter in the engine, or if they built their own interpreter with a syntax based on, but not necessarily inclusive of the features present in, LISP.

Dwood
October 23rd, 2009, 08:33 PM
The problem I'm having is how do I utilize those functions as HSB says?

E: To make this a more useful post, it is more than likely that the devs probably stripped their LISP interpreter just so they could use the Syntax in Halo Script. Programmers are lazy ya know.

ShadowSpartan
October 23rd, 2009, 08:39 PM
(script continuous testifplayer1
(if (= playerishere 0)
(begin
(hud_set_help_text test)
(show_hud_help_text 0)
)
)
)

-That's what a basic thing in Halo Script looks like.
Rob knows how to script....remember his Bridge CE project?

Dwood
October 23rd, 2009, 08:45 PM
Rob knows how to script....remember his Bridge CE project?

No? lol.

I'll just remove that part of my post. :v:

Dwood
October 24th, 2009, 10:04 PM
double post.

I also noticed that statics can only be called AFTER they are created therefore startup scripts go AFTER static scripts if you call them in the startups even though startup scripts should always be first.

:v:

S3anyBoy
October 24th, 2009, 10:14 PM
double post.

I also noticed that statics can only be called AFTER they are created therefore startup scripts go AFTER static scripts if you call them in the startups even though startup scripts should always be first.

:v:
Same for dormant scripts, this is the case in almost(?) every programming language, because they're usually sequential, you couldn't call on something that hasn't been defined yet.

Dwood
October 24th, 2009, 10:44 PM
Same for dormant scripts, this is the case in almost(?) every programming language, because they're usually sequential, you couldn't call on something that hasn't been defined yet.

Yep. Does anyone know the types of static scripts that can be used? The only one I'm aware of is "void" so it'd look like (script static "void" laz0rz

Skarma
October 24th, 2009, 11:25 PM
Well, logically any variable type can be static. Static should be avoided though, imo I don't think it is even very useful. It's basically a global variable that is limited to the scope of the function or source file it is declared in. I think this makes things more confusing and with the small scripts that I see written for Halo, there really is no solid point to using it. I say stick with dynamic allocation

Kornman00
October 25th, 2009, 03:06 AM
I should note that I just c&p that text from a LISP reference (it was a leaked document so I never got around to culling the info that didn't apply here). Halo Script, while it uses a LISP-like grammar, it itself is not LISP nor does it use a LISP parser. Bungie programmed their own parser/compiler for HS.

Rob Oplawar
October 25th, 2009, 01:09 PM
^case closed, I suppose.

TheGhost
October 25th, 2009, 01:54 PM
Same for dormant scripts, this is the case in almost(?) every scripting language, because they're usually sequential, you couldn't call on something that hasn't been defined yet.

ftfy

most modern (object-oriented) programming languages which are compiled do not care the order you define or call things

Dwood
October 26th, 2009, 05:26 PM
I should note that I just c&p that text from a LISP reference (it was a leaked document so I never got around to culling the info that didn't apply here). Halo Script, while it uses a LISP-like grammar, it itself is not LISP nor does it use a LISP parser. Bungie programmed their own parser/compiler for HS.

So I can't use arrays? :smith:

I could do some BEAST scripts if I could use arrays.

formlesstree4
October 26th, 2009, 11:12 PM
ftfy

most modern (object-oriented) programming languages which are compiled do not care the order you define or call things

To a point this is true. For example:


Messagebox.show(rawr)
Dim rawr as string = "hi"

That won't work. You are referencing a value before it's defined.