[Question] SCI - Adding Functionality

Cryptonomic I am curious if the SCI scripting language is extensible to any agree. What I means is that I know a certain amount of processing is done by the interpreter but a great deal of the actual mechanics is held in the scripts and the kernel functions. But how do you extend that if you want to?

As a concrete example of what I mean, I was thinking of doing a game but part of the game would require being able to somehow "record" what the player did in a given room. The reason for that is because, later, those recorded actions would be utilized to determine some elements of how the game plays. For example, let us say that the player moves Ego around for awhile, picks up something, opens a door, then leaves. Okay: so I would want to record those moves/actions, perhaps to later automatically play them back (such as with a plot device where Ego watches "himself" on a camera that had been filming him).

While I have given a specific example here, the question is more generally one of how to extend the language or how to get the language to do more things. (The only immediate gaming example I can think of is in the realm of Interactive Fiction, where there is a main compiler with a library of functions but people can contribute their own "function libraries" that can be called as well.)
Brian_Provinciano That recording is definitely possible (SCI has FileIO stuff too, so you could even record it to a file).

You can look at it this way--The interpreter manages loading/unloading resources, drawing views/fonts/pics/windows and executing scripts. You control how the views/fonts/pics/scripts/objects/windows are drawn/handled. Virtually anything you want to do can be done with scripts. SCI is, infact, not actually made for adventure games specifically, but rather the scripts make it an adventure game engine.

As far as adventures are concerned, you could script up an LSL2/3 interface, LSL5/6 interface, LSL7 interface, Monkey Island interface, etc. Any interface you want can be done if you can script. Even the inventory is handled by the scripts.

Sierra's card games just scratch the surface. You can use SCI for anything! Even non game related stuff. You could even write a graphic editor, or even a text editor in it!
Cryptonomic
Brian Provinciano wrote:

That recording is definitely possible (SCI has FileIO stuff too, so you could even record it to a file).


Is there an actual specification for the full SCI language? I know FreeSCI has their version of an SCI spec on their Web site that is related to their interpreter. But, after searching, I have not found anything of SCI in general that shows how it can be added to or how you can do various different things with it.

As far as adventures are concerned, you could script up an LSL2/3 interface, LSL5/6 interface, LSL7 interface, Monkey Island interface, etc. Any interface you want can be done if you can script. Even the inventory is handled by the scripts.


Sounds great. But is there anything that describes, even in bare details, how to start a process like this. I have learned many programming and/or scripting languages in my time, so I am not daunted by that. I am also not looking for "hand-out" answers: I will gladly read through any amount of documentation or parse through any amount of available source code.

Even non game related stuff. You could even write a graphic editor, or even a text editor in it!


Again, this sounds great. But I have little idea of where to begin, and it is not for lack of searching at this point. I would definitely be curious to learn more about this because it seems like SCI implementations are currently only "scratching the surface", as you say, in terms of potentially creating some interesting game scenarios.
Brian_Provinciano Look at the SCI Studio help file. It's HUGE! I spent countless hours on it. It documents all 63 classes, 29 scripts, 114 kernels and the entire language. It's included with SCI Studio.
Cryptonomic
Brian Provinciano wrote:

Look at the SCI Studio help file.


To be sure, I have been perusing this at various points in my research. I am not sure that the Help file shows me how to do something like the "recording" I mentioned or how to use SCI to build graphic/text editors as you mentioned. But I will keep plugging away at it. The file is definitely a great effort and I respect the amount of work that went into doing this.
Brian_Provinciano That's the thing about programming though! There's normally not going to be a document on specific things like recording a player's movement, but if you know the language, it will be easy to do yourself.

No one taught Sierra how to make the world's first graphical adventure, nor did they teach Nintendo how to create to world's first side scroller. They knew programming, what the computer was capable of (ie. drawing pixels, sprites, etc.), then applied that knowledge to make their creations.

I'll give you some hints. Check the class system scripts for where it parses key presses. Then, use a global variable array stack to store which keys are pressed. If you are farmilliar with scripting, it will be a piece of cake. All the info on scripting is in the help file.
Cryptonomic
Brian Provinciano wrote:
I'll give you some hints. Check the class system scripts for where it parses key presses. Then, use a global variable array stack to store which keys are pressed.


Thanks Brian. I see what you are talking about and it makes sense to me now. It was more a conceptual issue as I was thinking of Ego from the graphical standpoint but, in reality, it all breaks down to the key presses the user does to move Ego. (In that sense, it is a lot like the Interactive Fiction systems where the user types in responses and those can be recorded.)

And that is probably a good lesson in general. Sometimes it is not a matter of whether or not you are a good programmer with one or another system, but rather how you conceptualize the current system. Sometimes just knowing programming concepts is not enough because you need the conceptual basis behind those programming concepts as well. To someone who has worked with the system a long time (as you have, building up SCI Studio) certain things are obvious. To others that is not necessarily the case. Sometimes a nudge in the right direction is enough to get people started. Your nudge to me was exactly what I needed.

While I agree with you that given documents may not exist for certain elements of a programming language, that is where contextual documents come into play. (Witness how Qt from TrollTech or CodeSense is documented, as just two examples. A lot of it is not dedicated to just programming concepts but rather to the conceptual basis behind those concepts that allows someone to abstract behavior of the system to various situations.) But, please understand, none of this is criticism of you or SCI Studio. It is just that other aspects of life sometimes make it difficult to devote all time to one language and, as such, it helps to get pointers on forum boards like this.