X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=informqr%2Finformqr.md;h=ea91c72a2e90366a0d5387b6190af5a23f3b85a8;hb=4dc8a597bea19678f310c476b54474fa08e61d2b;hp=40a9fadb490523c262f647afef6d9aaa6b836287;hpb=582be378714b41937fb2cc99c4d6f8e96c76a910;p=inform-resources.git diff --git a/informqr/informqr.md b/informqr/informqr.md index 40a9fad..ea91c72 100644 --- a/informqr/informqr.md +++ b/informqr/informqr.md @@ -348,7 +348,7 @@ A routine **embedded** as the value of an object property: statement; ] -Routines return a single value, when execution reaches the final "\]" +Routines return a single value, when execution reaches the final "]" or an explicit return statement: return expr; @@ -520,4 +520,184 @@ To assign to one of 32 'low string' variables: string N "string"; Lowstring string_var "string"; - string N string_var; \ No newline at end of file + string N string_var; + +Verbs and Actions +----------------- + +To specify a new verb: + + Verb 'verb ' 'verb ' ... 'verb ' + * token token ... token -> action + * token token ... token -> action + ... + * token token ... token -> action; + +where instead "`Verb`" can be "`Verb meta`", "*action*" can be +"`action reverse`"; *tokens* are optional and each is one of: + + ----------------- ---------------------------------------------- + 'word' that literal word + 'w1'/'w2'/... any one of those literal words + attribute an object with that attribute + creature an object with `animate` attribute + held an object held by the player + noun an object in scope + noun=`routine` an object for which *routine* returns `true` + scope=`routine` an object in this re-definition of scope + multiheld one or more objects held by the player + multi one or more objects in scope + multiexcept as multi, omitting the specified object + multiinside as multi, omitting those in specified object + topic any text + number any number + routine a general parsing routine + ----------------- ---------------------------------------------- + +To add synonyms to an existing verb: + + Verb 'verb ' 'verb ' ... = 'existing_verb'; + +To modify an existing verb: + + Extend 'existing_verb ' last + * token token ... token –> action + * token token ... token –> action + ... + * token token ... token –> action ; + +where instead "`Extend`" can be "`Extend only`" and "`last`" can be +omitted, or changed to "`first`" or "`replace`" + +To explicitly trigger a defined action (both *noun* and *second* are +optional, depending on the action): + + ; + +To explicitly trigger a defined action, then return `true` from the +current routine: + + <>; + +Other useful directives +----------------------- + +To include a directive within a routine definition [...], insert a +hash "#" as its first character. + +To conditionally compile: + + Ifdef name; ! use any one of these + Ifndef name; ! + Iftrue expr; ! + Iffalse expr; ! + ... + Ifnot; + ... + Endif; + +To display a compile-time message: + + Message "string"; + +To include the contents of a file, searching the Library path: + + Include "source_file"; + +To include the contents of a file in the same location as the current +file: + + Include ">source_file"; + +To specify that a library routine is to be replaced: + + Replace routine; + +To set the game's release number (default is 1), serial number +(default is today's *yymmdd*) and status line format (default is +`score`): + + Release expr; + Serial "yymmdd"; + Statusline score; + Statusline time; + +To declare a new attribute common to all objects: + + Attribute attribute ; + +To declare a new property common to all objects: + + Property property; + Property property expr; + +Uncommon and deprecated directives +---------------------------------- + +You're unlikely to need these; look them up if necessary. + + Abbreviate "string " "string " ... "string "; + End; + Import variable variable ... variable; + Link "compiled_file"; + Switches list_of_compiler_switches; + System_file; + +File structure +-------------- + +A minimal source file: + + Constant Story "MYGAME"; + Constant Headline "^My first Inform game.^"; + Constant MANUAL_PRONOUNS; + + Include "Parser"; + Include "VerbLib"; + + [ Initialise; location = study; "^Hello!^"; ]; + + Class Room + with description "A bare room." + has light; + + Class Furniture + with before [; Take,Pull,Push,Pushdir: + print_ret (The) self, + " is too heavy for that."; ] + has static supporter; + + Room study "Your study'; + + Furniture "writing desk" study + with name 'writing' 'desk' 'table'; + + Object -> -> axe "rusty axe" + with name 'rusty' 'blunt' 'axe' 'hatchet' + description "It seems old and blunt."; + + Include "Grammar"; + +Compiler +-------- + +To compile: + + inform commands source_file + +Useful *commands* include: + + -------------- ------------------------------------------------ + -~S disable both Strict checks and Debug tools + -~SD disable Strict checks, enable Debug tools + -X enable Infix debugger + -r output all game text to file (for spell-check) + -s display game's size and other statistics + -z display game's memory map + -v8 compile in Version 8 format (default is v5) + +dir,dir,... search for Included files in these directories + -------------- ------------------------------------------------ + +To display full compiler help, type: + + inform -h -h1 -h2 \ No newline at end of file