manonamora

Flag Event Edited

Feb 2nd, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. :: StroryInit
  2. <<set $Flag = {}>>
  3.  
  4. :: In any passage
  5. <<set $Flag[candy] = true>>
  6. <<set $Flag[candy] = 1234>>
  7. <<set $Flag[candy] = "sour">>
  8.  
  9. :: Testing the Flag
  10. <<if $Flags["candy"]>>
  11. The candy I ate was $Flags["candy"]!
  12. <</if>>
  13.  
  14. :: Delete the Flag
  15. <<run delete $Flags["candy"]>>
  16.  
  17. :: The New Widget
  18. <<widget "MakeAFlag>>
  19. <<if def $args[1]>> <- if you give a flag a value or delete it
  20. <<if $args[1] == false>>
  21. <<;if def $Flags[_args[0]]>>
  22. <<run delete $Flags[_args[0]]>>
  23. <</if>>
  24. <<else>>
  25. <<set $Flags[_args[0]] = _args[1]>>
  26. <</if>>
  27. <<else>>
  28. <<set $Flags[_args[0]] = true>>
  29. <</if>>
  30. <</widget>>
  31.  
  32. <<MakeAFlag "flagname" "value">>
  33.  
Advertisement
Add Comment
Please, Sign In to add comment