Jump to content

Home

SCUMM script samples from Maniac Mansion


netmonkey

Recommended Posts

Some of you may find this interesting: Ron Gilbert gave a Maniac Mansion post-mortem at the Game Developers Conference last week and a couple of his slides showed some of the original Maniac Mansion scripts written in the SCUMM syntax.

 

How the clock in the mansion living room ticks:

script clock-tick {
   do {
       clock-state = not clock-state
       object living-room-clock state clock-state
       play-sound clock-tick
       break-here 60
   }
}

 

A cut-scene between Nurse Edna and Weird Ed:

cut-scene {
   ...
   actor nurse-edna in-room edna-bedroom at 60,20
   camera-follow nurse-edna
   actor nurse-edna walk-to 30,20
   wait-for-actor nurse-edna
   say-line nurse-edna "WHATS'S YOUR POINT ED!!!"
   wait-for-talking nurse-edna
   ...
}

Link to comment
Share on other sites

  • 4 months later...

I stumbled across a blog comment by Ron Gilbert, with some more information. I'm going to copy it here.

http://www.pagetable.com/?p=603

(it was also reposted as a separate article:

http://www.pagetable.com/?p=614)

 

Interestingly, SCUMM was originally supposed to be Lisp-like; and early versions didn't support complex arithmetic expressions (such as, say, subtracting two numbers and assigning the result to a variable)!

 

Ron Gilbert says:

29. May 2011 at 19:41

 

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.

 

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 – (dashes) as separators.

 

sandy-rescued = 1

 

This was a single variable, not sandy minus rescued. So how did SCUMM do subtraction? You didn’t. Until Monkey Island, there was no way to do complex expressions. if you wanted to subtract a value you used:

 

count -= 5

 

If you had a complex expression, you had to chain them using +=, -=, /= and *= using temp variables. Ugly, but it made the interpreter much simpler.

 

(Side note, the C64 interpreter was not named SPUTM, that name didn’t come about until the PC version).

 

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. :-(

 

Some examples:

 

actor sandy walk-to 67,8

 

This is the command that walked an actor to a spot.

 

actor sandy face-right

actor sandy do-animation reach

walk-actor razor to-object microwave-oven

start-script watch-edna

stop-script

stop-script watch-edna

say-line dave “Don’t be a tuna head.”

say-line selected-kid “I don’t want to use that right now.”

 

if (melt-down) {

say-line selected-kid “I don’t think this game is very fun.”

}

 

There were no functions, everything was a ‘script’, a small piece of code that looked a lot like a function, but it ran in it’s own virtual process.

 

script watch-clock {

do {

object clock state ON

break-time 60

object clock state OFF

break-time 60

}

}

 

Note the lack of a until/while on the do loop. The script would just continue until someone killed it.

 

Time was always measured in jiffies (1/60 second). Later on I added the ability to say ‘break-time 1 minute’ and the compiler just multiplied by 60 before emitting the opcode.

 

If you did…

 

start-script watch-edna

start-script clock-tick

 

…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’d just say…

 

start-script watch-edna

 

…and then forget about it. That one script could do whatever it needed and start a cut-scene if the need arose.

 

This may seem pretty tame today, but back then, it was like magic.

 

Bonus information: The SCUMM compiler was written in Yacc and Lex.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...