{"id":614,"date":"2011-05-30T03:41:16","date_gmt":"2011-05-30T11:41:16","guid":{"rendered":"http:\/\/www.pagetable.com\/?p=614"},"modified":"2011-05-30T03:41:16","modified_gmt":"2011-05-30T11:41:16","slug":"scumm-script","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=614","title":{"rendered":"SCUMM Script"},"content":{"rendered":"<p><i><a href=\"http:\/\/grumpygamer.com\/\">Ron Gilbert<\/a> posted this as a comment on <a href=\"http:\/\/www.pagetable.com\/?p=603\">The Mansion &#8211; Technical Aspects<\/a>, I am re-posting it here as an article.<\/i><\/p>\n<p>SCUMM script was a little odd.  When I first started designing the language, I was going to base it on Lisp.  I was use to using it to customize emacs that we used to do all our coding.  This was not on PCs, but on large multiuser UNIX machines.  The Lucasfilm games group was part of the Lucasfilm computer division (which later became Pixar) and we had some very smart people that connected the C64 to the UNIX machine.  From my UNIX terminal, I had complete control over the C64 and wrote a source level debugger for SCUMM.  The 6502 assembler was custom written by Chip Morningstar and ran on the UNIX machine.<\/p>\n<p>But I digress.  So, SCUMM started out as Lisp based, but I quickly abandon that approach in favor of something that looked a little more C-like, but some aspects of Lisp remained, mostly in the naming conventions.  Commands and variables used &#8211; (dashes) as separators.<\/p>\n<pre>sandy-rescued = 1<\/pre>\n<p>This was a single variable, not sandy minus rescued.  So how did SCUMM do subtraction?  You didn&#8217;t.  Until Monkey Island, there was no way to do complex expressions.  if you wanted to subtract a value you used:<\/p>\n<pre>count -= 5<\/pre>\n<p>If you had a complex expression, you had to chain them using +=, -=, \/= and *= using temp variables.  Ugly, but it made the interpreter much simpler.  <\/p>\n<p>(Side note, the C64 interpreter was not named SPUTM, that name didn&#8217;t come about until the PC version).<\/p>\n<p>One of the goals I had for the SCUMM system was that non-programers could use it.  I wanted SCUMM scripts to look more like movies scripts, so the language got a little too wordy.  This goal was never really reached, you always needed to be a programmer.  \ud83d\ude41<\/p>\n<p>Some examples:<\/p>\n<pre>actor sandy walk-to 67,8<\/pre>\n<p>This is the command that walked an actor to a spot.<\/p>\n<pre>actor sandy face-right\nactor sandy do-animation reach\nwalk-actor razor to-object microwave-oven\nstart-script watch-edna\nstop-script\nstop-script watch-edna\nsay-line dave \"Don't be a tuna head.\"\nsay-line selected-kid \"I don't want to use that right now.\"<\/pre>\n<pre>if (melt-down) {\n  say-line selected-kid \"I don't think this game is very fun.\"\n}<\/pre>\n<p>There were no functions, everything was a &#8216;script&#8217;, a small piece of code that looked a lot like a function, but it ran in it&#8217;s own virtual process.  <\/p>\n<pre>script watch-clock {\n  do {\n    object clock state ON\n    break-time 60\n    object clock state OFF\n    break-time 60\n  }\n}<\/pre>\n<p>Note the lack of a until\/while on the do loop.  The script would just continue until someone killed it.<\/p>\n<p>Time was always measured in jiffies (1\/60 second).  Later on I added the ability to say &#8216;break-time 1 minute&#8217; and the compiler just multiplied by 60 before emitting the opcode.<\/p>\n<p>If you did&#8230;<\/p>\n<pre>start-script watch-edna\nstart-script clock-tick<\/pre>\n<p>&#8230;you now had 2 additional scripts running and they all ran at the same time using preemptive multitasking.  It was a heck of a lot better than doing state engines.  If you wanted to keep an eye on something, you&#8217;d just say&#8230;<\/p>\n<pre>start-script watch-edna<\/pre>\n<p>&#8230;and then forget about it.  That one script could do whatever it needed and start a cut-scene if the need arose.<\/p>\n<p>This may seem pretty tame today, but back then, it was like magic.<\/p>\n<p>Bonus information:  The SCUMM compiler was written in Yacc and Lex.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ron Gilbert posted this as a comment on The Mansion &#8211; Technical Aspects, I am re-posting it here as an article. SCUMM script was a little odd. When I first started designing the language, I was going to base it on Lisp. I was use to using it to customize emacs that we used to &#8230; <a title=\"SCUMM Script\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=614\" aria-label=\"Read more about SCUMM Script\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,27,33],"tags":[],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-archeology","category-scumm","category-trivia"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=614"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/614\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}