Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alan 3 Beta 05: Testing Nested Locations as Verb Parameters
--==============================================================================
-- "Test Verb on Enclosing Location" by Tristano Ajmone
--==============================================================================
-- Alan 3.0 Beta5
THE world IsA LOCATION.
-- Outer location enclosing other locations...
VERB touch
DOES "You touch $+1."
END VERB.
END THE.
-- 'touch' works with 'tent' and 'ball'! ('world' and 'yard' out of scope)
SYNTAX touch = touch (obj)
WHERE obj IsA ENTITY
ELSE "Invalid parameter for examine!"
--------------------------------------------------------------------------------
-- 'search' works with 'tent' and 'ball'! ('world' and 'yard' out of scope)
SYNTAX search = search (obj)
WHERE obj IsA ENTITY --> 'ENTITY' includes locations that are nested AT the
-- current location of hero.
ELSE "Invalid parameter for examine!"
-- 'inspect' works with 'ball' but fail with 'tent' (defaults to OBJECT)!
-- ('world' and 'yard' out of scope)
SYNTAX inspect = inspect (obj).
THE yard IsA LOCATION AT world.
DESCRIPTION "You can see a tent here."
VERB search
DOES "You search $+1."
END VERB.
VERB inspect
DOES "You inspect $+1."
END VERB.
END THE yard.
THE tent IsA LOCATION AT yard.
END THE.
THE ball IsA OBJECT AT yard.
END THE.
--------------------------------------------------------------------------------
-- 'examine' works with 'ball' but fail with 'tent' (because added to THING)!
SYNTAX examine = examine (obj)
WHERE obj IsA ENTITY
ELSE "Invalid parameter for examine!"
SYNONYMS x = examine.
ADD TO EVERY THING
VERB examine
DOES "You examine $+1."
END VERB.
END ADD TO.
--------------------------------------------------------------------------------
Start at yard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.