CMHammond

Night Call (WikiText Generator)

Apr 12th, 2021 (edited)
1,018
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # If two "tables" link to the same content, then you'll need to manually remove the toggle for each that would otherwise hide that content unnecessarily.
  2. # As in, if A->A, B->B, C->B, D->D: then in "table"-B, you need to take out the toggle that will hide B's content when clicking C (And vice versa).
  3.  
  4. def build(opt, links, prefix, size):
  5.     print("\n\n * CODE BELOW - COPY AND PASTE AS NEEDED * \n\n")
  6.  
  7.     # Starting with NONE
  8.     print(f"<div class=\"mw-collapsible\" id=\"mw-customcollapsible-{prefix}:none\">")
  9.     print(f"<div class=\"mw-customtoggle-{links[0]} mw-customtoggle-:{prefix}A: mw-customtoggle-{prefix}:none\"><span style=\"color:#eac98b;\">{opt[0]}</span></div>")
  10.     print(f"<div class=\"mw-customtoggle-{links[1]} mw-customtoggle-:{prefix}B: mw-customtoggle-{prefix}:none\"><span style=\"color:#eac98b;\">{opt[1]}</span></div>")
  11.  
  12.     if size >= 3:
  13.         print(f"<div class=\"mw-customtoggle-{links[2]} mw-customtoggle-:{prefix}C: mw-customtoggle-{prefix}:none\"><span style=\"color:#eac98b;\">{opt[2]}</span></div>")
  14.         if size == 4:
  15.             print(f"<div class=\"mw-customtoggle-{links[3]} mw-customtoggle-:{prefix}D: mw-customtoggle-{prefix}:none\"><span style=\"color:#eac98b;\">{opt[3]}</span></div>")
  16.     print("</div>\n")
  17.     #--------------------
  18.  
  19.     # Now onto A -------
  20.     print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-:{prefix}A:\">")
  21.     print(f"<div class=\"mw-customtoggle-{links[0]} mw-customtoggle-{prefix}:none mw-customtoggle-:{prefix}A:\"><span style=\"background-color:#dba43d;\">{opt[0]}</span></div>")
  22.     print(f"<div class=\"mw-customtoggle-{links[1]} mw-customtoggle-{links[0]} mw-customtoggle-:{prefix}B: mw-customtoggle-:{prefix}A:\"><span style=\"color:#eac98b;\">{opt[1]}</span></div>")
  23.  
  24.     if size >= 3:
  25.         print(f"<div class=\"mw-customtoggle-{links[2]} mw-customtoggle-{links[0]} mw-customtoggle-:{prefix}C: mw-customtoggle-:{prefix}A:\"><span style=\"color:#eac98b;\">{opt[2]}</span></div>")
  26.         if size == 4:
  27.             print(f"<div class=\"mw-customtoggle-{links[3]} mw-customtoggle-{links[0]} mw-customtoggle-:{prefix}D: mw-customtoggle-:{prefix}A:\"><span style=\"color:#eac98b;\">{opt[3]}</span></div>")
  28.     print("</div>\n")
  29.     #--------------------
  30.  
  31.     # Then onto B ------
  32.     print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-:{prefix}B:\">")
  33.     print(f"<div class=\"mw-customtoggle-{links[0]} mw-customtoggle-{links[1]} mw-customtoggle-:{prefix}A: mw-customtoggle-:{prefix}B:\"><span style=\"color:#eac98b;\">{opt[0]}</span></div>")
  34.     print(f"<div class=\"mw-customtoggle-{links[1]} mw-customtoggle-{prefix}:none mw-customtoggle-:{prefix}B:\"><span style=\"background-color:#dba43d;\">{opt[1]}</span></div>")
  35.  
  36.     if size >= 3:
  37.         print(f"<div class=\"mw-customtoggle-{links[2]} mw-customtoggle-{links[1]} mw-customtoggle-:{prefix}C: mw-customtoggle-:{prefix}B:\"><span style=\"color:#eac98b;\">{opt[2]}</span></div>")
  38.         if size == 4:
  39.             print(f"<div class=\"mw-customtoggle-{links[3]} mw-customtoggle-{links[1]} mw-customtoggle-:{prefix}D: mw-customtoggle-:{prefix}B:\"><span style=\"color:#eac98b;\">{opt[3]}</span></div>")
  40.     print("</div>\n")
  41.     #--------------------
  42.  
  43.     if size >= 3:
  44.         # C's turn ---------
  45.         print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-:{prefix}C:\">")
  46.         print(f"<div class=\"mw-customtoggle-{links[0]} mw-customtoggle-{links[2]} mw-customtoggle-:{prefix}A: mw-customtoggle-:{prefix}C:\"><span style=\"color:#eac98b;\">{opt[0]}</span></div>")
  47.         print(f"<div class=\"mw-customtoggle-{links[1]} mw-customtoggle-{links[2]} mw-customtoggle-:{prefix}B: mw-customtoggle-:{prefix}C:\"><span style=\"color:#eac98b;\">{opt[1]}</span></div>")
  48.         print(f"<div class=\"mw-customtoggle-{links[2]} mw-customtoggle-{prefix}:none mw-customtoggle-:{prefix}C:\"><span style=\"background-color:#dba43d;\">{opt[2]}</span></div>")
  49.  
  50.         if size == 4:
  51.             print(f"<div class=\"mw-customtoggle-{links[3]} mw-customtoggle-{links[2]} mw-customtoggle-:{prefix}D: mw-customtoggle-:{prefix}C:\"><span style=\"color:#eac98b;\">{opt[3]}</span></div>")
  52.         print("</div>\n")
  53.         # --------------------
  54.  
  55.         if size == 4:
  56.             # Finally - D --------
  57.             print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-:{prefix}D:\">")
  58.             print(f"<div class=\"mw-customtoggle-{links[0]} mw-customtoggle-{links[3]} mw-customtoggle-:{prefix}A: mw-customtoggle-:{prefix}D:\"><span style=\"color:#eac98b;\">{opt[0]}</span></div>")
  59.             print(f"<div class=\"mw-customtoggle-{links[1]} mw-customtoggle-{links[3]} mw-customtoggle-:{prefix}B: mw-customtoggle-:{prefix}D:\"><span style=\"color:#eac98b;\">{opt[1]}</span></div>")
  60.             print(f"<div class=\"mw-customtoggle-{links[2]} mw-customtoggle-{links[3]} mw-customtoggle-:{prefix}C: mw-customtoggle-:{prefix}D:\"><span style=\"color:#eac98b;\">{opt[2]}</span></div>")
  61.             print(f"<div class=\"mw-customtoggle-{links[3]} mw-customtoggle-{prefix}:none mw-customtoggle-:{prefix}D:\"><span style=\"background-color:#dba43d;\">{opt[3]}</span></div>")
  62.             print("</div>\n")
  63.             # --------------------
  64.  
  65.     print ("\n\n * THIS NEXT SECTION IS FOR THE COLLAPSIBLE CONTENT - COPY AND PASTE IF NEEDED *\n\n")
  66.  
  67.     print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-{links[0]}\">")
  68.     print("\n\n\n\n</div>\n")
  69.     print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-{links[1]}\">")
  70.     print("\n\n\n\n</div>\n")
  71.     if size >= 3:
  72.         print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-{links[2]}\">")
  73.         print("\n\n\n\n</div>\n")
  74.         if size == 4:
  75.             print(f"<div class=\"mw-collapsible mw-collapsed\" id=\"mw-customcollapsible-{links[3]}\">")
  76.             print("\n\n\n\n</div>\n")
  77.  
  78.  
  79.  
  80.  
  81. def display(opt, links, size):
  82.     # To show your inputs afterwards - good for spotting mistakes.
  83.  
  84.     print()
  85.     for x in range(size):
  86.         print(opt[x] + " - links to  \"" + links[x] + "\"")
  87.     #print("Prefix:", p, "Size:", size)
  88.  
  89. def punct(opt, p, size):
  90.     for x in range(size):
  91.         if opt[x] == "s": opt[x] = "(Stay silent.)"
  92.         elif not (")" in opt[x] or "(" in opt[x]):
  93.             opt[x] = "« %s »" % opt[x]
  94.  
  95.     print(f"\nRemember to include the prefix ({p}) if needed!\n")
  96.     a_to = input(f"Where does clicking (A) {opt[0]} take you?: ")
  97.     if a_to == "": a_to = p + "a"
  98.     b_to = input(f"Where does clicking (B) {opt[1]} take you?: ")
  99.     if b_to == "": b_to = p + "b"
  100.  
  101.     c_to = None
  102.     d_to = None
  103.     if size >= 3:
  104.         c_to = input(f"Where does clicking (C) {opt[2]} take you?: ")
  105.         if c_to == "": c_to = p + "c"
  106.         if size == 4:
  107.             d_to = input(f"Where does clicking (D) {opt[3]} take you?: ")
  108.             if d_to == "": d_to = p + "d"
  109.  
  110.     links = [a_to, b_to, c_to, d_to]
  111.  
  112.     display(opt, links, size)
  113.     return build(opt, links, p, size)
  114.  
  115.  
  116. def ask():
  117.     p = input("Prefix?: ")
  118.     a = input("Option A: ")
  119.     b = input("Option B: ")
  120.     c = input("Option C: ")
  121.  
  122.     # Error handling
  123.     if a == "" or b == "":
  124.         print("Not enough options!\n")
  125.         return ask()
  126.  
  127.     if c == "":
  128.         return punct([a, b], p, 2)
  129.     else:
  130.         d = input("Option D: ")
  131.         if d == "":
  132.             return punct([a, b, c], p, 3)
  133.         else:
  134.             return punct([a, b, c, d], p, 4)
  135.  
  136.  
  137. if __name__ == "__main__":
  138.    ask()
  139.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×