Created
May 28, 2018 13:12
-
-
Save tajmone/1281b081b61aa656a4c5cb43d0702eae to your computer and use it in GitHub Desktop.
Alan IF 3beta05 Test META VERB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--============================================================================== | |
-- "METACOMANDI" by Tristano Ajmone | |
--============================================================================== | |
-- Questo test dimostra che non vi sono conflitti tra verbi di partita e verbi | |
-- comandi che richiedono oggetto. | |
-- | |
-- Per?resta il problema che se il comando ?un META VERB, questo influir? | |
-- su tutti gli altri: | |
-- | |
--| If your verb has multiple definitions, e.g. for various classes, applying | |
--| Meta to any one of them will make the verb a meta verb, meaning that if | |
--| the player uses that verb in any context and on any instance, it will take | |
--| no tick, even if that particular definition did not have the Meta property | |
--| explicitly expressed. A library might decide that 'score' was a meta verb | |
--| and there is nothing you, as an author, can do to override that short of | |
--| editing the library source. | |
-- All'atto pratico, questo esempio dimostra che un comando meta non esclude | |
-- l'esecuzione di EVENT, quindi non ?chiaro quale sia il beneficio dei tick. | |
THE stanza IsA LOCATION | |
END THE stanza. | |
--============================================================================== | |
-- LA PALLA | |
--============================================================================== | |
THE palla IsA object AT stanza. | |
HAS contatore 1. -- appoggiamo qui il contantore del ticker | |
END THE palla. | |
--============================================================================== | |
-- SALVA (COMANDO DI PARTITA) | |
--============================================================================== | |
SYNTAX salva = salva. | |
VERB salva | |
DOES ONLY "Partita salvata." | |
END VERB. | |
--============================================================================== | |
-- SALVA (VERBO) | |
--============================================================================== | |
SYNTAX salva_ogg = salva (obj) | |
WHERE obj ISA THING | |
ELSE SAY "Non puoi". | |
ADD TO EVERY THING | |
VERB salva_ogg | |
DOES ONLY "Salvi la palla." | |
END VERB. | |
END ADD TO. | |
--============================================================================== | |
-- ABBANDONA (COMANDO DI PARTITA) | |
--============================================================================== | |
SYNTAX abbandona = abbandona. | |
META VERB abbandona | |
DOES ONLY "Partita abbandonata." | |
END VERB. | |
--============================================================================== | |
-- ABBANDONA (VERBO) | |
--============================================================================== | |
SYNTAX abbandona_ogg = abbandona (obj) | |
WHERE obj ISA THING | |
ELSE SAY "Non puoi". | |
ADD TO EVERY THING | |
VERB abbandona_ogg | |
DOES ONLY "Abbandoni la palla." | |
END VERB. | |
END ADD TO. | |
--============================================================================== | |
-- PUNTEGGIO (COMANDO DI PARTITA) | |
--============================================================================== | |
SYNTAX punteggio = punteggio. | |
META VERB punteggio | |
DOES ONLY SCORE. | |
END VERB. | |
--============================================================================== | |
-- CONTATORE | |
--============================================================================== | |
EVENT ticker | |
"$nTicks: " SAY contatore OF palla. | |
INCREASE contatore OF palla. | |
SCHEDULE ticker AFTER 1. | |
END EVENT ticker. | |
-------------------------------------------------------------------------------- | |
Start at stanza. | |
Schedule ticker After 0. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment