Advertisement
aika092

Example Direction Looking in Inform 7

Nov 23rd, 2023 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | Source Code | 0 0
  1. "Example Direction Looking" by Aika
  2.  
  3. A room can be ghost-filled. [This is a spooky room full of ghosts; flashlights react to these.]
  4. A room can be portal-filled. [This room has a portal to another dimension; radios react to these.]
  5.  
  6. Test1 is a room.
  7. Test2 is a room. Test2 is north of Test1.
  8. Test3 is a room. Test3 is ghost-filled. Test3 is east of Test1.
  9. Test4 is a room. Test4 is portal-filled. Test4 is south of Test1.
  10. Test5 is a room. Test5 is ghost-filled. Test5 is portal-filled. Test5 is west of Test1.
  11.  
  12. A detective-item is a kind of thing.
  13.  
  14. Definition: a detective-item is reacting:
  15. decide no. [This is the default, if we haven't coded anything for when the detective-item will trigger]
  16.  
  17. To say ReactionFlav of (D - a detective-item):
  18. say "The [D] whines.". [This is the default, if we haven't coded anything for when the detective-item will trigger]
  19.  
  20. flashlight is a detective-item. flashlight is carried by the player.
  21.  
  22. To say ReactionFlav of (D - flashlight):
  23. say "The [D] flickers.".
  24.  
  25. Definition: flashlight is reacting:
  26. if the noun is a direction: [just to confirm what we should hopefully already know, this function was called during an action where the noun given was a direction]
  27. let R be the room noun from the location of the player;
  28. if R is ghost-filled, decide yes;
  29. decide no.
  30.  
  31. radio is a detective-item. radio is carried by the player.
  32.  
  33. Definition: radio is reacting:
  34. if the noun is a direction: [just to confirm what we should hopefully already know, this function was called during an action where the noun given was a direction]
  35. let R be the room noun from the location of the player;
  36. if R is portal-filled, decide yes;
  37. decide no.
  38.  
  39. Check examining a direction:
  40. if there is a held reacting detective-item:
  41. repeat with D running through held reacting detective-items:
  42. say ReactionFlav of D;
  43. say "That's [if the number of held reacting detective-item is 1]a bit[otherwise]extremely[end if] unnerving..." instead. [We need to use 'instead' here, because if we don't, the action will continue, triggering the code to say its usual 'you see nothing special in that direction']
  44.  
  45. [The examine directions rule is not listed in the carry out examining rulebook.] [This is commented out because we shouldn't need it. But if we struggle to successfully circumvent this rule, we can include this line to give us more flexibility. However, this does mean that now when someone examines a direction with nothing interesting, it'll say something dumb like 'You see nothing special about the east'. So we might want to address that later.]
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement