lfnetwork.com mark read register faq members calendar

Thread: SCUMM script samples from Maniac Mansion
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-07-2011, 07:58 PM   #1
netmonkey
Rookie
 
netmonkey's Avatar
 
Join Date: Dec 2001
Location: USA
Posts: 84
SCUMM script samples from Maniac Mansion

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:
Code:
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:
Code:
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
    ...
}
netmonkey is offline   you may: quote & reply,
Old 03-08-2011, 12:36 PM   #2
bgbennyboy
Festively Plump
 
bgbennyboy's Avatar
 
Status: Super Moderator
Join Date: Feb 2002
Location: England
Posts: 1,984
LFN Staff Member 
Interesting! Well spotted.


Last edited by bgbennyboy; 03-08-2011 at 04:02 PM.
bgbennyboy is offline   you may: quote & reply,
Old 07-14-2011, 11:35 PM   #3
jestar_jokin
Rookie
 
Join Date: Sep 2004
Posts: 39
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)!

Quote:
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.
jestar_jokin is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Mixnmojo.com > Community Discussion Forums > SCUMM > SCUMM script samples from Maniac Mansion

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:02 PM.


LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.