manonamora

Notifications

Feb 21st, 2023
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. ~~~~ On the Story Page ~~~~
  2. //Sjoerd's Macro
  3. <<flash "You found Maxine!">> <</flash>>
  4.  
  5. // Plain Text
  6. <div class="notification">This would be a notification.</div>
  7.  
  8. // Conditional Display
  9. <<if $var is true>>[code of the notification of choice]<</if>
  10. can also work with : <<if $var>>, <<if def $var>>, <<if $var is (whatever you defined it as)>>
  11. <<if visited("Name of the current passage") is 1>>[Code of the notification of choice]<</if>>
  12.  
  13. ~~~~ Next to a Link ~~~~
  14. //Principle
  15. [[link|to Passage]]<<if condition>>NEW~<</if>>
  16.  
  17. //Variable
  18. :: Story
  19. <<set $var to true>>
  20.  
  21. :: Codex
  22. [[link|Page]]<<if $var>>NEW~<</if>>
  23.  
  24. :: Page
  25. <<unset $var>>
  26.  
  27. * To avoid the variable resetting:
  28. <<if visited("Story") is 1>><<set $var to true>><</if>>
  29. or
  30. [[link|Page]]<<if $var && (not hasVisited("Page"))>>NEW~<</if>>
  31.  
  32. * Alternative
  33. :: Story
  34. <<if visited("Story") is 1>><<set $var to "unread">><</if>>
  35.  
  36. :: Codex
  37. [[link|Page]]<<if $var is "unread">>NEW~<</if>>
  38.  
  39. :: Page
  40. <<set $var to "read">> OR <<unset $var>>
  41.  
  42. //Previously hidden link
  43. <<if condition for showing the link>>
  44. [[link|Page]]<<if not hasVisited("Page")>>NEW~<</if>>
  45. <<else>>Not available<</if>>
  46.  
  47. //Show updates
  48. :: Story 1
  49. <<if visited("Story 1") is 1>><<set $var to "new">><</if>>
  50.  
  51. :: Codex
  52. [[link|Page]]\
  53. <<if $var is "new">>NEW~\
  54. <<elseif $var is "update">>UPDATED~\
  55. <<elseif $var is "complete">>COMPLETED~\
  56. <</if>>
  57.  
  58. :: Page
  59. <<set $var to "read">> OR <<unset $var>>
  60.  
  61. :: Story 2
  62. <<if visited("Story 2") is 1>><<set $var to "update">><</if>>
  63.  
  64. :: Story 3
  65. <<if visited("Story 3") is 1>><<set $var to "complete">><</if>>
  66.  
  67. *Alternative with objects
  68. :: StoryInit
  69. <<set $link to {}>>
  70.  
  71. :: Story 1
  72. <<if visited("Story 1") is 1>><<set $link.fish to "new">><</if>>
  73.  
  74. :: Codex
  75. [[link|Page]]<<if $link.fish is "new">>NEW~<</if>>
  76.  
  77. //Widgets
  78. <<widget "notiflink">> <- for just one link
  79. <<if $var is "unread">>NEW~<</if>> or <<if $var is true>>NEW~<</if>> or <<if $var && (not hasVisited("Page"))>>NEW~<</if>>
  80. <</widget>>
  81.  
  82. <<widget "notiflink">> <- if you have multiple links
  83. <<if _args[0] is "unread">>NEW~<</if>>
  84. <</widget>>
  85.  
  86. <<widget "notiflink">> <- more than one state
  87. <<if _args[0] is "new">>NEW~
  88. <<elseif _args[0] is "update">>UPDATED~
  89. <<elseif _args[0] is "complete">>COMPLETED~
  90. <</if>>
  91. <</widget>>
  92.  
  93. * And to display it:
  94. [[link|Page]] <<notiflink>> <- one link
  95. [[link|Page]] <<notiflink $var>> <- multiple
Advertisement
Add Comment
Please, Sign In to add comment