Official Thimbleweed Park Forums

Question about "script" keyword

Hi There!
I noticed every time a piece of code is going to be used as a thread, it is defined using the “script” keyword, which is not part of squirrel.
For instance:

script sheriffOpening2() {
cutscene(@() {
actorAt(sheriff, CityHall.spot1)
actorWalkForward(currentActor, 50)

}
}

Which is really neat, since it allows to quickly know which functions are actually going to be used as threads, but I don’t see native squirrel support to add a keyword like this.
Is the code being pre-processed before it’s fed to the engine?

Thank you so much for all the answers! :slight_smile:

Ron uses an extended version of Squirrel which he talked for example in this blog post: Scripting Test

Here is a quote which could be actually directly related the script keyword:

I’m looking at using Squirrel as the scripting language for Thimbleweed Park and one of the things I always liked about SCUMM was how it handled multi-tasking. It was effortless to run scripts in different threads and let objects handle themselves without cumbersome state engines or weird co-routines.

I just want to start a function and have it run until told otherwise. I’ve seen a few scripting languages that can do this, but Squirrel didn’t have the ability “out of the box”.

I was chatting with my friend Vincent Hamm (who worked on SCUMMVM in the early days) and he didn’t think it would be too hard, so he whipped up a quick proof of concept.

Also take a look at this specific comment thread:
https://blog.thimbleweedpark.com/scripting_test#54bebb508195c3033bd58ad0

2 Likes

Hi !
Thank you for your answer!
I read that post a while back, but I understand he has added thread support by using the API (he says: “startthread and breakhere are commands I added to Squirrel using their API, not by modifying any of the core Squirrel code”), so looks like he did not modify squirrel’s code, only added additional functionality using the API. The thing is that I don’t see any way to add a new keyword the way they added “script”, by using the API.
Thanks!

Maybe @RonGilbert finds time for a quick answer :slight_smile:

Official Thimbleweed Park Forums powered by Discourse.