Jump to content
IGNORED

The Upward Spiral - Ursa script interpreter


RSS Bot

Recommended Posts

Began a major rewrite of ursac -- the Ursa script compiler -- some time ago. It's a lot cleaner code than the first go. It's also more practical for the type of game Little Dipper has become. It'll need reworking for Big Dipper, if that project ever flies.

 

Among other things:

  • Global default includes file rather than hardcoded enumerations (res/global.ursa) -- mostly just needed for defining global flags set
  • File inclusion (include file. => res/file.ursa)
  • Special binary modules supported: currently just for password-entry, everything else (so far) is stock for Skyline -- use module. do module. -- for example: use numeric_password_entry. do numeric_password_entry. -- The "use" declaration will be monitored by mkmk (Makefile generator), the "do" verb is an actual runtime command to call the exported method (ursa_do_$x)
  • Syntax is more COBOLish than BCPLish now.

Some example statements ...

 

# these two are equivalent
say:
HELLO, WORLD.
.
# as:
say "HELLO, WORLD.".
# Menus...
ask "WOULD YOU LIKE TO PLAY A GAME?";
for "YES", let_us_play; for "NO", you_are_boring.
# Maths
set my x to 8.
set my reflection to true.
set my x to player_x.
set r0 to r0 + 4.
# Assembly-type maths
load r0.
add 4.
rotate left.
rotate right.
subtract 3.
store r0.
# Note that carry is cleared and ignored.
# Flags.
if my reflection is true, label_to_jump_to.
if bit 3 of r0 is false, label_to_jump_to.
set bit 2 of r0 to true.
# Comparisons
compare my x to player_x; when lesser, label_to_jump_to;
 when greater, some_other_label.
compare r0 to 8; when equal, label_target.
# bpl, bmi, bne, beq analogues.
# zero test
if r0 is zero, label_to_jump_to.
# Object classes dispatch table
class zombie:
when hit, zombie_hit.
when bump, zombie_bump.
when lighted, zombie_lighted.
when become, become_zombie.
class done.
# Invoking an object method
zombie_hit:
if friend is zero, zombie_hit_player.
# ignore non-player sprite collisions
done.
zombie_hit_player:
set player_hp to player_hp - 2.
become zombie_attacking.
done.
class zombie_attacking:
when become, become_zombie_attacking.
when alarm, zombie_done_attacking.
class done.
become_zombie_attacking:
set my reflection to false.
set my graphic to zombie_attacking.
set my timer to 1.
done.
zombie_done_attacking:
become zombie.
done.
show picture skyline.png with caption:
BY BRUCE-ROBERT
POCOCK AND
CHRISTOPHER
BURLINGHAM
.

 

The ursac rewrite is back burner, but progressing, so hopefully some scripting capabilities of a minimal sort will make it into next week's "playable" pre-alpha.

 

http://www.atariage.com/forums/index.php?a...;showentry=3849

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...